inc\classes\Auth.php
File, which contains class
- Author
- Sergey Dilong
- License
- GPL-2.0
- Package
- Temply-Account\Services
\Auth
Package: Temply-Account\Services



Parameters
Returns
Details
Parameters
Returns
Throws
Details
Returns
Details
Parameters
Returns
Throws
Details
Authorization and current account control
Used to all auth purposes and getting current user info
- Author
- Sergey Dilong
- License
- GPL-2.0
Properties

array<mixed,mixed> $data = array()static
Current user info
Default value
array()Details- Type
- array<mixed,mixed>
- See
- Get current User

boolean $init = falsestatic
Checks if Auth() was already inited
Default value
falseDetails- Type
- boolean
- See
- Look up where it is used

string $token = false64 symbols unique access key
Default value
falseDetails- Type
- string
- See
- Get token outside the class
Methods

Init() : voidstatic
Prepare Auth system
Generates template for login sysyem (Later used for current token data).

User(boolean $r = false) : \User | arraystatic
Current user
Recieve current User object
If $r === true: User->get() will be returned, else - class User
| Name | Type | Description |
|---|---|---|
| $r | boolean | Return switcher |
| Type | Description |
|---|---|
| \User | array |

__construct(string $act = '') : voidLaunch Auth system
Parameters
Throws
Details
| Name | Type | Description |
|---|---|---|
| $act | string | Navigator string
|
| Exception | Description |
|---|---|
| \apiException | * [300] DB Error * [301] Invalid credentials for login * [302] There's no such token in DB |
- Example
- Auth could be called by statements
- See
- Login function
- See
- Login check function
- See
- Get token outside the class
- See
- Get current User

check(string $t) : booleanCheck token
Checks if given token is correct
| Name | Type | Description |
|---|---|---|
| $t | string | 64-symbols long token |
| Type | Description |
|---|---|
| boolean | If `true` - token is correct |
| Exception | Description |
|---|---|
| \apiException | * [302] Incorrect token |

getTokenData() : arraystatic
Get token, etc.
Get such data as token and verify status
| Type | Description |
|---|---|
| array | Token data * *token* - [string] 64-symbols length * *verify* - [boolean] if `true` - token is checked |
- Api
- Uses
- as data source

newToken(string $l, string $p) : booleanNew token
Auth with login and password
| Name | Type | Description |
|---|---|---|
| $l | string | Login |
| $p | string | Password |
| Type | Description |
|---|---|
| boolean | If `true` - login successful |
| Exception | Description |
|---|---|
| \apiException | * [300] DB Error * [301] Invalid credentials for login |