Class dektrium\user\models\User
Inheritance | dektrium\user\models\User » yii\db\ActiveRecord |
---|---|
Implements | yii\web\IdentityInterface |
User ActiveRecord model.
Public Properties
Property | Type | Description | Defined By |
---|---|---|---|
$password | string | Plain password. | dektrium\user\models\User |
$usernameRegexp | string | Default username regexp | dektrium\user\models\User |
Protected Properties
Property | Type | Description | Defined By |
---|---|---|---|
$finder | dektrium\user\Finder | dektrium\user\models\User | |
$mailer | dektrium\user\Mailer | dektrium\user\models\User | |
$module | dektrium\user\Module | dektrium\user\models\User |
Public Methods
Constants
Constant | Value | Description | Defined 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
Plain password. Used for model validation.
Default username regexp
Method Details
public void afterSave ( $insert, $changedAttributes ) | ||
$insert | ||
$changedAttributes |
Attempts user confirmation.
public boolean attemptConfirmation ( $code ) | ||
$code | string | Confirmation code. |
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 |
---|
public void attributeLabels ( ) |
public void beforeSave ( $insert ) | ||
$insert |
public void behaviors ( ) |
Blocks the user by setting 'blocked_at' field to current time and regenerates auth_key.
public void block ( ) |
Confirms the user by setting 'confirmed_at' field to current time.
public void confirm ( ) |
Creates new user account. It generates password if it is not provided by user.
public bool create ( ) |
public static void findIdentity ( $id ) | ||
$id |
public static void findIdentityByAccessToken ( $token, $type = null ) | ||
$token | ||
$type |
Generates new username based on email address, or creates new username like "user1".
public void generateUsername ( ) |
public dektrium\user\models\Account[] getAccounts ( ) | ||
return | dektrium\user\models\Account[] | Connected accounts ($provider => $account) |
---|
public void getAuthKey ( ) |
public void getId ( ) |
public bool getIsAdmin ( ) | ||
return | bool | Whether the user is an admin or not. |
---|
public bool getIsBlocked ( ) | ||
return | bool | Whether the user is blocked or not. |
---|
public bool getIsConfirmed ( ) | ||
return | bool | Whether the user is confirmed or not. |
---|
public \yii\db\ActiveQuery getProfile ( ) |
public void init ( ) |
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 ( ) |
Resets password.
public bool resetPassword ( $password ) | ||
$password | string |
public void rules ( ) |
public void scenarios ( ) |
public void setProfile ( dektrium\user\models\Profile $profile ) | ||
$profile | dektrium\user\models\Profile |
public static void tableName ( ) |
UnBlocks the user by setting 'blocked_at' field to null.
public void unblock ( ) |
public void validateAuthKey ( $authKey ) | ||
$authKey |