forked from GNUsocial/gnu-social
PasswordsettingsAction aligned with FormAction
Also made some changes in the password "munging" function call common_munge_password to accept a profile instead of user ID (which was only there because stoneage StatusNet used the ID to generate a not-very-random salt, but nowadays we primarily use AuthCrypt plugin).
This commit is contained in:
@@ -110,17 +110,17 @@ class AuthCryptPlugin extends AuthenticationPlugin
|
||||
* EVENTS
|
||||
*/
|
||||
|
||||
public function onStartChangePassword($user, $oldpassword, $newpassword)
|
||||
public function onStartChangePassword(Profile $target, $oldpassword, $newpassword)
|
||||
{
|
||||
if (!$this->checkPassword($user->nickname, $oldpassword)) {
|
||||
if (!$this->checkPassword($target->getNickname(), $oldpassword)) {
|
||||
// if we ARE in overwrite mode, test password with common_check_user
|
||||
if (!$this->overwrite || !common_check_user($user->nickname, $oldpassword)) {
|
||||
if (!$this->overwrite || !common_check_user($target->getNickname(), $oldpassword)) {
|
||||
// either we're not in overwrite mode, or the password was incorrect
|
||||
return !$this->authoritative;
|
||||
}
|
||||
// oldpassword was apparently ok
|
||||
}
|
||||
$changed = $this->changePassword($user->nickname, $oldpassword, $newpassword);
|
||||
$changed = $this->changePassword($target->getNickname(), $oldpassword, $newpassword);
|
||||
|
||||
return (!$changed && empty($this->authoritative));
|
||||
}
|
||||
|
Reference in New Issue
Block a user