Making FormAction subclasses use same sessionToken() code

This commit is contained in:
Mikael Nordfeldth 2014-05-18 19:59:40 +02:00
parent 80fbec173b
commit 22481b1de6
4 changed files with 1 additions and 36 deletions

View File

@ -84,18 +84,6 @@ class DisfavorForm extends Form
return common_local_url('disfavor'); return common_local_url('disfavor');
} }
/**
* Include a session token for CSRF protection
*
* @return void
*/
function sessionToken()
{
$this->out->hidden('token-' . $this->notice->id,
common_session_token(),
'token');
}
/** /**
* Legend of the Form * Legend of the Form
* *

View File

@ -84,18 +84,6 @@ class FavorForm extends Form
return common_local_url('favor'); return common_local_url('favor');
} }
/**
* Include a session token for CSRF protection
*
* @return void
*/
function sessionToken()
{
$this->out->hidden('token-' . $this->notice->id,
common_session_token(),
'token');
}
/** /**
* Legend of the Form * Legend of the Form
* *

View File

@ -91,7 +91,7 @@ class Form extends Widget
function sessionToken() function sessionToken()
{ {
$this->out->hidden('token', common_session_token()); $this->out->hidden('token-' . $this->id() ?: common_random_hexstr(3), common_session_token(), 'token');
} }
/** /**

View File

@ -80,17 +80,6 @@ class RepeatForm extends Form
return common_local_url('repeat'); return common_local_url('repeat');
} }
/**
* Include a session token for CSRF protection
*
* @return void
*/
function sessionToken()
{
$this->out->hidden('token-' . $this->notice->id,
common_session_token());
}
/** /**
* Legend of the Form * Legend of the Form
* *