summaryrefslogtreecommitdiff
path: root/actions/confirmaddress.php
diff options
context:
space:
mode:
authorEvan Prodromou <evan@controlezvous.ca>2008-06-22 12:16:07 -0400
committerEvan Prodromou <evan@controlezvous.ca>2008-06-22 12:16:07 -0400
commit4fd1f6246ddc272192b293a5e5d5cb9dbd3e1cdf (patch)
tree3bd109be8ace3a4c227a5f90fa7e5b0e7ebd7cd9 /actions/confirmaddress.php
parent403039510c5cc95010dacb773120779da4c43fe8 (diff)
correctly use Confirm_address
darcs-hash:20080622161607-34904-d8e042b80fe6acd3cb6ad763216a0b1817752cac.gz
Diffstat (limited to 'actions/confirmaddress.php')
-rw-r--r--actions/confirmaddress.php40
1 files changed, 25 insertions, 15 deletions
diff --git a/actions/confirmaddress.php b/actions/confirmaddress.php
index 72b42c2a7..76f79da05 100644
--- a/actions/confirmaddress.php
+++ b/actions/confirmaddress.php
@@ -33,27 +33,37 @@ class ConfirmemailAction extends Action {
$this->client_error(_t('No confirmation code.'));
return;
}
- $confirm_email = Confirm_email::staticGet('code', $code);
- if (!$confirm_email) {
+ $confirm = Confirm_address::staticGet('code', $code);
+ if (!$confirm) {
$this->client_error(_t('Confirmation code not found.'));
return;
}
$cur = common_current_user();
- if ($cur->id != $confirm_email->user_id) {
+ if ($cur->id != $confirm->user_id) {
$this->client_error(_t('That confirmation code is not for you!'));
return;
}
- if ($cur->email == $confirm_email->email) {
- $this->client_error(_t('That email address is already confirmed.'));
- return;
- }
+ $type = $confirm->address_type;
+ if (!in_array($type, array('email', 'jabber', 'sms'))) {
+ $this->server_error(_t('Unrecognized address type ') . $type);
+ return;
+ }
+ if ($cur->$type == $confirm->address) {
+ $this->client_error(_t('That address has already been confirmed.'));
+ return;
+ }
$cur->query('BEGIN');
$orig_user = clone($cur);
+
+ $cur->$type = $confirm->address;
+
+ if ($type == 'sms') {
+ $cur->carrier = ($confirm->address_extra)+0;
+ }
- $cur->email = $confirm_email->email;
- $result = $cur->updateKeys($orig_user);
+ $result = $cur->updateKeys($orig_user);
if (!$result) {
common_log_db_error($cur, 'UPDATE', __FILE__);
@@ -61,20 +71,20 @@ class ConfirmemailAction extends Action {
return;
}
- $result = $confirm_email->delete();
+ $result = $confirm->delete();
if (!$result) {
- common_log_db_error($confirm_email, 'DELETE', __FILE__);
+ common_log_db_error($confirm, 'DELETE', __FILE__);
$this->server_error(_t('Couldn\'t delete email confirmation.'));
return;
}
$cur->query('COMMIT');
-
- common_show_header(_t('Confirm E-mail Address'));
+
+ common_show_header(_t('Confirm Address'));
common_element('p', NULL,
- _t('The email address "') . $cur->email .
+ _t('The address "') . $cur->email .
_t('" has been confirmed for your account.'));
- common_show_footer(_t('Confirm E-mail Address'));
+ common_show_footer();
}
}