Elgg  Version 3.0
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)
 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 ($username, $password, $name, $email, $allow_multiple_emails=false, $subtype=null)
 Registers a user, returning false if the username already exists. 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...
 

Protected Attributes

 $config
 
 $translator
 
 $passwords
 
 $users
 
 $hooks
 

Detailed Description

User accounts service.

Definition at line 17 of file Accounts.php.

Constructor & Destructor Documentation

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

Constructor.

Parameters
Config$configConfig
Translator$translatorTranslator
PasswordService$passwordsPasswords
UsersTable$usersUsers table
PluginHooksService$hooksPlugin hooks service

Definition at line 53 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 329 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 133 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 344 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 289 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 211 of file Accounts.php.

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

Validates an email address.

Parameters
string$addressEmail address
Returns
bool

Definition at line 378 of file Accounts.php.

Elgg\Users\Accounts::register (   $username,
  $password,
  $name,
  $email,
  $allow_multiple_emails = false,
  $subtype = null 
)

Registers a user, returning false if the username already exists.

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?
string$subtypeSubtype of the user entity
Returns
int|false The new user's GUID; false on failure
Exceptions
RegistrationException

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

Member Data Documentation

Elgg\Users\Accounts::$config
protected

Definition at line 22 of file Accounts.php.

Elgg\Users\Accounts::$hooks
protected

Definition at line 42 of file Accounts.php.

Elgg\Users\Accounts::$passwords
protected

Definition at line 32 of file Accounts.php.

Elgg\Users\Accounts::$translator
protected

Definition at line 27 of file Accounts.php.

Elgg\Users\Accounts::$users
protected

Definition at line 37 of file Accounts.php.


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