Class dektrium\user\models\User

Inheritancedektrium\user\models\User » yii\db\ActiveRecord
Implementsyii\web\IdentityInterface

User ActiveRecord model.

Public Properties

Hide inherited properties

PropertyTypeDescriptionDefined By
$password string Plain password. dektrium\user\models\User
$usernameRegexp string Default username regexp dektrium\user\models\User

Public Methods

Hide inherited methods

MethodDescriptionDefined By
afterSave() dektrium\user\models\User
attemptConfirmation() Attempts user confirmation. dektrium\user\models\User
attemptEmailChange() This method attempts changing user email. If user's "unconfirmed_email" field is empty is returns false, else if somebody already has email that equals user's "unconfirmed_email" it returns false, otherwise returns true and updates user's password. dektrium\user\models\User
attributeLabels() dektrium\user\models\User
beforeSave() dektrium\user\models\User
behaviors() dektrium\user\models\User
block() Blocks the user by setting 'blocked_at' field to current time and regenerates auth_key. dektrium\user\models\User
confirm() Confirms the user by setting 'confirmed_at' field to current time. dektrium\user\models\User
create() Creates new user account. It generates password if it is not provided by user. dektrium\user\models\User
findIdentity() dektrium\user\models\User
findIdentityByAccessToken() dektrium\user\models\User
generateUsername() Generates new username based on email address, or creates new username like "user1". dektrium\user\models\User
getAccounts() dektrium\user\models\User
getAuthKey() dektrium\user\models\User
getId() dektrium\user\models\User
getIsAdmin() dektrium\user\models\User
getIsBlocked() dektrium\user\models\User
getIsConfirmed() dektrium\user\models\User
getProfile() dektrium\user\models\User
init() dektrium\user\models\User
register() This method is used to register new user account. If Module::enableConfirmation is set true, this method will generate new confirmation token and use mailer to send it to the user. dektrium\user\models\User
resetPassword() Resets password. dektrium\user\models\User
rules() dektrium\user\models\User
scenarios() dektrium\user\models\User
setProfile() dektrium\user\models\User
tableName() dektrium\user\models\User
unblock() UnBlocks the user by setting 'blocked_at' field to null. dektrium\user\models\User
validateAuthKey() dektrium\user\models\User

Constants

Hide inherited constants

ConstantValueDescriptionDefined By
AFTER_CREATE 'afterCreate' dektrium\user\models\User
AFTER_REGISTER 'afterRegister' dektrium\user\models\User
BEFORE_CREATE 'beforeCreate' dektrium\user\models\User
BEFORE_REGISTER 'beforeRegister' dektrium\user\models\User
NEW_EMAIL_CONFIRMED 2 dektrium\user\models\User
OLD_EMAIL_CONFIRMED 1 dektrium\user\models\User

Property Details

$finder protected property
protected dektrium\user\Finder $finder null
$mailer protected property
protected dektrium\user\Mailer $mailer null
$module protected property
protected dektrium\user\Module $module null
$password public property

Plain password. Used for model validation.

public string $password null
$usernameRegexp public static property

Default username regexp

public static string $usernameRegexp '/^[-a-zA-Z0-9_\.@]+$/'

Method Details

afterSave() public method

public void afterSave ( $insert, $changedAttributes )
$insert
$changedAttributes
attemptConfirmation() public method

Attempts user confirmation.

public boolean attemptConfirmation ( $code )
$code string

Confirmation code.

attemptEmailChange() public method

This method attempts changing user email. If user's "unconfirmed_email" field is empty is returns false, else if somebody already has email that equals user's "unconfirmed_email" it returns false, otherwise returns true and updates user's password.

public bool attemptEmailChange ( $code )
$code string
throws Exception
attributeLabels() public method

public void attributeLabels ( )
beforeSave() public method

public void beforeSave ( $insert )
$insert
behaviors() public method

public void behaviors ( )
block() public method

Blocks the user by setting 'blocked_at' field to current time and regenerates auth_key.

public void block ( )
confirm() public method

Confirms the user by setting 'confirmed_at' field to current time.

public void confirm ( )
create() public method

Creates new user account. It generates password if it is not provided by user.

public bool create ( )
findIdentity() public static method

public static void findIdentity ( $id )
$id
findIdentityByAccessToken() public static method

public static void findIdentityByAccessToken ( $token, $type null )
$token
$type
generateUsername() public method

Generates new username based on email address, or creates new username like "user1".

public void generateUsername ( )
getAccounts() public method

public dektrium\user\models\Account[] getAccounts ( )
return dektrium\user\models\Account[]

Connected accounts ($provider => $account)

getAuthKey() public method

public void getAuthKey ( )
getId() public method

public void getId ( )
getIsAdmin() public method

public bool getIsAdmin ( )
return bool

Whether the user is an admin or not.

getIsBlocked() public method

public bool getIsBlocked ( )
return bool

Whether the user is blocked or not.

getIsConfirmed() public method

public bool getIsConfirmed ( )
return bool

Whether the user is confirmed or not.

getProfile() public method

public \yii\db\ActiveQuery getProfile ( )
init() public method

public void init ( )
register() public method

This method is used to register new user account. If Module::enableConfirmation is set true, this method will generate new confirmation token and use mailer to send it to the user.

public bool register ( )
resetPassword() public method

Resets password.

public bool resetPassword ( $password )
$password string
rules() public method

public void rules ( )
scenarios() public method

public void scenarios ( )
setProfile() public method

public void setProfile ( dektrium\user\models\Profile $profile )
$profile dektrium\user\models\Profile
tableName() public static method

public static void tableName ( )
unblock() public method

UnBlocks the user by setting 'blocked_at' field to null.

public void unblock ( )
validateAuthKey() public method

public void validateAuthKey ( $authKey )
$authKey