better error handling
darcs-hash:20080618071207-84dde-a7903c5a806e16a39101244ef721204a7ce2bd46.gz
This commit is contained in:
parent
7a17d1c477
commit
ec68ae3cb1
@ -64,10 +64,17 @@ class FinishaddopenidAction extends Action {
|
|||||||
$this->message(_t('This OpenID is already associated with user "') . $user->nickname . _t('"'));
|
$this->message(_t('This OpenID is already associated with user "') . $user->nickname . _t('"'));
|
||||||
} else {
|
} else {
|
||||||
$user = common_current_user();
|
$user = common_current_user();
|
||||||
$this->connect_user($user, $display, $canonical);
|
if (!$this->connect_user($user, $display, $canonical)) {
|
||||||
if ($sreg) {
|
$this->message(_t('Error connecting user'));
|
||||||
$this->update_user($user, $sreg);
|
return;
|
||||||
}
|
}
|
||||||
|
if ($sreg) {
|
||||||
|
if (!$this->update_user($user, $sreg)) {
|
||||||
|
$this->message(_t('Error updating profile'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
# success!
|
||||||
common_redirect(common_local_url('openidsettings'));
|
common_redirect(common_local_url('openidsettings'));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -113,7 +120,7 @@ class FinishaddopenidAction extends Action {
|
|||||||
|
|
||||||
if (!$profile->update($orig_profile)) {
|
if (!$profile->update($orig_profile)) {
|
||||||
common_server_error(_t('Error saving the profile.'));
|
common_server_error(_t('Error saving the profile.'));
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
$orig_user = clone($user);
|
$orig_user = clone($user);
|
||||||
@ -124,8 +131,10 @@ class FinishaddopenidAction extends Action {
|
|||||||
|
|
||||||
if (!$user->update($orig_user)) {
|
if (!$user->update($orig_user)) {
|
||||||
common_server_error(_t('Error saving the user.'));
|
common_server_error(_t('Error saving the user.'));
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function connect_user($user, $display, $canonical) {
|
function connect_user($user, $display, $canonical) {
|
||||||
@ -137,8 +146,7 @@ class FinishaddopenidAction extends Action {
|
|||||||
$oid->created = DB_DataObject_Cast::dateTime();
|
$oid->created = DB_DataObject_Cast::dateTime();
|
||||||
|
|
||||||
if (!$oid->insert()) {
|
if (!$oid->insert()) {
|
||||||
common_server_error(_t('Error connecting OpenID.'));
|
return false;
|
||||||
return;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user