UserFrosting API

VerificationRepository extends TokenRepository

Token repository class for new account verifications.

User tokens are used, for example, to perform password resets and new account email verifications.

Tags
author

Alex Weissman (https://alexanderweissman.com)

see
https://learn.userfrosting.com/users/user-accounts

Table of Contents

$modelIdentifier string
$classMapper ClassMapper
$algorithm string
$modelIdentifier string
updateUser() Modify the user during the token completion process. array
__construct() Create a new TokenRepository object. mixed
cancel() Cancels a specified token by removing it from the database. Model|bool
complete() Completes a token-based process, invoking updateUser() in the child object to do the actual action. Model|bool
create() Create a new token for a specified user. Model
exists() Determine if a specified user has an incomplete and unexpired token. Model|bool
removeExisting() Delete all existing tokens from the database for a particular user. int
removeExpired() Remove all expired tokens from the database. bool|null
generateRandomToken() Generate a new random token for this user. string
updateUser() Modify the user during the token completion process. array

Properties

Methods

updateUser()

Modify the user during the token completion process.

protected updateUser( $user : UserInterface , $args : mixed ) : array

This method is called during complete(), and is a way for concrete implementations to modify the user.

Parameters
$user : UserInterface

the user object to modify.

$args : mixed
Return values
array

$args the list of parameters that were supplied to the call to complete()

__construct()

Create a new TokenRepository object.

public __construct( $classMapper : ClassMapper [, $algorithm : string = 'sha512' ] ) : mixed
Parameters
$classMapper : ClassMapper

Maps generic class identifiers to specific class names.

$algorithm : string = 'sha512'

The hashing algorithm to use when storing generated tokens.

Return values
mixed

cancel()

Cancels a specified token by removing it from the database.

public cancel( $token : int ) : Model|bool
Parameters
$token : int

The token to remove.

Return values
Model|bool

complete()

Completes a token-based process, invoking updateUser() in the child object to do the actual action.

public complete( $token : int [, $userParams : array = [] ] ) : Model|bool
Parameters
$token : int

The token to complete.

$userParams : array = []

An optional list of parameters to pass to updateUser().

Return values
Model|bool

create()

Create a new token for a specified user.

public create( $user : UserInterface , $timeout : int ) : Model
Parameters
$user : UserInterface

The user object to associate with this token.

$timeout : int

The time, in seconds, after which this token should expire.

Return values
Model

The model (PasswordReset, Verification, etc) object that stores the token.

exists()

Determine if a specified user has an incomplete and unexpired token.

public exists( $user : UserInterface [, $token : int = null ] ) : Model|bool
Parameters
$user : UserInterface

The user object to look up.

$token : int = null

Optionally, try to match a specific token.

Return values
Model|bool

removeExpired()

Remove all expired tokens from the database.

public removeExpired( ) : bool|null
Return values
bool|null

generateRandomToken()

Generate a new random token for this user.

protected generateRandomToken( [ $gen : string = null ] ) : string

This generates a token to use for verifying a new account, resetting a lost password, etc.

Parameters
$gen : string = null

specify an existing token that, if we happen to generate the same value, we should regenerate on.

Return values
string

updateUser()

Modify the user during the token completion process.

protected abstract updateUser( $user : UserInterface , $args : array ) : array

This method is called during complete(), and is a way for concrete implementations to modify the user.

Parameters
$user : UserInterface

the user object to modify.

$args : array
Return values
array

$args the list of parameters that were supplied to the call to complete()

Search results