From db9faf025cf129d15a086a803e8056e977975d76 Mon Sep 17 00:00:00 2001 From: Patrick Brown Date: Wed, 6 May 2015 01:30:59 -0400 Subject: Report more meaningful errors when an auth backend fails. closes #1093 --- inc/auth.php | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) (limited to 'inc/auth.php') diff --git a/inc/auth.php b/inc/auth.php index 17923ba2a..dd0fc35b3 100644 --- a/inc/auth.php +++ b/inc/auth.php @@ -1006,7 +1006,7 @@ function register() { //okay try to create the user if(!$auth->triggerUserMod('create', array($login, $pass, $fullname, $email))) { - msg($lang['reguexists'], -1); + msg($lang['regfail'], -1); return false; } @@ -1098,17 +1098,18 @@ function updateprofile() { } } - if($result = $auth->triggerUserMod('modify', array($INPUT->server->str('REMOTE_USER'), &$changes))) { - // update cookie and session with the changed data - if($changes['pass']) { - list( /*user*/, $sticky, /*pass*/) = auth_getCookie(); - $pass = auth_encrypt($changes['pass'], auth_cookiesalt(!$sticky, true)); - auth_setCookie($INPUT->server->str('REMOTE_USER'), $pass, (bool) $sticky); - } - return true; + if(!($result = $auth->triggerUserMod('modify', array($INPUT->server->str('REMOTE_USER'), &$changes)))) { + msg($lang['proffail'], -1); + return false; } - return false; + // update cookie and session with the changed data + if($changes['pass']) { + list( /*user*/, $sticky, /*pass*/) = auth_getCookie(); + $pass = auth_encrypt($changes['pass'], auth_cookiesalt(!$sticky, true)); + auth_setCookie($INPUT->server->str('REMOTE_USER'), $pass, (bool) $sticky); + } + return true; } /** @@ -1221,7 +1222,7 @@ function act_resendpwd() { // change it if(!$auth->triggerUserMod('modify', array($user, array('pass' => $pass)))) { - msg('error modifying user data', -1); + msg($lang['proffail'], -1); return false; } @@ -1229,7 +1230,7 @@ function act_resendpwd() { $pass = auth_pwgen($user); if(!$auth->triggerUserMod('modify', array($user, array('pass' => $pass)))) { - msg('error modifying user data', -1); + msg($lang['proffail'], -1); return false; } -- cgit v1.2.3 From e6c4392f11bb5a668be8e874560af910b71d72f8 Mon Sep 17 00:00:00 2001 From: Patrick Brown Date: Thu, 7 May 2015 01:43:32 -0400 Subject: Fix scrutinizer issues with auth --- inc/auth.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'inc/auth.php') diff --git a/inc/auth.php b/inc/auth.php index dd0fc35b3..60b8c7c78 100644 --- a/inc/auth.php +++ b/inc/auth.php @@ -1098,7 +1098,7 @@ function updateprofile() { } } - if(!($result = $auth->triggerUserMod('modify', array($INPUT->server->str('REMOTE_USER'), &$changes)))) { + if(!$auth->triggerUserMod('modify', array($INPUT->server->str('REMOTE_USER'), &$changes))) { msg($lang['proffail'], -1); return false; } -- cgit v1.2.3