forked from GNUsocial/gnu-social
CSRF protection in user registration
darcs-hash:20080829054017-84dde-c9268e5c815934dcbca2451dd6c9016f2ac4a03a.gz
This commit is contained in:
parent
47726844a0
commit
2dc50d7e37
@ -36,6 +36,13 @@ class RegisterAction extends Action {
|
|||||||
}
|
}
|
||||||
|
|
||||||
function try_register() {
|
function try_register() {
|
||||||
|
|
||||||
|
$token = $this->trimmed('token');
|
||||||
|
if (!$token || $token != common_session_token()) {
|
||||||
|
$this->show_form(_('There was a problem with your session token. Try again, please.'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
$nickname = $this->trimmed('nickname');
|
$nickname = $this->trimmed('nickname');
|
||||||
$email = $this->trimmed('email');
|
$email = $this->trimmed('email');
|
||||||
$fullname = $this->trimmed('fullname');
|
$fullname = $this->trimmed('fullname');
|
||||||
@ -139,6 +146,7 @@ class RegisterAction extends Action {
|
|||||||
common_element_start('form', array('method' => 'post',
|
common_element_start('form', array('method' => 'post',
|
||||||
'id' => 'login',
|
'id' => 'login',
|
||||||
'action' => common_local_url('register')));
|
'action' => common_local_url('register')));
|
||||||
|
common_hidden('token', common_session_token());
|
||||||
common_input('nickname', _('Nickname'), $this->trimmed('nickname'),
|
common_input('nickname', _('Nickname'), $this->trimmed('nickname'),
|
||||||
_('1-64 lowercase letters or numbers, no punctuation or spaces. Required.'));
|
_('1-64 lowercase letters or numbers, no punctuation or spaces. Required.'));
|
||||||
common_password('password', _('Password'),
|
common_password('password', _('Password'),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user