Blesta Source Documentation

PasswordResets extends AppModel

Password resets management

Table of Contents

Methods

__construct() Initialize PasswordResets
add() Generates a new password reset token
delete() Deletes an existing token
deleteByHash() Deletes an existing token by the token hash
deleteByUser() Deletes all existing token from a specific user
get() Fetches a password reset token
getExpired() Fetches all expired password reset tokens
validate() Validates the password reset token
getRules() Fetches the validation rules for a new password reset token
Methods

__construct()

Initialize PasswordResets

public __construct() : mixed

add()

Generates a new password reset token

public add(int $user_id, string $email) : string
Parameters
$user_id : int

The ID of the user to reset the password

$email : string

The email address of the user

Return values
string

The password reset token, void on error

delete()

Deletes an existing token

public delete(string $token) : mixed
Parameters
$token : string

The token to delete

deleteByHash()

Deletes an existing token by the token hash

public deleteByHash(string $token_hash) : mixed
Parameters
$token_hash : string

The token to delete

deleteByUser()

Deletes all existing token from a specific user

public deleteByUser(int $user_id) : mixed
Parameters
$user_id : int

The user ID to delete all tokens

get()

Fetches a password reset token

public get(string $token) : mixed
Parameters
$token : string

The password reset token to fetch

Return values
mixed

An object representing the token

getExpired()

Fetches all expired password reset tokens

public getExpired() : array<string|int, mixed>
Return values
array<string|int, mixed>

An array of objects representing the expired token

validate()

Validates the password reset token

public validate(string $token) : bool
Parameters
$token : string

The password reset token to validate

Return values
bool

True if the token is valid, false otherwise

getRules()

Fetches the validation rules for a new password reset token

private getRules() : array<string|int, mixed>
Return values
array<string|int, mixed>

The validation rules

Tags
subpackage

app.models

copyright

Copyright (c) 2024, Phillips Data, Inc.

license

http://www.blesta.com/license/ The Blesta License Agreement

link

Blesta


        
On this page

Search results