当前位置: 首页>>代码示例>>PHP>>正文


PHP User::className方法代码示例

本文整理汇总了PHP中app\modules\user\models\User::className方法的典型用法代码示例。如果您正苦于以下问题:PHP User::className方法的具体用法?PHP User::className怎么用?PHP User::className使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\modules\user\models\User的用法示例。


在下文中一共展示了User::className方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testSignup

 public function testSignup(FunctionalTester $I)
 {
     $I->wantTo('ensure that signup works');
     $signupPage = SignupPage::openBy($I);
     $I->seeInTitle('Signup');
     $I->see('Please fill out the following fields to signup:');
     $I->amGoingTo('submit signup form with no data');
     $signupPage->submit([]);
     $I->expectTo('see validation errors');
     $I->see('Username cannot be blank.', '.help-block');
     $I->see('Email cannot be blank.', '.help-block');
     $I->see('Password cannot be blank.', '.help-block');
     $I->see('The verification code is incorrect.', '.help-block');
     $I->amGoingTo('submit signup form with not correct data');
     $signupPage->submit(['username' => 'tester', 'email' => 'tester.email', 'password' => 'tester_password', 'verifyCode' => 'wrong']);
     $I->expectTo('see that email address is wrong');
     $I->dontSee('Username cannot be blank.', '.help-block');
     $I->dontSee('Password cannot be blank.', '.help-block');
     $I->see('Email is not a valid email address.', '.help-block');
     $I->see('The verification code is incorrect.', '.help-block');
     $I->amGoingTo('submit signup form with correct data');
     $signupPage->submit(['username' => 'tester', 'email' => 'tester.email@example.com', 'password' => 'tester_password', 'verifyCode' => 'testme']);
     $I->expectTo('see that user is created');
     $I->seeRecord(User::className(), ['username' => 'tester', 'email' => 'tester.email@example.com', 'status' => User::STATUS_WAIT]);
     $I->expectTo('see that user signed in');
     $I->see('Please confirm your Email.', '.alert-success');
     $I->amGoingTo('confirm user email by token');
     /** @var User $user */
     $user = $I->grabRecord(User::className(), ['username' => 'tester']);
     EmailConfirmPage::openBy($I, ['token' => $user->email_confirm_token]);
     $I->expectTo('see that email is confirmed');
     $I->see('Thanks! Your Email is confirmed.', '.alert-success');
     $I->expectTo('see that user status is confirmed');
     $I->seeRecord(User::className(), ['username' => 'tester', 'email' => 'tester.email@example.com', 'status' => User::STATUS_ACTIVE, 'email_confirm_token' => null]);
 }
开发者ID:manakao,项目名称:melby,代码行数:35,代码来源:SignupCest.php

示例2: testPasswordReset

 /**
  * @after logout
  */
 public function testPasswordReset(FunctionalTester $I)
 {
     $I->wantTo('ensure that login works');
     $requestPage = PasswordResetRequestPage::openBy($I);
     $I->seeInTitle('Reset password');
     $I->amGoingTo('try to request with empty credentials');
     $requestPage->send('');
     $I->expectTo('see validations errors');
     $I->see('Email cannot be blank.');
     $I->amGoingTo('try to request with wrong credentials');
     $requestPage->send('reset-example.com');
     $I->expectTo('see validations errors');
     $I->see('Email is not a valid email address.');
     $I->amGoingTo('try to request with correct credentials');
     $requestPage->send('reset@example.com');
     $I->expectTo('see user info');
     $I->see('Follow the link on mail to reset your password.', '.alert-success');
     $I->amGoingTo('open change password page by token');
     /** @var User $user */
     $user = $I->grabRecord(User::className(), ['email' => 'reset@example.com']);
     $resetPage = PasswordResetPage::openBy($I, ['token' => $user->password_reset_token]);
     $I->expectTo('see change password form');
     $I->see('Please choose your new password:');
     $I->amGoingTo('set new password');
     $resetPage->send('new-password');
     $I->expectTo('see password change success message');
     $I->see('Thanks! Your passwords is changed.');
     $I->amGoingTo('try to login with new credentials');
     $this->login($I, 'reset', 'new-password');
     $I->expectTo('see user info');
     $I->see('Profile');
 }
开发者ID:manakao,项目名称:melby,代码行数:35,代码来源:PasswordResetCest.php

示例3: getManagersList

 protected function getManagersList()
 {
     $managers = Yii::$app->cache->get('ManagersList');
     if ($managers === false) {
         $managers = User::find()->join('INNER JOIN', '{{%auth_assignment}}', '{{%auth_assignment}}.user_id = ' . User::tableName() . '.id')->where(['{{%auth_assignment}}.item_name' => 'manager'])->all();
         $managers = ArrayHelper::map($managers, 'id', 'username');
         Yii::$app->cache->set('ManagersList', $managers, 86400, new TagDependency(['tags' => [\devgroup\TagDependencyHelper\ActiveRecordHelper::getCommonTag(User::className())]]));
     }
     return $managers;
 }
开发者ID:Razzwan,项目名称:dotplant2,代码行数:10,代码来源:BackendOrderController.php

示例4: testCorrectSignup

 public function testCorrectSignup()
 {
     $model = new SignupForm(['username' => 'some_username', 'email' => 'some_email@example.com', 'password' => 'some_password', 'verifyCode' => 'testme']);
     $user = $model->signup();
     $this->assertInstanceOf(User::className(), $user, 'user should be valid');
     expect('username should be correct', $user->username)->equals('some_username');
     expect('email should be correct', $user->email)->equals('some_email@example.com');
     expect('password should be correct', $user->validatePassword('some_password'))->true();
     expect('email file should exist', file_exists($this->getMessageFile()))->true();
     $emailMessage = str_replace("=\r\n", '', file_get_contents($this->getMessageFile()));
     expect('email should contain confirmation token', $emailMessage)->contains($user->email_confirm_token);
 }
开发者ID:cleverid,项目名称:seokeys,代码行数:12,代码来源:SignupFormTest.php

示例5: register

 /**
  * Registers a new user account.
  * @return bool
  */
 public function register()
 {
     if (!$this->validate()) {
         return false;
     }
     /** @var User $user */
     $user = \Yii::createObject(User::className());
     $user->setScenario('register');
     $this->loadAttributes($user);
     if (!$user->register()) {
         return false;
     }
     \Yii::$app->session->setFlash('info', \Yii::t('user', 'Your account has been created and a message with further instructions has been sent to your email'));
     return true;
 }
开发者ID:kd-brinex,项目名称:kd,代码行数:19,代码来源:RegistrationForm.php

示例6: actions

 /**
  * @inheritdoc
  */
 public function actions()
 {
     return ['index' => ['class' => Actions\IndexAction::className(), 'modelClass' => UserSearch::className(), 'roleArray' => function () {
         return User::roles();
     }, 'statusArray' => function () {
         return User::statusLabels();
     }], 'create' => ['class' => Actions\CreateAction::className(), 'modelClass' => User::className(), 'profileClass' => UserProfile::className(), 'scenario' => 'admin-create', 'roleArray' => function () {
         return User::roles();
     }, 'statusArray' => function () {
         return User::statusLabels();
     }], 'update' => ['class' => Actions\UpdateAction::className(), 'modelClass' => User::className(), 'scenario' => 'admin-update', 'profileRelation' => 'profile', 'roleArray' => function () {
         return User::roles();
     }, 'statusArray' => function () {
         return User::statusLabels();
     }], 'delete' => ['class' => Actions\DeleteAction::className(), 'modelClass' => User::className(), 'redirectRoute' => 'index'], 'batch-delete' => ['class' => Actions\BatchDeleteAction::className(), 'modelClass' => User::className(), 'redirectRoute' => 'index']];
 }
开发者ID:artkost,项目名称:yii2-starter-kit,代码行数:19,代码来源:PeopleController.php

示例7: rules

 /**
  * @inheritdoc
  */
 public function rules()
 {
     return [['email', 'filter', 'filter' => 'trim'], ['email', 'required'], ['email', 'email'], ['email', 'exist', 'targetClass' => User::className(), 'filter' => ['status' => User::STATUS_ACTIVE], 'message' => Yii::t('app', 'There is no user with such email.')]];
 }
开发者ID:tqsq2005,项目名称:dotplant2,代码行数:7,代码来源:PasswordResetRequestForm.php

示例8: rules

 /**
  * @return array
  */
 public function rules()
 {
     return [[['username', 'password', 'email'], 'required'], ['email', 'email'], ['username', 'filter', 'filter' => 'trim'], ['username', 'match', 'pattern' => '#^[\\w_-]+$#i'], ['username', 'string', 'min' => 4, 'max' => 50], ['email', 'string', 'min' => 4, 'max' => 50], ['password', 'string', 'min' => 6], [['email_repeat'], 'compare', 'compareAttribute' => 'email', 'message' => Module::t('app', 'SIGNUP_RULES_EMAILS_COMPARE')], [['password_repeat'], 'compare', 'compareAttribute' => 'password', 'message' => Module::t('app', 'SIGNUP_RULES_PASSWORDS_COMPARE')], ['username', 'unique', 'targetClass' => User::className(), 'message' => Module::t('app', 'MODEL_USER_RULES_USERNAME_EXISTS')], ['email', 'unique', 'targetClass' => User::className(), 'message' => Module::t('app', 'MODEL_USER_RULES_EMAIL_EXISTS')]];
 }
开发者ID:knyazushka,项目名称:z34lot.new,代码行数:7,代码来源:SignupForm.php

示例9: rules

 /**
  * @inheritdoc
  */
 public function rules()
 {
     return [['token', 'required'], ['token', 'trim'], ['token', 'string', 'max' => 53], ['token', 'exist', 'targetClass' => User::className(), 'filter' => function ($query) {
         $query->inactive();
     }]];
 }
开发者ID:artkost,项目名称:yii2-starter-kit,代码行数:9,代码来源:Activation.php

示例10: rules

 /**
  * @inheritdoc
  */
 public function rules()
 {
     return [[['user_id'], 'integer'], [['user_id'], 'unique'], [['user_id'], 'exist', 'skipOnError' => true, 'targetClass' => User::className(), 'targetAttribute' => ['user_id' => 'id']], [['avatar', 'name', 'surname'], 'string', 'max' => 35]];
 }
开发者ID:Dominus77,项目名称:blog,代码行数:7,代码来源:UserProfile.php

示例11: rules

 /**
  * @inheritdoc
  */
 public function rules()
 {
     return [['username', 'filter', 'filter' => 'trim'], ['username', 'required'], ['username', 'match', 'pattern' => '#^[\\w_-]+$#i'], ['username', 'unique', 'targetClass' => User::className(), 'message' => 'Это имя пользователя уже занято.'], ['username', 'string', 'min' => 2, 'max' => 255], ['email', 'filter', 'filter' => 'trim'], ['email', 'required'], ['email', 'email'], ['email', 'unique', 'targetClass' => User::className(), 'message' => 'Этот адрес почты уже занят.'], ['password', 'required'], ['password', 'string', 'min' => 6], ['verifyCode', 'captcha', 'captchaAction' => '/user/default/captcha']];
 }
开发者ID:goncharovln,项目名称:keywords,代码行数:7,代码来源:SignupForm.php

示例12: rules

 /**
  * @inheritdoc
  */
 public function rules()
 {
     return [['email', 'filter', 'filter' => 'trim'], ['email', 'required'], ['email', 'email'], ['email', 'exist', 'targetClass' => User::className(), 'filter' => ['status' => User::STATUS_ACTIVE], 'message' => Module::t('module', 'ERROR_USER_NOT_FOUND_BY_EMAIL')], ['email', 'validateIsSent']];
 }
开发者ID:Dominus77,项目名称:blog,代码行数:7,代码来源:PasswordResetRequestForm.php

示例13: rules

 public function rules()
 {
     return [['username', 'filter', 'filter' => 'trim'], ['username', 'required'], ['username', 'unique', 'targetClass' => User::className(), 'message' => Module::t('module', 'ERROR_USERNAME_EXISTS')], ['username', 'string', 'min' => 2, 'max' => 255], ['login', 'filter', 'filter' => 'trim'], ['login', 'required'], ['login', 'match', 'pattern' => '#^[\\w_-]+$#i'], ['login', 'string', 'min' => 2, 'max' => 255], ['login', 'unique', 'targetClass' => User::className(), 'message' => Module::t('module', 'ERROR_LOGIN_EXISTS')], ['email', 'filter', 'filter' => 'trim'], ['email', 'required'], ['email', 'email'], ['email', 'unique', 'targetClass' => User::className(), 'message' => Module::t('module', 'ERROR_EMAIL_EXISTS')], [['password', 're_password'], 'required'], ['password', 'string', 'min' => 6], ['re_password', 'compare', 'compareAttribute' => 'password']];
 }
开发者ID:MaratCrash,项目名称:3dligatest,代码行数:4,代码来源:SignupForm.php

示例14: install

 public function install()
 {
     \app\config\ConfigManager::set(['components', 'user', 'identityClass'], User::className());
 }
开发者ID:bariew,项目名称:sitown,代码行数:4,代码来源:Module.php

示例15: rules

 public function rules()
 {
     return [['email', 'required'], ['email', 'email'], ['email', 'unique', 'targetClass' => User::className(), 'message' => Module::t('module', 'ERROR_EMAIL_EXISTS'), 'filter' => function (ActiveQuery $query) {
         $query->andWhere(['<>', 'id', $this->_user->id]);
     }], ['email', 'string', 'max' => 255]];
 }
开发者ID:cleverid,项目名称:seokeys,代码行数:6,代码来源:ProfileUpdateForm.php


注:本文中的app\modules\user\models\User::className方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。