Documentation

Auth
in package

Manage authentification safely

Table of Contents

Properties

$errorLogin  : string
$loginTry  : array<string|int, mixed>
$logs  : Logs
$successLogin  : string

Methods

__construct()  : mixed
addIpTryLogin()  : void
Verify the authentification by the user
countLoginAttemps()  : bool
Verify the authentification by the user
displayLoginAttempts()  : void
getHashMapTryLogin()  : array<string|int, mixed>
hasIp()  : bool
Verify the authentification by the user
login()  : bool
Login function with form's name, name and password inputs
logout()  : void
Destroy every sessions sets
register()  : void
Register function with name, email and password inputs
verifAuth()  : void
Verify the authentification by the user

Properties

$errorLogin

private string $errorLogin

$loginTry

private static array<string|int, mixed> $loginTry = []

$successLogin

private string $successLogin

Methods

__construct()

public __construct(string $envPath, string $logsFile) : mixed
Parameters
$envPath : string

Folder where the .env file is

$logsFile : string

Path where save the logs about authentification success or fail

addIpTryLogin()

Verify the authentification by the user

public static addIpTryLogin(string $ip, int $count, string $cooldown) : void
Parameters
$ip : string

client that try login

$count : int

number of try aviable before cooldown

$cooldown : string

timer of the cooldown until new try for this IP

Return values
void

nothing....for the moment

countLoginAttemps()

Verify the authentification by the user

public static countLoginAttemps(string $ipClient) : bool
Parameters
$ipClient : string

the IP Adresse that tried login

Return values
bool

return true if cool if dosen't have cooldown

displayLoginAttempts()

public static displayLoginAttempts() : void
Return values
void

les informations de tentatives de connexion

getHashMapTryLogin()

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

Retourne toutes les tentatives de connexion

hasIp()

Verify the authentification by the user

public static hasIp(string $clientIp) : bool
Parameters
$clientIp : string

the IP adresse to look for

Return values
bool

return true if this IP adresse already tried connexion

login()

Login function with form's name, name and password inputs

public login(string $submit, string $name, string $password) : bool
Parameters
$submit : string

Name of the form

$name : string

input of the name used to login

$password : string

password to authentify

Return values
bool

state of connexion (true or false)

logout()

Destroy every sessions sets

public static logout() : void
Return values
void

nothing...?

register()

Register function with name, email and password inputs

public register(string $name, string $email, string $password) : void
Parameters
$name : string

name of the user

$email : string

input of the email used to register

$password : string

password to authentify

Return values
void

state of connexion (string error or header to the account page)

verifAuth()

Verify the authentification by the user

public static verifAuth(mixed $sessionId) : void
Parameters
$sessionId : mixed
Return values
void

return error in case of false


        
On this page

Search results