shorter confirmation message and web iface to confirm
darcs-hash:20080721011128-84dde-0b3af6237c2c07bf7f573d9e609c19e6538c2859.gz
This commit is contained in:
parent
27d5118b6d
commit
485331f99d
|
@ -59,6 +59,9 @@ class SmssettingsAction extends EmailsettingsAction {
|
||||||
common_hidden('carrier', $user->carrier);
|
common_hidden('carrier', $user->carrier);
|
||||||
common_element_end('p');
|
common_element_end('p');
|
||||||
common_submit('cancel', _('Cancel'));
|
common_submit('cancel', _('Cancel'));
|
||||||
|
common_input('code', _('Confirmation code'), NULL,
|
||||||
|
_('Enter the code you received on your phone.'));
|
||||||
|
common_submit('confirm', _('Confirm'));
|
||||||
} else {
|
} else {
|
||||||
common_input('sms', _('SMS Phone number'),
|
common_input('sms', _('SMS Phone number'),
|
||||||
($this->arg('sms')) ? $this->arg('sms') : NULL,
|
($this->arg('sms')) ? $this->arg('sms') : NULL,
|
||||||
|
@ -125,6 +128,8 @@ class SmssettingsAction extends EmailsettingsAction {
|
||||||
$this->remove_incoming();
|
$this->remove_incoming();
|
||||||
} else if ($this->arg('newincoming')) {
|
} else if ($this->arg('newincoming')) {
|
||||||
$this->new_incoming();
|
$this->new_incoming();
|
||||||
|
} else if ($this->arg('confirm')) {
|
||||||
|
$this->confirm_code();
|
||||||
} else {
|
} else {
|
||||||
$this->show_form(_('Unexpected form submission.'));
|
$this->show_form(_('Unexpected form submission.'));
|
||||||
}
|
}
|
||||||
|
@ -191,7 +196,7 @@ class SmssettingsAction extends EmailsettingsAction {
|
||||||
$confirm->address_extra = $carrier_id;
|
$confirm->address_extra = $carrier_id;
|
||||||
$confirm->address_type = 'sms';
|
$confirm->address_type = 'sms';
|
||||||
$confirm->user_id = $user->id;
|
$confirm->user_id = $user->id;
|
||||||
$confirm->code = common_confirmation_code(64);
|
$confirm->code = common_confirmation_code(40);
|
||||||
|
|
||||||
$result = $confirm->insert();
|
$result = $confirm->insert();
|
||||||
|
|
||||||
|
@ -203,7 +208,7 @@ class SmssettingsAction extends EmailsettingsAction {
|
||||||
|
|
||||||
$carrier = Sms_carrier::staticGet($carrier_id);
|
$carrier = Sms_carrier::staticGet($carrier_id);
|
||||||
|
|
||||||
mail_confirm_address($confirm->code,
|
mail_confirm_sms($confirm->code,
|
||||||
$user->nickname,
|
$user->nickname,
|
||||||
$carrier->toEmailAddress($sms));
|
$carrier->toEmailAddress($sms));
|
||||||
|
|
||||||
|
@ -300,4 +305,17 @@ class SmssettingsAction extends EmailsettingsAction {
|
||||||
'send email to let us know at %s.'),
|
'send email to let us know at %s.'),
|
||||||
common_config('site', 'email')));
|
common_config('site', 'email')));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function confirm_code() {
|
||||||
|
|
||||||
|
$code = $this->trimmed('code');
|
||||||
|
|
||||||
|
if (!$code) {
|
||||||
|
$this->show_form(_('No code entered'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
common_redirect(common_local_url('confirmaddress',
|
||||||
|
array('code' => $this->code)));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
16
lib/mail.php
16
lib/mail.php
|
@ -189,3 +189,19 @@ function mail_send_notice($notice, $user) {
|
||||||
$body = $notice->content;
|
$body = $notice->content;
|
||||||
mail_send($sms_email, $headers, $body);
|
mail_send($sms_email, $headers, $body);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function mail_confirm_sms($code, $nickname, $address) {
|
||||||
|
|
||||||
|
$recipients = $address;
|
||||||
|
|
||||||
|
$headers['From'] = mail_notify_from();
|
||||||
|
$headers['To'] = $nickname . ' <' . $address . '>';
|
||||||
|
$headers['Subject'] = _('SMS confirmation');
|
||||||
|
|
||||||
|
$body = "$nickname: confirm you own this number with this code:";
|
||||||
|
$body .= "\n\n";
|
||||||
|
$body .= $code;
|
||||||
|
$body .= "\n\n";
|
||||||
|
|
||||||
|
mail_send($recipients, $headers, $body);
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user