merge in changes for CSRF, too

darcs-hash:20080830162223-84dde-573e490dc4fde68512ea4ec28599019d2740cfcf.gz
This commit is contained in:
Evan Prodromou 2008-08-30 12:22:23 -04:00
parent b2653f007a
commit 75f285ddf6

View File

@ -36,7 +36,7 @@ class RegisterAction extends Action {
} }
function try_register() { function try_register() {
$token = $this->trimmed('token'); $token = $this->trimmed('token');
if (!$token || $token != common_session_token()) { if (!$token || $token != common_session_token()) {
$this->show_form(_('There was a problem with your session token. Try again, please.')); $this->show_form(_('There was a problem with your session token. Try again, please.'));
@ -153,6 +153,15 @@ 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());
if ($this->trimmed('code')) {
$code = ($this->trimmed('code'));
$invite = Invitation::staticGet($code);
common_hidden('code', $code);
}
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'),