src/apis/UserController.php
public function actionSessionUpdate()
    {
        $identity = Yii::$app->adminuser->identity;
        $user = clone Yii::$app->adminuser->identity;
        $user->attributes = Yii::$app->request->bodyParams;
        $verify = ['title', 'firstname', 'lastname', 'id'];
        
        // check if email has changed, if yes send secure token and temp store new value in user settings table.
        if ($user->validate(['email']) && $user->email !== $identity->email && $this->module->emailVerification) {
            $token = $user->getAndStoreEmailVerificationToken();
            
            $mail = Yii::$app->mail->compose(Module::t('account_changeemail_subject'), Module::t('account_changeemail_body', ['url' => Url::base(true), 'token' => $token]))
            ->address($identity->email, $identity->firstname . ' '. $identity->lastname)
            ->send();
            
            if ($mail) {
                $identity->setting->set(User::USER_SETTING_NEWUSEREMAIL, $user->email);
            } else {
                $user->addError('email', Module::t('account_changeemail_tokensenterror', ['email' => $identity->email]));
                $identity->resetEmailVerification();
            }
        }
        
        if (!$this->module->emailVerification) {
            $verify[] = 'email';
        }
        
        if (!$user->hasErrors() && $user->update(true, $verify) !== false) {
            return $user;
        }
        
        return $this->sendModelError($user);
    }
public function actionSessionUpdate()
    {
        $identity = Yii::$app->adminuser->identity;
        $user = clone Yii::$app->adminuser->identity;
        $user->attributes = Yii::$app->request->bodyParams;
        $verify = ['title', 'firstname', 'lastname', 'id'];
        
        // check if email has changed, if yes send secure token and temp store new value in user settings table.
        if ($user->validate(['email']) && $user->email !== $identity->email && $this->module->emailVerification) {
            $token = $user->getAndStoreEmailVerificationToken();
            
            $mail = Yii::$app->mail->compose(Module::t('account_changeemail_subject'), Module::t('account_changeemail_body', ['url' => Url::base(true), 'token' => $token]))
            ->address($identity->email, $identity->firstname . ' '. $identity->lastname)
            ->send();
            
            if ($mail) {
                $identity->setting->set(User::USER_SETTING_NEWUSEREMAIL, $user->email);
            } else {
                $user->addError('email', Module::t('account_changeemail_tokensenterror', ['email' => $identity->email]));
                $identity->resetEmailVerification();
            }
        }
        
        if (!$this->module->emailVerification) {
            $verify[] = 'email';
        }
        
        if (!$user->hasErrors() && $user->update(true, $verify) !== false) {
            return $user;
        }
        
        return $this->sendModelError($user);
    }
public function actionSessionUpdate ( ) { $ identity = Yii :: $ app -> adminuser -> identity ; $ user = clone Yii :: $ app -> adminuser -> identity ; $ user -> attributes = Yii :: $ app -> request -> bodyParams ; $ verify = [ 'title' , 'firstname' , 'lastname' , 'id' ] ; // check if email has changed, if yes send secure token and temp store new value in user settings table. if ( $ user -> validate ( [ 'email' ] ) && $ user -> email !== $ identity -> email && $ this -> module -> emailVerification ) { $ token = $ user -> getAndStoreEmailVerificationToken ( ) ; $ mail = Yii :: $ app -> mail -> compose ( Module :: t ( 'account_changeemail_subject' ) , Module :: t ( 'account_changeemail_body' , [ 'url' => Url :: base ( true ) , 'token' => $ token ] ) ) -> address ( $ identity -> email , $ identity -> firstname . ' ' . $ identity -> lastname ) -> send ( ) ; if ( $ mail ) { $ identity -> setting -> set ( User :: USER_SETTING_NEWUSEREMAIL , $ user -> email ) ; } else { $ user -> addError ( 'email' , Module :: t ( 'account_changeemail_tokensenterror' , [ 'email' => $ identity -> email ] ) ) ; $ identity -> resetEmailVerification ( ) ; } } if ( ! $ this -> module -> emailVerification ) { $ verify [ ] = 'email' ; } if ( ! $ user -> hasErrors ( ) && $ user -> update ( true , $ verify ) !== false ) { return $ user ; } return $ this -> sendModelError ( $ user ) ; }
Update data for the current session user.

@return array
Update data for the current session user .