summaryrefslogtreecommitdiff
path: root/inc
diff options
context:
space:
mode:
authorAndreas Gohr <andi@splitbrain.org>2015-05-07 09:42:30 +0200
committerAndreas Gohr <andi@splitbrain.org>2015-05-07 09:42:30 +0200
commitaf865bf3762dff1ddfeb3bd15be46b605499a58b (patch)
treed5635fb24073ca01b733a66f29ae8f836ce51d1f /inc
parent15e0e2356bfd266851932e1cde1287da7c5e201a (diff)
parente6c4392f11bb5a668be8e874560af910b71d72f8 (diff)
downloadrpg-af865bf3762dff1ddfeb3bd15be46b605499a58b.tar.gz
rpg-af865bf3762dff1ddfeb3bd15be46b605499a58b.tar.bz2
Merge pull request #1134 from ptbrown/auth-error-reporting
Refactor error messages from auth plugins.
Diffstat (limited to 'inc')
-rw-r--r--inc/auth.php25
-rw-r--r--inc/lang/en/lang.php2
2 files changed, 15 insertions, 12 deletions
diff --git a/inc/auth.php b/inc/auth.php
index 17923ba2a..60b8c7c78 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(!$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;
}
diff --git a/inc/lang/en/lang.php b/inc/lang/en/lang.php
index 3f11a1ee4..2bbf61000 100644
--- a/inc/lang/en/lang.php
+++ b/inc/lang/en/lang.php
@@ -75,6 +75,7 @@ $lang['regmissing'] = 'Sorry, you must fill in all fields.';
$lang['reguexists'] = 'Sorry, a user with this login already exists.';
$lang['regsuccess'] = 'The user has been created and the password was sent by email.';
$lang['regsuccess2'] = 'The user has been created.';
+$lang['regfail'] = 'The user could not be created.';
$lang['regmailfail'] = 'Looks like there was an error on sending the password mail. Please contact the admin!';
$lang['regbadmail'] = 'The given email address looks invalid - if you think this is an error, contact the admin';
$lang['regbadpass'] = 'The two given passwords are not identical, please try again.';
@@ -90,6 +91,7 @@ $lang['profdeleteuser'] = 'Delete Account';
$lang['profdeleted'] = 'Your user account has been deleted from this wiki';
$lang['profconfdelete'] = 'I wish to remove my account from this wiki. <br/> This action can not be undone.';
$lang['profconfdeletemissing'] = 'Confirmation check box not ticked';
+$lang['proffail'] = 'User profile was not updated.';
$lang['pwdforget'] = 'Forgotten your password? Get a new one';
$lang['resendna'] = 'This wiki does not support password resending.';