17 import(
'lib.pkp.classes.form.Form');
31 parent::__construct(
'user/changePassword.tpl');
37 $this->
addCheck(
new FormValidatorCustom($this,
'oldPassword',
'required',
'user.profile.form.oldPasswordInvalid',
function($password) use ($user) {
40 $this->
addCheck(
new FormValidatorLength($this,
'password',
'required',
'user.register.form.passwordLengthRestriction',
'>=', $site->getMinPasswordLength()));
41 $this->
addCheck(
new FormValidator($this,
'password',
'required',
'user.profile.form.newPasswordRequired'));
43 $this->
addCheck(
new FormValidatorCustom($this,
'password',
'required',
'user.register.form.passwordsDoNotMatch',
function($password) use ($form) {
44 return $password == $form->getData(
'password2');
46 $this->
addCheck(
new FormValidatorCustom($this,
'password',
'required',
'user.profile.form.passwordSameAsOld',
function($password) use ($form) {
47 return $password != $form->getData(
'oldPassword');
71 function fetch($request, $template =
null, $display =
false) {
73 $templateMgr->assign(array(
74 'minPasswordLength' => $this->
getSite()->getMinPasswordLength(),
75 'username' => $this->
getUser()->getUsername(),
77 return parent::fetch($request, $template, $display);
84 $this->
readUserVars(array(
'oldPassword',
'password',
'password2'));
90 function execute(...$functionArgs) {
93 if ($user->getAuthId()) {
95 $auth = $authDao->getPlugin($user->getAuthId());
99 $auth->doSetUserPassword($user->getUsername(), $this->getData(
'password'));
105 parent::execute(...$functionArgs);
108 $userDao->updateObject($user);