Documentation MyBrickStore

UserController extends Controller
in package

Class UserController

  • Manages user authentication lifecycle including login, registration,
  • Password recovery and security settings like 2fa

Table of Contents

Properties

$trans  : array<string|int, mixed>
$mail  : PHPMailer
$token_model  : TokensModel
$translations  : array<string|int, mixed>
$user_model  : UsersModel

Methods

__construct()  : mixed
Constructor.
admin()  : void
Redirects authorized users to the admin dashboard
login()  : void
Handles user login process with captcha and 2fa support
logout()  : void
Destroys user session and redirects to login
register()  : void
Handles new user registration and validation email sending
render()  : void
Renders a view file within a layout template.
resetPassword()  : void
Initiates the password reset flow by sending an email link
resetPasswordForm()  : void
Processes the final password update after validation
toggle2FA()  : void
Enables or disables 2fa for the current user
verify()  : void
Verifies tokens for account activation, password reset, or 2fa
sendVerificationEmail()  : void
Sends an email using smtp with mailjet configuration
t()  : string
Retrieves a translation for a given key

Properties

$trans

protected array<string|int, mixed> $trans = []

Holds translation strings for the current language.

$translations

private array<string|int, mixed> $translations

Key/Value pair of translations.

Methods

__construct()

Constructor.

public __construct() : mixed

Initializes models and mailer configuration

admin()

Redirects authorized users to the admin dashboard

public admin() : void

login()

Handles user login process with captcha and 2fa support

public login() : void

logout()

Destroys user session and redirects to login

public logout() : void

register()

Handles new user registration and validation email sending

public register() : void

render()

Renders a view file within a layout template.

public render(string $file[, array<string|int, mixed> $data = [] ][, string $template = 'default' ]) : void
Parameters
$file : string

The name of the view file (without .php extension).

$data : array<string|int, mixed> = []

Associative array of data to pass to the view.

$template : string = 'default'

The layout template to use (default: 'default').

resetPassword()

Initiates the password reset flow by sending an email link

public resetPassword() : void

resetPasswordForm()

Processes the final password update after validation

public resetPasswordForm() : void

toggle2FA()

Enables or disables 2fa for the current user

public toggle2FA() : void

verify()

Verifies tokens for account activation, password reset, or 2fa

public verify() : void

sendVerificationEmail()

Sends an email using smtp with mailjet configuration

private sendVerificationEmail(string $email, string $token) : void
Parameters
$email : string

recipient address

$token : string

verification code to embed

t()

Retrieves a translation for a given key

private t(string $key[, string $default = '' ]) : string
Parameters
$key : string

the translation key

$default : string = ''

default text if key is missing

Return values
string

translated text


        
On this page

Search results