Change password.
@return boolean Whether the password changed.
218
public function changePassword()
    {
        if ($this->validate()) {
            if (!($user = $this->getUser())) {
                return false;
            }
            if (!$user->applyForNewPassword()) {
                return false;
            }
            return $user->resetPassword($this->new_password, $user->getPasswordResetToken());
        }
        return false;
    }
401812
public function changeClientPassword($client, $password)
    {
        return $this->api->changeClientPassword($this->getClientId($client), $password);
    }
170247
public function postChangePassword()
    {
        $user = Sentinel::getUser();

        $validation = array(
            'password'         => 'required|between:3,32',
            'password_confirm' => 'required|same:password',
        );

        // Create a new validator instance from our validation rules
        $validator = Validator::make(Input::all(), $validation);

        // If validation fails, we'll exit the operation now.
        if ($validator->fails()) {
            // Ooops.. something went wrong
            return Redirect::back()->withInput()->withErrors($validator);
        }

        try {
            // Do we want to update the user password?
            $password = Input::get('password');

            if (Sentinel::validateCredentials($user, [ 'email' => $user->email, 'password' => Input::get('old-password')]))
            {
                $user->password = Hash::make($password);
                $redirect = 'change-password';

                if ($user->force_new_password)
                {
                    $user->force_new_password = 0;
                    $redirect = 'home';
                }

                // Was the user updated?
                if ($user->save())
                {
                    // Prepare the success message
                    $success = Lang::get('base.auth.account.changed');

                    Mail::queue('emails.account.password-changed', [ 'user' => $user ], function ($m) use ($user) {
                        $m->to($user->email, $user->first_name . ' ' . $user->last_name);
                        $m->subject(Lang::get('base.mails.password_changed'));
                    });

                    Base::Log($user->username . ' (' . $user->first_name . ' ' . $user->last_name . ') changed its password account. ');

                    // Redirect to the user page
                    return Redirect::route($redirect)->with('success', $success);
                }
            }
            else
            {
                $error = Lang::get('base.auth.wrong_password');
                $validator->messages()->add('old-password', Lang::get('base.auth.wrong_password'));

                // Redirect to the user page
                return Redirect::route('change-password')->withInput()->withErrors($validator)->with('error', $error);
            }

            // Prepare the error message
        } catch (Exception $e) {
        }
        $error = Lang::get('base.base.error');


        // Redirect to the user page
        return Redirect::route('change-password')->withInput()->with('error', $error);
    }
80538
public function resetPassword()
    {
        if ($this->hasErrors()) {
            return false;
        }
        $identity = $this->getIdentity();
        $trx = $identity->db->transaction !== null ? null : $identity->db->beginTransaction();
        if (!$identity || !$identity->resetPassword($this->newPassword)) {
            $this->addError('newPassword', Yii::t('usr', 'Failed to reset the password.'));
            if ($trx !== null) {
                $trx->rollback();
            }

            return false;
        }
        if ($trx !== null) {
            $trx->commit();
        }

        return true;
    }
351288
public function setPassword($password)
    {
        $password = (string) $password;

        if ($this->exists() && $this->password !== $password) {
            $this->updated['password'] = true;
        }

        $this->password = $password;

        return $this;
    }
132592
final protected function _canChangePassword() {
         //validate that required indices exist
        if (!isset($this->_userProfile['username'])
            || !isset($this->_userProfile['password'])
            || !isset($this->_userProfile['fullname'])
            || !isset($this->_userProfile['passhist'])
        ) {
            throw new UserCredentialException('The username and password are not set', 1016);
        }
  
        //Verify if the password was changed today or server has been futuredated
        $currDateTimeObj = new \DateTime();
        
        //Password was changed today or in the future
        if ($currDateTimeObj <= $this->_userProfile['policyinfo']['password_last_changed_datetime']) {
            return false;
        } else {
            return true;
        }
    }
923910
public function resendPassword()
    {
        $this->password = Password::generate(8);
        $this->save(false, ['password_hash']);

        return $this->mailer->sendGeneratedPassword($this, $this->password);
    }
886850
public function changeEmailAction()
    {
        if(!$user = $this->identity()) {
            return $this->redirect()->toRoute($this->getOptions()->getLoginRedirectRoute());
        }

        $form = $this->getUserFormHelper()->createUserForm($user, 'ChangeEmail');
        $message = null;        
        if($this->getRequest()->isPost()) {
            $currentPassword = $user->getPassword();
            $form->setValidationGroup('password', 'newEmail', 'newEmailVerify', 'csrf');
            $form->setData($this->getRequest()->getPost());
            if($form->isValid()) {
                $data = $form->getData();
                $user->setPassword($currentPassword);
                if(UserCredentialsService::verifyHashedPassword($user, $this->params()->fromPost('password'))) {
                    $newMail = $this->params()->fromPost('newEmail');
                    $email = $user->setEmail($newMail);
                    $entityManager = $this->getEntityManager();
                    $entityManager->persist($user);
                    $entityManager->flush();
                    
                    $viewModel = new ViewModel(array(
                        'email' => $newMail,
                        'navMenu' => $this->getOptions()->getNavMenu()
                    ));
                    $viewModel->setTemplate('csn-user/registration/change-email-success');
                    return $viewModel;
                } else {
                    $message = $this->getTranslatorHelper()->translate('Your current password is not correct.');
                }
            }
        }

        return new ViewModel(array('form' => $form, 'navMenu' => $this->getOptions()->getNavMenu(), 'message' => $message));
    }
677981
def change_password(self, usrname, oldpwd, newpwd, callback=None):
        '''
        
        '''
        params = {'usrName': usrname,
                  'oldPwd' : oldpwd,
                  'newPwd' : newpwd,
                 }
        return self.execute_command('changePassword',
                                    params, callback=callback)
342959
public function actionChangePassword()
    {
        $model = new UserChangePassword();
        $model->setUser(Yii::$app->adminuser->identity);
        $model->attributes = Yii::$app->request->bodyParams;
        
        if ($this->module->strongPasswordPolicy) {
            $model->validators->append(StrengthValidator::createValidator(StrengthValidator::class, $model, ['newpass']));
        }
        
        if ($model->validate()) {
            $model->checkAndStore();
        }
        
        return $model;
    }
1157143
public function password()
    {
        $this->setData('formTitle', __("Change password"));
        if ($this->getServiceLocator()->get(ApplicationService::SERVICE_ID)->isDemo()) {
            $this->setData('myForm', __('Unable to change passwords in demo mode'));
        } else {
            $myFormContainer = new tao_actions_form_UserPassword();
            $myForm = $myFormContainer->getForm();
            if($myForm->isSubmited()){
                if($myForm->isValid()){
                    $user = $this->getUserService()->getCurrentUser();
                    $this->getServiceLocator()->get(tao_models_classes_UserService::SERVICE_ID)
                        ->setPassword($user, $myForm->getValue('newpassword'));
                    $this->setData('message', __('Password changed'));
                }
            }
            $this->setData('myForm', $myForm->render());
        }

        $this->setView('form/settings_user.tpl');
    }
873953
public function resetPassword()
    {
        $user = $this->_user;
        $user->new_password = $this->password;
        $user->removePasswordResetToken();

        return $user->save(false);
    }
373148
public function updatePassword($username, $password)
    {
        /** @var UserInterface|EloquentUser $user */
        if ( ! ($user = $this->sentinel->findByCredentials(['email' => $username]))) {
            return false;
        }

        return $this->sentinel->update($user, ['password' => $password]) instanceof UserInterface;
    }
525244
public function changePassword($options = []) {
		$options = Hash::merge($this->getConfig('changePassword'), $options);

		$entity = $this->UserTable->newEntity();
		$entity->accessible([
			'old_password',
			'password',
			'new_password',
			'confirm_password'
		], true);

		if ($this->_getRequest()->is(['post', 'put'])) {
			$entity = $this->UserTable->get($this->_getAuthObject()->user('id'));
			$entity = $this->UserTable->patchEntity($entity, $this->_getRequest()->data, [
				'validate' => 'changePassword'
			]);

			if ($this->UserTable->changePassword($entity)) {
				$this->_getRequest()->data = [];
				$entity = $this->UserTable->newEntity();
				$this->handleFlashAndRedirect('success', $options);
			} else {
				$this->handleFlashAndRedirect('error', $options);
			}
		}

		$this->_setViewVar('entity', $entity);
	}
1373261
def change_password(request):
    '''
    
    '''
    serializer = ChangePasswordSerializer(data=request.data,
                                          context={'request': request})
    serializer.is_valid(raise_exception=True)

    user = request.user
    user.set_password(serializer.validated_data['password'])
    user.save()
    return get_ok_response('Password changed successfully')
751905
public function changePassword($password)
    {
        $this->password = $password;

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

        return $this;
    }
167817
public function actionChangePassword()
    {
        $username = $this->prompt('Username:', ['required' => true]);
        $user = $this->findModel($username);
        $user->setPassword($this->prompt('New password:', [
            'required' => true,
            'pattern' => '#^.{6,255}$#i',
            'error' => 'More than 6 symbols',
        ]));
        $this->log($this->repository->save($user));
    }