diff options
author | Evan Prodromou <evan@controlezvous.ca> | 2008-06-22 11:16:11 -0400 |
---|---|---|
committer | Evan Prodromou <evan@controlezvous.ca> | 2008-06-22 11:16:11 -0400 |
commit | acf562b3ddaa6fbe1727fe301a50f1e9b5f26fd2 (patch) | |
tree | 5668c69d79bc4ac52685cef0189a4d08f443b4b7 /actions | |
parent | 2b258b1a9ad9049c19f264187372553fe9b1c09d (diff) |
use updateKeys() for updating the user
darcs-hash:20080622151611-34904-1d952df08b5247ab391bb76fd50d7b90498f0c96.gz
Diffstat (limited to 'actions')
-rw-r--r-- | actions/confirmemail.php | 5 | ||||
-rw-r--r-- | actions/profilesettings.php | 26 |
2 files changed, 19 insertions, 12 deletions
diff --git a/actions/confirmemail.php b/actions/confirmemail.php index e69cc6fff..72b42c2a7 100644 --- a/actions/confirmemail.php +++ b/actions/confirmemail.php @@ -51,11 +51,13 @@ class ConfirmemailAction extends Action { $cur->query('BEGIN'); $orig_user = clone($cur); + $cur->email = $confirm_email->email; - $result = $cur->update($orig_user); + $result = $cur->updateKeys($orig_user); if (!$result) { common_log_db_error($cur, 'UPDATE', __FILE__); + $this->server_error(_t('Couldn\'t update user.')); return; } @@ -63,6 +65,7 @@ class ConfirmemailAction extends Action { if (!$result) { common_log_db_error($confirm_email, 'DELETE', __FILE__); + $this->server_error(_t('Couldn\'t delete email confirmation.')); return; } diff --git a/actions/profilesettings.php b/actions/profilesettings.php index 1b7c75d47..bca86a85f 100644 --- a/actions/profilesettings.php +++ b/actions/profilesettings.php @@ -113,20 +113,23 @@ class ProfilesettingsAction extends SettingsAction { assert(!is_null($user)); # should already be checked $user->query('BEGIN'); - - $original = clone($user); - - $user->nickname = $nickname; - $result = $user->update($original); - - if (!$result) { - common_log_db_error($user, 'UPDATE', __FILE__); - common_server_error(_t('Couldnt update user.')); - return; + if ($user->nickname != $nickname) { + + $original = clone($user); + + $user->nickname = $nickname; + + $result = $user->updateKeys($original); + + if (!$result) { + common_log_db_error($user, 'UPDATE', __FILE__); + common_server_error(_t('Couldnt update user.')); + return; + } } - if ($email != $original->email) { + if ($email != $user->email) { $confirm = new Confirm_email(); $confirm->code = common_good_rand(16); @@ -134,6 +137,7 @@ class ProfilesettingsAction extends SettingsAction { $confirm->email = $email; $result = $confirm->insert(); + if (!$result) { common_log_db_error($confirm, 'INSERT', __FILE__); common_server_error(_t('Couldnt confirm email.')); |