16 import(
'lib.pkp.classes.form.Form');
24 parent::__construct(
'user/loginChangePassword.tpl');
28 $this->
addCheck(
new FormValidatorCustom($this,
'oldPassword',
'required',
'user.profile.form.oldPasswordInvalid',
function($password) use ($form) {
31 $this->
addCheck(
new FormValidatorLength($this,
'password',
'required',
'user.register.form.passwordLengthRestriction',
'>=', $site->getMinPasswordLength()));
32 $this->
addCheck(
new FormValidator($this,
'password',
'required',
'user.profile.form.newPasswordRequired'));
33 $this->
addCheck(
new FormValidatorCustom($this,
'password',
'required',
'user.register.form.passwordsDoNotMatch',
function($password) use ($form) {
34 return $password == $form->getData(
'password2');
43 function display($request =
null, $template =
null) {
45 $site = $request->getSite();
46 $templateMgr->assign(
'minPasswordLength', $site->getMinPasswordLength());
47 parent::display($request, $template);
54 $this->
readUserVars(array(
'username',
'oldPassword',
'password',
'password2'));
63 $user = $userDao->getByUsername($this->
getData(
'username'),
false);
64 parent::execute(...$functionArgs);
66 if ($user->getAuthId()) {
68 $auth = $authDao->getPlugin($user->getAuthId());
72 $auth->doSetUserPassword($user->getUsername(), $this->getData(
'password'));
78 $user->setMustChangePassword(0);
79 $userDao->updateObject($user);