\Orpheus\FormFormToken

The Form Token class

This class is limit the use of form data to only one shot.

Summary

Methods
Properties
Constants
__construct()
generateToken()
generateTokenHTML()
_generateTokenHTML()
__toString()
validate()
validateForm()
validateCurrent()
$TOKEN_LENGTH
$DEFAULT_MAXTOKEN
SESSION_KEY
HTML_PREFIX
ERROR_INVALIDTOKEN
No protected methods found
$name
$maxToken
$maxUsage
$lastToken
N/A
No private methods found
No private properties found
N/A

Constants

SESSION_KEY

SESSION_KEY

HTML_PREFIX

HTML_PREFIX

ERROR_INVALIDTOKEN

ERROR_INVALIDTOKEN

Properties

$TOKEN_LENGTH

$TOKEN_LENGTH : integer

The default token length

Type

integer

$DEFAULT_MAXTOKEN

$DEFAULT_MAXTOKEN : integer

The default max token

Type

integer — Can not be unlimited or refreshed pages will create a non limited amount of tokens We store the minimum amount of data to allow no control of expiration

$name

$name : string

The name

Type

string

$maxToken

$maxToken : integer

Max allowed token

Type

integer

$maxUsage

$maxUsage : integer

Max allowed usage of one token

Type

integer

$lastToken

$lastToken : string

Last token

Type

string

Methods

__construct()

__construct(string  $name = NULL, integer  $maxToken = null, integer  $maxUsage = 1) 

Constructor

Parameters

string $name
integer $maxToken
integer $maxUsage

Number of max usage, default value is 1.

generateToken()

generateToken() : string

Generate a new token

Returns

string —

The token

generateTokenHTML()

generateTokenHTML(boolean  $force = false) : string

Generate a new token and return HTML input tag

Parameters

boolean $force

Returns

string —

The HTML input tag

_generateTokenHTML()

_generateTokenHTML(string  $force = false) 

Generate a new token and display HTML input tag

Parameters

string $force

__toString()

__toString() : string

Get HTML input tag as string

Returns

string

validate()

validate(string  $token) : boolean

Validate the given token

Parameters

string $token

Returns

boolean —

True if the token is valid

validateForm()

validateForm(\Orpheus\InputController\InputRequest  $request, string  $domain = null) 

Validate the given token from form or throw an UserException

Parameters

\Orpheus\InputController\InputRequest $request
string $domain

Throws

\Orpheus\Exception\UserException

validateCurrent()

validateCurrent(\Orpheus\InputController\InputRequest  $request) : boolean

Validate token in request

Parameters

\Orpheus\InputController\InputRequest $request

Returns

boolean