forked from GNUsocial/gnu-social
Added a CheckPassword event
This commit is contained in:
parent
384a50a780
commit
a82df5fae8
@ -474,3 +474,8 @@ StartPublicXRDS: Start XRDS output (right after the opening XRDS tag)
|
|||||||
EndPublicXRDS: End XRDS output (right before the closing XRDS tag)
|
EndPublicXRDS: End XRDS output (right before the closing XRDS tag)
|
||||||
- $action: the current action
|
- $action: the current action
|
||||||
- &$xrdsoutputter - XRDSOutputter object to write to
|
- &$xrdsoutputter - XRDSOutputter object to write to
|
||||||
|
|
||||||
|
CheckPassword: Check a username/password
|
||||||
|
- $nickname: The nickname to check
|
||||||
|
- $password: The password to check
|
||||||
|
- &$authenticated: set to true to indicate authentication succeeded.
|
||||||
|
@ -127,8 +127,17 @@ function common_check_user($nickname, $password)
|
|||||||
if (is_null($user) || $user === false) {
|
if (is_null($user) || $user === false) {
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
|
$authenticated = false;
|
||||||
|
Event::handle('CheckPassword', array($nickname, $password, &$authenticated));
|
||||||
|
if(! $authenticated){
|
||||||
|
//no handler asserted the user, so check ourselves
|
||||||
if (0 == strcmp(common_munge_password($password, $user->id),
|
if (0 == strcmp(common_munge_password($password, $user->id),
|
||||||
$user->password)) {
|
$user->password)) {
|
||||||
|
//internal checking passed
|
||||||
|
$authenticated = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if($authenticated){
|
||||||
return $user;
|
return $user;
|
||||||
} else {
|
} else {
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
Reference in New Issue
Block a user