Elgg  Version 4.3
Public Member Functions | Protected Attributes | List of all members
Elgg\Users\Accounts Class Reference

User accounts service. More...

Public Member Functions

 __construct (Config $config, Translator $translator, PasswordService $passwords, UsersTable $users, PluginHooksService $hooks, EmailService $email, PasswordGeneratorService $password_generator)
 Constructor. More...
 
 validateAccountData ($username, $password, $name, $email, $allow_multiple_emails=false)
 Validate registration details to ensure they can be used to register a new user account. More...
 
 assertValidAccountData ($username, $password, $name, $email, $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 ($username, $assert_unregistered=false)
 Simple function which ensures that a username contains only valid characters. More...
 
 assertValidPassword ($password)
 Simple validation of a password. More...
 
 assertCurrentPassword (\ElggUser $user, $password)
 Assert that user can authenticate with the given password. More...
 
 assertValidEmail ($address, $assert_unregistered=false)
 Simple validation of a email. More...
 
 isValidEmail ($address)
 Validates an email address. More...
 
 requestNewEmailValidation (\ElggUser $user, $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...
 

Protected Attributes

 $config
 
 $translator
 
 $passwords
 
 $users
 
 $hooks
 
 $email
 
 $password_generator
 

Detailed Description

User accounts service.

Definition at line 21 of file Accounts.php.

Constructor & Destructor Documentation

Elgg\Users\Accounts::__construct ( Config  $config,
Translator  $translator,
PasswordService  $passwords,
UsersTable  $users,
PluginHooksService  $hooks,
EmailService  $email,
PasswordGeneratorService  $password_generator 
)

Constructor.

Parameters
Config$configConfig
Translator$translatorTranslator
PasswordService$passwordsPasswords
UsersTable$usersUsers table
PluginHooksService$hooksPlugin hooks service
EmailService$emailEmail service
PasswordGeneratorService$password_generatorPassword generator service

Definition at line 69 of file Accounts.php.

Member Function Documentation

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

Assert that user can authenticate with the given password.

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

Definition at line 348 of file Accounts.php.

Elgg\Users\Accounts::assertValidAccountData (   $username,
  $password,
  $name,
  $email,
  $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$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 153 of file Accounts.php.

Elgg\Users\Accounts::assertValidEmail (   $address,
  $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 363 of file Accounts.php.

Elgg\Users\Accounts::assertValidPassword (   $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 313 of file Accounts.php.

Elgg\Users\Accounts::assertValidUsername (   $username,
  $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 242 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 485 of file Accounts.php.

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

Validates an email address.

Parameters
string$addressEmail address
Returns
bool

Definition at line 397 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 181 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 445 of file Accounts.php.

Elgg\Users\Accounts::requestNewEmailValidation ( \ElggUser  $user,
  $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
InvalidParameterException

Definition at line 410 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 462 of file Accounts.php.

Elgg\Users\Accounts::validateAccountData (   $username,
  $password,
  $name,
  $email,
  $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 100 of file Accounts.php.

Member Data Documentation

Elgg\Users\Accounts::$config
protected

Definition at line 26 of file Accounts.php.

Elgg\Users\Accounts::$email
protected

Definition at line 51 of file Accounts.php.

Elgg\Users\Accounts::$hooks
protected

Definition at line 46 of file Accounts.php.

Elgg\Users\Accounts::$password_generator
protected

Definition at line 56 of file Accounts.php.

Elgg\Users\Accounts::$passwords
protected

Definition at line 36 of file Accounts.php.

Elgg\Users\Accounts::$translator
protected

Definition at line 31 of file Accounts.php.

Elgg\Users\Accounts::$users
protected

Definition at line 41 of file Accounts.php.


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