Jinya CMS

Artist extends Entity
in package
implements JsonSerializable

This class contains all information relevant for an artist. Artists are the users of Jinya CMS

Tags

Interfaces, Classes, Traits and Enums

JsonSerializable

Table of Contents

$aboutMe  : string|null
$artistName  : string
$email  : string
$enabled  : bool
$failedLoginAttempts  : int|null
$id  : int
$loginBlockedUntil  : DateTime|null
$loginMailEnabled  : bool
$newDeviceMailEnabled  : bool
$password  : string
$prefersColorScheme  : bool|null
$profilePicture  : string|null
$roles  : array<string|int, string>
$totpMode  : TotpMode
$totpSecret  : string|null
$twoFactorToken  : string|null
activateOtphp()  : bool
Activates otphp by verifying the code and then changing the totp mode
changePassword()  : bool
Changes the password of the artist
countAdmins()  : int
Counts all available admins
findByEmail()  : Artist|null
Finds the artist with the given email
format()  : array<string, array<string|int, string>|bool|int|string|null>
Formats the artist
jsonSerialize()  : mixed
registerFailedLogin()  : void
Registers a failed login. After the fifth login failed, the login will be blocked for 10 minutes
setPassword()  : void
Sets the artists password and hashes it
setTotpSecret()  : TOTP
Sets the totp secret
setTwoFactorCode()  : void
Securely sets the two-factor code
unlockAccount()  : void
Resets the failed login attempts and the time until the login is blocked
validateDevice()  : bool
Validates the given device code for the given artist
validatePassword()  : bool
Validates the given password against the hash in the database
verifyTotpCode()  : bool
Verifies a given totp code for the artist

Properties

$aboutMe

public string|null $aboutMe = ''

The about me text

Tags

$artistName

public string $artistName = ''

The artist name

Tags

$email

public string $email = ''

The email address of the artist

Tags

$enabled

public bool $enabled = false

Indicates whether the artist is allowed to log in

Tags

$failedLoginAttempts

public int|null $failedLoginAttempts = 0

The count of failed login attempts, after 5 the artist can't log in anymore

Tags

$loginBlockedUntil

public DateTime|null $loginBlockedUntil = null

Contains the time until the login is blocked, if the login is not blocked, this field is null

Tags

$loginMailEnabled

public bool $loginMailEnabled = true
Tags

$newDeviceMailEnabled

public bool $newDeviceMailEnabled = true
Tags

$password

public string $password = ''

The artists' password

Tags

$prefersColorScheme

public bool|null $prefersColorScheme = null

The artist preferred color scheme, null means auto, true means light and false means dark

Tags

$profilePicture

public string|null $profilePicture = ''

The path to the profile picture

Tags

$roles

public array<string|int, string> $roles = []

The roles of the artist

Tags

$totpMode

public TotpMode $totpMode = \Jinya\Cms\Database\TotpMode::Email
Tags

$totpSecret

public string|null $totpSecret = null
Tags

$twoFactorToken

public string|null $twoFactorToken = ''

The current two-factor code, gets reset after successful validation

Tags

Methods

activateOtphp()

Activates otphp by verifying the code and then changing the totp mode

public activateOtphp(non-empty-string $code) : bool
Parameters
$code : non-empty-string
Tags
throws
NotNullViolationException
Return values
bool

changePassword()

Changes the password of the artist

public changePassword(string $oldPassword, string $password) : bool
Parameters
$oldPassword : string

The old password of the artist to validate the password before changing

$password : string

The new password

Tags
throws
NotNullViolationException
Return values
bool

countAdmins()

Counts all available admins

public static countAdmins() : int
Tags
Return values
int

findByEmail()

Finds the artist with the given email

public static findByEmail(string $email) : Artist|null
Parameters
$email : string

The email to search for

Tags
Return values
Artist|null

format()

Formats the artist

public format() : array<string, array<string|int, string>|bool|int|string|null>
Tags
Return values
array<string, array<string|int, string>|bool|int|string|null>

jsonSerialize()

public jsonSerialize() : mixed
Tags
Return values
mixed

registerFailedLogin()

Registers a failed login. After the fifth login failed, the login will be blocked for 10 minutes

public registerFailedLogin() : void
Tags
throws
NotNullViolationException
Return values
void

setPassword()

Sets the artists password and hashes it

public setPassword(string $password) : void
Parameters
$password : string
Tags
Return values
void

setTotpSecret()

Sets the totp secret

public setTotpSecret() : TOTP
Tags
throws
NotNullViolationException
Return values
TOTP

setTwoFactorCode()

Securely sets the two-factor code

public setTwoFactorCode() : void
Tags
throws
Exception
Return values
void

unlockAccount()

Resets the failed login attempts and the time until the login is blocked

public unlockAccount() : void
Tags
throws
NotNullViolationException
Return values
void

validateDevice()

Validates the given device code for the given artist

public validateDevice(string $knownDeviceCode) : bool
Parameters
$knownDeviceCode : string

The device code to validate

Tags
Return values
bool

validatePassword()

Validates the given password against the hash in the database

public validatePassword(string $password) : bool
Parameters
$password : string
Tags
Return values
bool

verifyTotpCode()

Verifies a given totp code for the artist

public verifyTotpCode(non-empty-string $code) : bool
Parameters
$code : non-empty-string
Tags
Return values
bool

Search results