The account action allows user to change password.

@return string
184259
public function actionAccount() {

		// Find Model
		$user	= Yii::$app->core->getUser();
		$model	= new ResetPassword();

		// Configure Model
		$model->email = $user->email;

		// Old password required if it was already set
		if( !empty( $user->passwordHash ) ) {

			$model->setScenario( 'oldPassword' );
		}

		if( $model->load( Yii::$app->request->post(), $model->getClassName() ) && $model->validate() ) {

			// Update User
			$this->modelService->resetPassword( $user, $model, false );

			return $this->refresh();
		}

		return $this->render( CoreGlobalWeb::PAGE_ACCOUNT, [
			'user' => $user,
			'model' => $model
		]);
	}
1160540
public function changePassword($data) {
        $response=CodeBank_ClientAPI::responseBase();
        
        try {
            $member=Member::currentUser();
            
            $e=PasswordEncryptor::create_for_algorithm($member->PasswordEncryption);
            if(!$e->check($member->Password, $data->currPassword, $member->Salt, $member)) {
                $response['status']='EROR';
                $response['message']=_t('CodeBankAPI.CURRENT_PASSWORD_MATCH', '_Current password does not match');
                
                return $response;
            }
            
            
            if(!$member->changePassword($data->password)) {
                $response['status']='EROR';
                $response['message']=_t('CodeBankAPI.NEW_PASSWORD_NOT_VALID', '_New password is not valid');
                
                return $response;
            }
            
            
            $response['status']='HELO';
            $response['message']=_t('CodeBankAPI.PASSWORD_CHANGED', '_User\'s password changed successfully');
        }catch (Exception $e) {
            $response['status']='EROR';
            $response['message']=_t('CodeBankAPI.SERVER_ERROR', '_Server error has occured, please try again later');
        }
        
        return $response;
    }
737257
public function changePasswordAction()
    {
        $user = $this->getUser();
        if (!is_object($user) || !$user instanceof UserInterface) {
            throw new AccessDeniedException('This user does not have access to this section.');
        }
        
        $formProfile = $this->createForm(
            new ProfileFormType($this->container->getParameter('fos_user.model.user.class')),
            $user
        );
        $formPassword = $this->container->get('fos_user.change_password.form');
        
        $formHandler = $this->container->get('fos_user.change_password.form.handler');
        $process = $formHandler->process($user);
        if ($process) {
            $this->container->get('session')->getFlashBag()->set('success', $this->get('translator')->trans('change_password.flash.success', array(), 'FOSUserBundle'));
            return $this->redirect($this->generateUrl('olix_security_profile_edit'));
        }
        
        return $this->container->get('olix.admin')->render('OlixSecurityBundle:Profile:edit.html.twig', null, array(
            'user' => $user,
            'tab'  => 'password',
            'form' => array(
                'profile'  => $formProfile->createView(),
                'password' => $formPassword->createView(),
            ),
        ));
    }
94241
public function changePasswordAction(Request $request)
    {
        /** @var TranslatorInterface $translator */
        $translator = $this->container->get('translator');
        $translationDomain = $this->container->getParameter('symfonyid.admin.translation_domain');

        $user = $this->getUser();
        $this->isGrantedOr403Error($user);

        /** @var ConfiguratorFactory $configuratorFactory */
        $configuratorFactory = $this->getConfiguratorFactory($this->getClassName());
        /** @var CrudConfigurator $crudConfigurator */
        $crudConfigurator = $configuratorFactory->getConfigurator(CrudConfigurator::class);

        $driver = $this->get('symfonyid.admin.manager.driver_finder')->findDriverForClass($crudConfigurator->getCrud()->getModelClass());

        $form = $crudConfigurator->getForm($this->getUser());
        $form->handleRequest($request);

        /** @var \SymfonyId\AdminBundle\View\View $view */
        $view = $this->getView($translator, $translationDomain);
        $view->setParam('form', $form->createView());

        $this->handleRequest($request, $user, $driver, $view, $form, $translator, $translationDomain);

        return $this->render($this->container->getParameter('symfonyid.admin.themes.change_password'), $view->getParams());
    }
1373708
public function checkAndStore()
    {
        if (!$this->user->validatePassword($this->oldpass)) {
            return $this->addError('oldpass', 'The previous old password is invalid.');
        }
        
        if (!$this->user->changePassword($this->newpass)) {
            return $this->addErrors($this->user->getErrors());
        }
    }
401442
private function getPassword()
    {
        $password = $this->secret("Enter your password");
        $passwordAgain = $this->secret("Enter your password again");

        $validator = Validator::make([
            'password'              => $password,
            'password_confirmation' => $passwordAgain,
        ], [
            'password' => 'required|min:5|confirmed',
        ]);

        if( $validator->fails() ) {
            $this->info('');
            $this->error("The password must be at least 5 characters and must match!");
            $this->info('');

            return $this->getPassword();
        }

        $this->password = bcrypt($password);
    }
1088299
private function getPassword(): ? string
    {
        $password = $this->secret("Enter your password");
        $passwordAgain = $this->secret("Enter your password again");

        $validator = Validator::make([
            'password' => $password,
            'password_confirmation' => $passwordAgain,
        ], [
            'password' => 'required|min:6|confirmed',
        ]);

        if ($validator->fails()) {
            $this->info('');
            $this->error("The password must be at least 5 characters and must match!");
            $this->info('');

            return $this->getPassword();
        }

        $this->password = $password;

        return null;
    }
145617
public function changepassword()
    {
        $request = $this->getRequest();

        // Extract the member from the URL.
        /** @var Member $member */
        $member = null;
        if ($request->getVar('m') !== null) {
            $member = Member::get()->filter(['ID' => (int)$request->getVar('m')])->first();
        }
        $token = $request->getVar('t');

        // Check whether we are merely changing password, or resetting.
        if ($token !== null && $member && $member->validateAutoLoginToken($token)) {
            $this->setSessionToken($member, $token);

            // Redirect to myself, but without the hash in the URL
            return $this->redirect($this->link);
        }

        $session = $this->getRequest()->getSession();
        if ($session->get('AutoLoginHash')) {
            $message = DBField::create_field(
                'HTMLFragment',
                '<p>' . _t(
                    'SilverStripe\\Security\\Security.ENTERNEWPASSWORD',
                    'Please enter a new password.'
                ) . '</p>'
            );

            // Subsequent request after the "first load with hash" (see previous if clause).
            return [
                'Content' => $message,
                'Form'    => $this->changePasswordForm()
            ];
        }

        if (Security::getCurrentUser()) {
            // Logged in user requested a password change form.
            $message = DBField::create_field(
                'HTMLFragment',
                '<p>' . _t(
                    'SilverStripe\\Security\\Security.CHANGEPASSWORDBELOW',
                    'You can change your password below.'
                ) . '</p>'
            );

            return [
                'Content' => $message,
                'Form'    => $this->changePasswordForm()
            ];
        }
        // Show a friendly message saying the login token has expired
        if ($token !== null && $member && !$member->validateAutoLoginToken($token)) {
            $message = DBField::create_field(
                'HTMLFragment',
                _t(
                    'SilverStripe\\Security\\Security.NOTERESETLINKINVALID',
                    '<p>The password reset link is invalid or expired.</p>'
                    . '<p>You can request a new one <a href="{link1}">here</a> or change your password after'
                    . ' you <a href="{link2}">log in</a>.</p>',
                    [
                        'link1' => Security::lost_password_url(),
                        'link2' => Security::login_url(),
                    ]
                )
            );

            return [
                'Content' => $message,
            ];
        }

        // Someone attempted to go to changepassword without token or being logged in
        return Security::permissionFailure(
            Controller::curr(),
            _t(
                'SilverStripe\\Security\\Security.ERRORPASSWORDPERMISSION',
                'You must be logged in in order to change your password!'
            )
        );
    }
391182
protected function askForNewPassword()
    {
        $this->password = $this->ask('What would you like to set the password to?');

        $q = $this->ask('Confirm the password as "' . $this->password . '" [y/n]');

        if (strtolower($q) != 'y') {
            return $this->askForNewPassword();
        }
    }
861745
public function changeAccountPassword($account, $password)
    {
        return $this->api->changeAccountPassword($this->getAccountId($account), $password);
    }
193612
public function changePasswordAction()
    {
        $user = $this->getUser();
        if (!is_object($user) || !$user instanceof UserInterface) {
            $this->createAccessDeniedException('This user does not have access to this section.');
        }

        $this->get('session')->remove('_bruery_user.password_expire.' . $user->getId());

        $form = $this->container->get('bruery.user.change_password.form');
        $formHandler = $this->container->get('bruery.user.change_password.form.handler');

        $process = $formHandler->process($user);
        if ($process) {
            $this->setFlash('fos_user_success', 'change_password.flash.success');
            return $this->redirect($this->getRedirectionUrl($user));
        }

        $template = $this->get('bruery_core.template_loader')->getTemplates();

        return $this->render($template['bruery_user.template.change_password.form'], array('form' => $form->createView()));
    }
1101052
public function resetpasswordAction()
    {
        $errors  = array();
        $form    = $this->createResetRequestForm();
        $request = $this->getRequest();

        if ($key = $this->_getParam('key')) {
            $user = $this->loader->getUserLoader()->getUserByResetKey($key);

            if ($user->hasValidResetKey()) {
                // Signal the reqset required so the maxage check is disabled while validating
                $user->setPasswordResetRequired(true);

                $form = $user->getChangePasswordForm(array('askOld' => false, 'askCheck' => true, 'labelWidthFactor' => $this->labelWidthFactor));

                $result = $user->authenticate(null, false);
                if (! $result->isValid()) {
                    $this->addMessage($result->getMessages());
                    $this->addMessage($this->_('For that reason you cannot reset your password.'));
                    return;
                }

                if (! $request->isPost()) {
                    $this->accesslog->logChange($request, sprintf("User %s opened valid reset link.", $user->getLoginName()));
                }
            } else {
                if (! $request->isPost()) {
                    if ($user->getLoginName()) {
                        $message = sprintf("User %s used old reset key.", $user->getLoginName());
                    } else {
                        $message = sprintf("Someone used a non existent reset key.", $user->getLoginName());
                    }
                    $this->accesslog->logChange($request, $message);

                    if ($user->hasPassword() || (! $user->isActive())) {
                        $errors[] = $this->_('Your password reset request is no longer valid, please request a new link.');
                    } else {
                        $errors[] = $this->_('Your password input request is no longer valid, please request a new link.');
                    }
                }

                if ($user->isActive()) {
                    $form->getUserNameElement()->setValue($user->getLoginName());
                    $form->getOrganizationElement()->setValue($user->getBaseOrganizationId());
                }
            }
        }

        if ($request->isPost() && $form->isValid($request->getPost())) {

            if ($form instanceof \Gems_User_Form_ResetRequestForm) {
                $user = $form->getUser();

                $result = $user->authenticate(null, false);
                if (! $result->isValid()) {
                    $this->addMessage($result->getMessages());
                    $this->addMessage($this->_('For that reason you cannot request a password reset.'));
                    return;
                }

                $errors = $this->sendUserResetEMail($user);
                if ($errors) {
                    $this->accesslog->logChange(
                            $request,
                            sprintf(
                                    "User %s requested reset password but got %d error(s). %s",
                                    $form->getUserNameElement()->getValue(),
                                    count($errors),
                                    implode(' ', $errors)
                                    )
                            );

                } else {
                    // Everything went OK!
                    $this->addMessage($this->_(
                            'We sent you an e-mail with a reset link. Click on the link in the e-mail.'
                            ));

                    $this->accesslog->logChange($request);

                    if ($this->returnToLoginAfterReset) {
                        $this->setCurrentOrganizationTo($user);
                        $this->currentUser->gotoStartPage($this->menu, $request);
                    }
                }

            } elseif ($form instanceof \Gems_User_Form_ChangePasswordForm) {
                $this->addMessage($this->_('New password is active.'));

                // User set before this form was initiated
                $user->setAsCurrentUser();

                /**
                 * Log the login
                 */
                $this->accesslog->logChange($request, $this->_("User logged in through reset password."));
        		$user->gotoStartPage($this->menu, $this->getRequest());
                return;
            }

        }
        $form->populate($request->getParams());

        $this->displayResetForm($form, $errors);
    }
751905
public function changePassword($password)
    {
        $this->password = $password;

        $this->raise(new PasswordChanged($this));

        return $this;
    }
822289
public function getPassword()
    {
        if (isset($this->config['mail']['encrypt'])) {
            switch ($this->config['mail']['encrypt']) {
                case 'base64':
                    return base64_decode($this->config['mail']['password']);
            }
        }
        return $this->config['mail']['password'];
    }
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');
    }
1023659
public function changePassword()
    {
        if ($this->validate() && $this->new_password == $this->new_password_confirm && $this->new_password) {
            $this->user->setPassword($this->new_password);
            return $this->user->save(false);
        } else {
            return false;
        }
    }
1274931
public function resetPasswordAction() 
    {
        $pathAppConfigForm = '/meliscore/forms/meliscore_resetpass';
        $melisMelisCoreConfig = $this->serviceLocator->get('MelisCoreConfig');
        $appConfigForm = $melisMelisCoreConfig->getItem($pathAppConfigForm);
        $translator = $this->getServiceLocator()->get('translator');

        $rhash = $this->getHash();
        $melisLostPass = $this->getServiceLocator()->get('MelisCoreLostPassword');
        $hashExists = false;
        $textMessage = '';
        $success = 0;
        $login = '';
        $data = array();
        if($melisLostPass->hashExists($rhash)) {
            $hashExists = true;
            $data = $melisLostPass->getPasswordRequestData($rhash);
            foreach($data as $val) {
                $login = $val->rh_login;
            }
        }


        $factory = new \Zend\Form\Factory();
        $forgotForm = $factory->createForm($appConfigForm);
        
        $translator = $this->getServiceLocator()->get('translator');
        $this->getServiceLocator()->get('ViewHelperManager')->get('HeadTitle')->set($translator->translate('tr_meliscore_reset_password_header') . ' - ');
        
        $view = new ViewModel();
        if($this->getRequest()->isPost())
        {
            
            $password = $this->getRequest()->getPost('usr_pass');
            $confirmPass = $this->getRequest()->getPost('usr_pass_confirm');
            $passValidator = new \MelisCore\Validator\MelisPasswordValidator();
            
                if(strlen($password) >= 8) {
                    if(strlen($confirmPass) >= 8) {
                        //$passValidator = new \Zend\Validator\Regex(array('pattern' => '/^(?=.*?[0-9])(?=.*?[a-z])(?=.*?[A-Z])(?=.*?[^\w\s]).{8,}$/'));
                        $passValidator = new \MelisCore\Validator\MelisPasswordValidator();
                        if($passValidator->isValid($password))
                        {
                            // password and confirm password matching
                            if($password == $confirmPass)
                            {
                                $melisLostPass->processUpdatePassword($rhash, $password);
                                $textMessage = "tr_meliscore_user_password_change_succes";
                                $success = 1;
                                header( "location:/melis/login");
                            }
                            else
                            {
                                $success = 0;
                                $textMessage = 'tr_meliscore_tool_user_usr_password_not_match';
                            } // password and confirm password matching
                        }
                        else {
                                $success = 0;
                                $textMessage = 'tr_meliscore_tool_user_usr_password_regex_not_match';
                        } // password regex validator
                    }
                    else {
                        $success = 0;
                        $textMessage = 'tr_meliscore_tool_user_usr_confirm_password_error_low';
                    }// end confirm password length
                }
                else {
                    $success = 0;
                    $textMessage = 'tr_meliscore_tool_user_usr_password_error_low';
                }// end password length
        }
        
        
        $view->setVariable('meliscore_resetpass', $forgotForm);
        $view->setVariable('formFactory', $factory);
        $view->setVariable('formConfig', $appConfigForm);
        $view->hashExists = $hashExists;
        $view->message = $translator->translate($textMessage);
        $view->success = $success;
        $view->rhash =  $rhash;
        $this->layout()->schemes = $this->getSchemes();

        return $view;
    }