Elgg  Version 6.0
Public Member Functions | List of all members
Elgg\Users\Accounts Class Reference

User accounts service. More...

Public Member Functions

 __construct (protected Config $config, protected Translator $translator, protected PasswordService $passwords, protected EventsService $events, protected EmailService $email, protected PasswordGeneratorService $password_generator)
 Constructor. More...
 
 validateAccountData (string $username, string|array $password, string $name, string $email, bool $allow_multiple_emails=false)
 Validate registration details to ensure they can be used to register a new user account. More...
 
 assertValidAccountData (string $username, string|array $password, string $name, string $email, bool $allow_multiple_emails=false)
 Assert that given registration details are valid and can be used to register the user. More...
 
 register (array $params=[])
 Registers a user. More...
 
 assertValidUsername (string $username, bool $assert_unregistered=false)
 Simple function which ensures that a username contains only valid characters. More...
 
 assertValidPassword (string|array $password)
 Simple validation of a password. More...
 
 assertCurrentPassword (\ElggUser $user, string $password)
 Assert that user can authenticate with the given password. More...
 
 assertValidEmail (string $address, bool $assert_unregistered=false)
 Simple validation of a email. More...
 
 isValidEmail (string $address)
 Validates an email address. More...
 
 requestNewEmailValidation (\ElggUser $user, string $email)
 Send out an e-mail to the new email address the user wanted. More...
 
 registerAuthenticationFailure (\ElggUser $user)
 Registers an authentication failure for a user. More...
 
 resetAuthenticationFailures (\ElggUser $user)
 Resets all authentication failures for a given user. More...
 
 isAuthenticationFailureLimitReached (\ElggUser $user, int $limit=null, int $lifetime=null)
 Checks if the authentication failure limit has been reached. More...
 

Detailed Description

User accounts service.

Definition at line 20 of file Accounts.php.

Constructor & Destructor Documentation

Elgg\Users\Accounts::__construct ( protected Config  $config,
protected Translator  $translator,
protected PasswordService  $passwords,
protected EventsService  $events,
protected EmailService  $email,
protected PasswordGeneratorService  $password_generator 
)

Constructor.

Parameters
Config$configConfig
Translator$translatorTranslator
PasswordService$passwordsPasswords
EventsService$eventsEvents service
EmailService$emailEmail service
PasswordGeneratorService$password_generatorPassword generator service

Definition at line 32 of file Accounts.php.

Member Function Documentation

Elgg\Users\Accounts::assertCurrentPassword ( \ElggUser  $user,
string  $password 
)

Assert that user can authenticate with the given password.

Parameters
\ElggUser$userUser entity
string$passwordPassword
Returns
void
Exceptions
RegistrationException

Definition at line 299 of file Accounts.php.

Elgg\Users\Accounts::assertValidAccountData ( string  $username,
string|array  $password,
string  $name,
string  $email,
bool  $allow_multiple_emails = false 
)

Assert that given registration details are valid and can be used to register the user.

Parameters
string$usernameThe username of the new user
string | array$passwordThe password
string$nameThe user's display name
string$emailThe user's email address
bool$allow_multiple_emailsAllow the same email address to be registered multiple times?
Returns
void
Exceptions
RegistrationException

Definition at line 104 of file Accounts.php.

Elgg\Users\Accounts::assertValidEmail ( string  $address,
bool  $assert_unregistered = false 
)

Simple validation of a email.

Parameters
string$addressEmail address
bool$assert_unregisteredAlso assert that the email address has not yet been used for a user account
Returns
void
Exceptions
RegistrationException

Definition at line 314 of file Accounts.php.

Elgg\Users\Accounts::assertValidPassword ( string|array  $password)

Simple validation of a password.

Parameters
string | array$passwordClear text password Can be an array [$password, $confirm_password]
Returns
void
Exceptions
RegistrationException

Definition at line 264 of file Accounts.php.

Elgg\Users\Accounts::assertValidUsername ( string  $username,
bool  $assert_unregistered = false 
)

Simple function which ensures that a username contains only valid characters.

This should only permit chars that are valid on the file system as well.

Parameters
string$usernameUsername
bool$assert_unregisteredAlso assert that the username has not yet been registered
Returns
void
Exceptions
RegistrationException

Definition at line 192 of file Accounts.php.

Elgg\Users\Accounts::isAuthenticationFailureLimitReached ( \ElggUser  $user,
int  $limit = null,
int  $lifetime = null 
)

Checks if the authentication failure limit has been reached.

Parameters
\ElggUser$userUser to check the limit for
int$limit(optional) number of allowed failures
int$lifetime(optional) number of seconds before a failure is considered expired
Returns
bool
Since
4.3

Definition at line 435 of file Accounts.php.

Elgg\Users\Accounts::isValidEmail ( string  $address)

Validates an email address.

Parameters
string$addressEmail address
Returns
bool

Definition at line 348 of file Accounts.php.

Elgg\Users\Accounts::register ( array  $params = [])

Registers a user.

Parameters
array$paramsArray of options with keys: (string) username => The username of the new user (string) password => The password (string) name => The user's display name (string) email => The user's email address (string) subtype => (optional) Subtype of the user entity (string) language => (optional) user language (defaults to current language) (bool) allow_multiple_emails => (optional) Allow the same email address to be registered multiple times (default false) (bool) validated => (optional) Is the user validated (default true)
Returns
Exceptions
RegistrationException

Definition at line 131 of file Accounts.php.

Elgg\Users\Accounts::registerAuthenticationFailure ( \ElggUser  $user)

Registers an authentication failure for a user.

Parameters
\ElggUser$useruser to log the failure for
Returns
void
Since
4.3

Definition at line 396 of file Accounts.php.

Elgg\Users\Accounts::requestNewEmailValidation ( \ElggUser  $user,
string  $email 
)

Send out an e-mail to the new email address the user wanted.

Parameters
\ElggUser$useruser with new e-mail address
string$emailE-mail address
Returns
bool
Exceptions
InvalidArgumentException

Definition at line 361 of file Accounts.php.

Elgg\Users\Accounts::resetAuthenticationFailures ( \ElggUser  $user)

Resets all authentication failures for a given user.

Parameters
\ElggUser$useruser to clear the failures for
Returns
void
Since
4.3

Definition at line 412 of file Accounts.php.

Elgg\Users\Accounts::validateAccountData ( string  $username,
string|array  $password,
string  $name,
string  $email,
bool  $allow_multiple_emails = false 
)

Validate registration details to ensure they can be used to register a new user account.

Parameters
string$usernameThe username of the new user
string | array$passwordThe password Can be an array [$password, $oonfirm_password]
string$nameThe user's display name
string$emailThe user's email address
bool$allow_multiple_emailsAllow the same email address to be registered multiple times?
Returns
ValidationResults

Definition at line 55 of file Accounts.php.


The documentation for this class was generated from the following file: