summaryrefslogtreecommitdiff
path: root/actions
diff options
context:
space:
mode:
authorCraig Andrews <candrews@integralblue.com>2009-11-05 23:27:18 -0500
committerCraig Andrews <candrews@integralblue.com>2009-11-05 23:27:18 -0500
commitd6ddb84132d7b9510ba82064c67f2a39822dab49 (patch)
treed68d132d685a3694340f249ff427e0bee022aba9 /actions
parent1bace8547b0fa3db316ad79e4948869a654b7140 (diff)
Add ChangePassword event
Diffstat (limited to 'actions')
-rw-r--r--actions/passwordsettings.php31
1 files changed, 20 insertions, 11 deletions
diff --git a/actions/passwordsettings.php b/actions/passwordsettings.php
index cd4beac3f..87eb45a7d 100644
--- a/actions/passwordsettings.php
+++ b/actions/passwordsettings.php
@@ -164,23 +164,32 @@ class PasswordsettingsAction extends AccountSettingsAction
$this->showForm(_('Incorrect old password'));
return;
}
+ }else{
+ $oldpassword = null;
}
- $original = clone($user);
+ $errormsg = false;
+ if(! Event::handle('ChangePassword', array($user->nickname, $oldpassword, $newpassword, &$errormsg))){
+ //no handler changed the password, so change the password internally
+ $original = clone($user);
- $user->password = common_munge_password($newpassword, $user->id);
+ $user->password = common_munge_password($newpassword, $user->id);
- $val = $user->validate();
- if ($val !== true) {
- $this->showForm(_('Error saving user; invalid.'));
- return;
- }
+ $val = $user->validate();
+ if ($val !== true) {
+ $this->showForm(_('Error saving user; invalid.'));
+ return;
+ }
- if (!$user->update($original)) {
- $this->serverError(_('Can\'t save new password.'));
- return;
+ if (!$user->update($original)) {
+ $this->serverError(_('Can\'t save new password.'));
+ return;
+ }
}
- $this->showForm(_('Password saved.'), true);
+ if($errormsg === false)
+ $this->showForm(_('Password saved.'), true);
+ else
+ $this->showForm($errormsg);
}
}