Forgot Password Confirm
485316
protected function ForgotPasswordConfirm()
	{
		if (!$this->_login->getCanRetrievePassword())
		{
			$this->FormLogin();
			return;
		}
		$myWords = $this->WordCollection();

		$container = new XmlnukeUIAlert($this->_context, UIAlert::BoxInfo);
		$container->setAutoHide(5000);
		$this->_blockCenter->addXmlnukeObject($container);

		$user = $this->_users->getUserEMail( $this->_context->get("email") );

		if (is_null($user))
		{
			$container->addXmlnukeObject(new XmlnukeText($myWords->Value("FORGOTUSERFAIL"), true));
			$this->ForgotPassword();
		}
		else
		{
			$newpassword = sha1($this->getRandomPassword());
			$user->setField('TOKEN_PWD_RESET', $newpassword);
			$user->setField('TOKEN_PWD_RESET_VALID', DateUtil::DateAdd(DateUtil::Today(DATEFORMAT::YMD), 2, DATEFORMAT::YMD));
			$this->_users->Save();
			$this->sendResetPasswordMessage($myWords, $user->getField($this->_users->getUserTable()->name), $user->getField($this->_users->getUserTable()->username), $user->getField($this->_users->getUserTable()->email), $newpassword );
			$container->addXmlnukeObject(new XmlnukeText($myWords->Value("FORGOTUSEROK"), true));
			$this->FormLogin();
		}
	}
259447
protected function ResetPasswordConfirm()
	{
		$myWords = $this->WordCollection();

		if (!$this->_login->getCanRetrievePassword())
		{
			$this->FormLogin();
			return;
		}
		elseif ($this->_login->getPassword() == "" || $this->_context->get('password2') == "")
		{
			$container = new XmlnukeUIAlert($this->_context, UIAlert::BoxAlert);
			$container->setAutoHide(5000);
			$container->addXmlnukeObject(new XmlnukeText($myWords->Value("PASSWORDISREQUIRED"), true));
			$this->_blockCenter->addXmlnukeObject($container);

			$this->ResetPassword();
			return;
		}
		elseif ($this->_login->getPassword() != $this->_context->get('password2'))
		{
			$container = new XmlnukeUIAlert($this->_context, UIAlert::BoxAlert);
			$container->setAutoHide(5000);
			$container->addXmlnukeObject(new XmlnukeText($myWords->Value("PASSWORDNOTMATCH"), true));
			$this->_blockCenter->addXmlnukeObject($container);

			$this->ResetPassword();
			return;
		}

		$user = $this->_users->getUserName( $this->_login->getUsername() );

		$tokenValid = $user->getField("TOKEN_PWD_RESET") == $this->_login->getResetToken()
				&& $user->getField("TOKEN_PWD_RESET_VALID") >= DateUtil::Today(DATEFORMAT::YMD);

		if (is_null($user) || !$tokenValid)
		{
			$this->FormLogin();
		}
		elseif ($user->getField("TOKEN_PWD_RESET") != $this->_login->getResetToken())
		{
			$container = new XmlnukeUIAlert($this->_context, UIAlert::BoxAlert);
			$container->setAutoHide(5000);
			$container->addXmlnukeObject(new XmlnukeText($myWords->Value("RESETINVALIDTOKEN"), true));
			$this->_blockCenter->addXmlnukeObject($container);

			$this->FormLogin();
			return;
		}
		else
		{
			$newpassword = $this->_users->getSHAPassword($this->_login->getPassword());
			$user->setField('TOKEN_PWD_RESET', '');
			$user->setField('TOKEN_PWD_RESET_VALID', '');
			$user->setField($this->_users->getUserTable()->password, $newpassword);
			$this->_users->Save();
			$container = new XmlnukeUIAlert($this->_context, UIAlert::ModalDialog, "");
			$container->addRedirectButton($myWords->Value("TXT_BACK"), $this->_login->getReturnUrl());
			$container->addXmlnukeObject(new XmlnukeText($myWords->Value("RESETPASSWORDOK"), true));
			$this->_blockCenter->addXmlnukeObject($container);
			$this->FormLogin();
		}
	}
304112
async function confirmResetPassword(form) {
  await client.connect();
  try {
    console.log("token : ", sessionStorage.getItem("token"));
    await api.confirmResetPassword(
      {
        token: sessionStorage.getItem("token"),
        firstPassword: form.firstPassword.value,
        secondPassword: form.secondPassword.value
      },
      "user"
    );
    displayMessage("Reset password", "Password changed", "is-success");
    goTo("login");
    sessionStorage.clear();
  } catch (e) {
    displayMessage(
      "Reset password",
      `Failed to reset the password. Cause: ${e.message}`,
      "is-danger"
    );
  }
}
109522
function passwd(oldPassword, newPassword, callback) {
    if (!deis._authenticated) {
      return callback(new Error('You need to login first'));
    }

    deis.client.post(format('/%s/auth/passwd', deis.version), {
      password: oldPassword,
      new_password: newPassword
    }, function(err, res, body) {
      if (err) {
        return callback(err);
      }

      if (res.statusCode === 200) {
        return callback(null);
      }

      return callback(new Error('Password change failed: ' + body.detail));
    });
  }
1061291
function resetPassword()
    {
        $infoMessage = null;
        $formErrors = null;

        $form = new FormResetPassword();
        if ($form->validate()) {
            $nonce = $form->getSubmitValue('form_nonce');
            if (Nonce::verifyNonce('Login.login', $nonce)) {
                $formErrors = $this->resetPasswordFirstStep($form);
                if (empty($formErrors)) {
                    $infoMessage = Piwik::translate('Login_ConfirmationLinkSent');
                }
            } else {
                $formErrors = array($this->getMessageExceptionNoAccess());
            }
        } else {
            // if invalid, display error
            $formData = $form->getFormData();
            $formErrors = $formData['errors'];
        }

        $view = new View('@Login/resetPassword');
        $view->infoMessage = $infoMessage;
        $view->formErrors = $formErrors;

        return $view->render();
    }
754516
public function forgotPassword()
    {
        $sEmail = \OxidEsales\Eshop\Core\Registry::getConfig()->getRequestParameter('lgn_usr');
        $this->_sForgotEmail = $sEmail;
        $oEmail = oxNew(\OxidEsales\Eshop\Core\Email::class);

        // problems sending passwd reminder ?
        $iSuccess = false;
        if ($sEmail) {
            $iSuccess = $oEmail->sendForgotPwdEmail($sEmail);
        }
        if ($iSuccess !== true) {
            $sError = ($iSuccess === false) ? 'ERROR_MESSAGE_PASSWORD_EMAIL_INVALID' : 'MESSAGE_NOT_ABLE_TO_SEND_EMAIL';
            \OxidEsales\Eshop\Core\Registry::getUtilsView()->addErrorToDisplay($sError, false, true);
            $this->_sForgotEmail = false;
        }
    }
1166677
async function askResetPassword(form) {
  await client.connect();

  try {
    await api.askResetPassword(
      {
        login: form.login.value
      },
      "user"
    );
    displayMessage(
      "Reset password",
      "A link was sent to reset your password",
      "is-success"
    );
    goTo("login");
  } catch (e) {
    displayMessage(
      "Reset password",
      `Failed to send the link to reset your password. Cause: ${e.message}`,
      "is-danger"
    );
  }
}
366700
def remember_password(ctx, forget, clear_all):
    
    controller = ctx.obj['controller']
    settings = ctx.obj['settings']
    keys = settings.setdefault('keys', {})
    if clear_all:
        del settings['keys']
        settings.write()
        click.echo('All passwords have been cleared.')
    elif forget:
        if controller.id in keys:
            del keys[controller.id]
            settings.write()
        click.echo('Password forgotten.')
    else:
        ensure_validated(ctx, remember=True)
913933
public function lostPassword()
    {
        if ($this->request->is('post') && !empty($this->request->data)) {
            /** @var User $user */
            $user = $this->Users->newEntity($this->request->data, ['validate' => 'emailOnly']);
            if (!$user->errors()) {
                if (($user = $this->Users->existsWithEmail($user->email))) {
                    $this->loadModel('Wasabi/Core.Tokens');

                    $this->Tokens->invalidateExistingTokens($user->id, TokensTable::TYPE_LOST_PASSWORD);
                    $token = $this->Tokens->generateToken($user, TokensTable::TYPE_LOST_PASSWORD);
                    $this->getMailer('Wasabi/Core.User')->send('lostPasswordEmail', [$user, $token]);
                }
                $this->Flash->success(__d('wasabi_core', 'We have sent you an email to reset your password.'));
                $this->redirect(['action' => 'login']);
                return;
            } else {
                $this->request->session()->write('data.lostPassword', $this->request->data());
                $this->Flash->error($this->formErrorMessage);
                $this->redirect(['action' => 'lostPassword']);
                return;
            }
        } else {
            if ($this->request->session()->check('data.lostPassword')) {
                $this->request->data = (array)$this->request->session()->read('data.lostPassword');
                $this->request->session()->delete('data.lostPassword');
            }
            $user = $this->Users->newEntity($this->request->data, ['validate' => 'emailOnly']);
        }
        $this->set('user', $user);
        $this->render(null, 'Wasabi/Core.support');
    }
910122
def whoami(ctx, opts):
    """"""
    click.echo("Retrieving your authentication status from the API ... ", nl=False)

    context_msg = "Failed to retrieve your authentication status!"
    with handle_api_exceptions(ctx, opts=opts, context_msg=context_msg):
        with maybe_spinner(opts):
            is_auth, username, email, name = get_user_brief()

    click.secho("OK", fg="green")
    click.echo("You are authenticated as:")
    if not is_auth:
        click.secho("Nobody (i.e. anonymous user)", fg="yellow")
    else:
        click.secho(
            "%(name)s (slug: %(username)s, email: %(email)s)"
            % {
                "name": click.style(name, fg="cyan"),
                "username": click.style(username, fg="magenta"),
                "email": click.style(email, fg="green"),
            }
        )
1357750
def reset_password(self, action_token, signed_data):
        
        try:
            action = "reset-password"
            user = get_user_by_action_token(action, action_token)
            if not user or not user.signed_data_match(signed_data, action):
                raise mocha_exc.AppError("Verification Invalid!")

            if request.method == "POST":
                password = request.form.get("password", "").strip()
                password_confirm = request.form.get("password_confirm",
                                                    "").strip()
                if not password or password != password_confirm:
                    raise exceptions.AuthError(
                        "Password is missing or passwords don't match")

                user.change_password(password)
                user.set_email_verified(True)
                session_set_require_password_change(False)
                flash_success("Password updated successfully!")
                return redirect(__options__.get("login_view") or self.login)

            return {"action_token": action_token, "signed_data": signed_data}

        except (mocha_exc.AppError, exceptions.AuthError) as ex:
            flash_error(str(ex))
        except Exception as e:
            logging.exception(e)
            flash_error("Unable to reset password")
        return redirect(self.login)
750301
def reset_passwd(self, data):
        
        error = False
        msg = ""

        # Check input format
        if len(data["passwd"]) < 6:
            error = True
            msg = _("Password too short.")
        elif data["passwd"] != data["passwd2"]:
            error = True
            msg = _("Passwords don't match !")

        if not error:
            passwd_hash = hashlib.sha512(data["passwd"].encode("utf-8")).hexdigest()
            user = self.database.users.find_one_and_update({"reset": data["reset_hash"]},
                                                           {"$set": {"password": passwd_hash},
                                                            "$unset": {"reset": True, "activate": True}})
            if user is None:
                error = True
                msg = _("Invalid reset hash.")
            else:
                msg = _("Your password has been successfully changed.")

        return msg, error
1154949
def reset_password(server_context, email, container_path=None):
    
    url = server_context.build_url(security_controller, 'adminRotatePassword.api', container_path)

    return server_context.make_request(url, {
        'email': email
    })
1150488
def gtpswd(prompt, confirmPassword):
    
    try:
        return util.getPassword(prompt=prompt,
                                confirmPrompt=confirmPassword,
                                confirm=True)
    except TypeError:
        return util.getPassword(prompt=prompt,
                                confirm=True)
100577
def reset_pw_confirm_view(request, uidb64=None, token=None):
    
    return password_reset_confirm(request,
        template_name="reset_confirmation.html",
        uidb64=uidb64, token=token, post_reset_redirect=reverse('login'))
493617
public function forgotpasswordAction() {
        $this->view->title = __('forgot password page title');
        $authVars = Garp_Auth::getInstance()->getConfigValues('forgotpassword');

        $this->view->successMessage = intval($this->getRequest()->getParam('success')) === 1 ?
            __($authVars['success_message']) : null;

        if (!$this->getRequest()->isPost()) {
            return;
        }

        if ($this->getRequest()->getPost(self::HONEYPOT_COLUMN)) {
            throw new Garp_Auth_Exception(__('honeypot error'));
        }

        $this->view->email = $email = $this->getRequest()->getPost('email');
        $userModel = new Model_User();
        if (!$user = $userModel->fetchByEmail($email)) {
            $this->view->formError = __('email addr not found');
            return;
        }

        $activationToken = uniqid();
        $activationCode = Garp_Auth::getInstance()->generateActivationCodeForUser(
            $activationToken, $email, $user->id
        );
        $activationCodeExpiry = Garp_Auth::getInstance()->generateActivationCodeExpiry();
        $userModel->updateUserWithActivationCode(
            $user->id, $activationToken, $activationCodeExpiry
        );

        // @todo Use named route for this
        $activationUrl = '/g/auth/resetpassword/c/' . $activationCode . '/e/' . md5($email) . '/';
        $messageFormat = Garp_Auth::getInstance()->getForgotPasswordMessageFormat();
        $message = Garp_Auth::getInstance()->getForgotPasswordEmailMessage($user, $activationUrl);

        $messageParam = $messageFormat === 'html' ? 'htmlMessage' : 'message';
        $mailer = new Garp_Mailer();
        $mailer->send(
            array(
            'to' => $email,
            $messageParam => $message,
            'subject' => __($authVars['email_subject'])
            )
        );
        if (isset($authVars['route'])) {
            $this->_helper->redirector->gotoRoute(array('success' => 1), $authVars['route']);
        } elseif (isset($authVars['url'])) {
            $targetUrl = $authVars['url'];
            $this->_helper->redirector->gotoUrl($targetUrl . '?success=1');
        }
    }
642430
def change_password(*_, user_id=None, password=None):
    
    click.echo(green('\nChange password:'))
    click.echo(green('-' * 40))

    with get_app().app_context():
        user = find_user(dict(id=user_id))
        if not user:
            click.echo(red('User not found\n'))
            return

        result = user_service.change_password(user, password)
        if isinstance(result, User):
            msg = 'Changed password for user {} \n'.format(user.email)
            click.echo(green(msg))
            return

        print_validation_errors(result)
        return