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


PHP User::generateAuthKey方法代码示例

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


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

示例1: reg

 public function reg()
 {
     $user = new User();
     $user->username = $this->username;
     $user->email = $this->email;
     $user->status = $this->status;
     $user->setPassword($this->password);
     $user->generateAuthKey();
     return $user->save() ? $user : null;
 }
开发者ID:GalkinDmitriy,项目名称:evalotta,代码行数:10,代码来源:RegForm.php

示例2: actionCreate

 /**
  * 创建用户
  *
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new User();
     if ($model->load(Yii::$app->request->post())) {
         $model->setPassword('123456');
         $model->generateAuthKey();
         //$model->signup();
         $ret = $model->save();
         if ($ret) {
             return $this->redirect(['index']);
         }
     }
     return $this->render('create', ['model' => $model]);
 }
开发者ID:xishuophp,项目名称:vipoa,代码行数:19,代码来源:UserController.php

示例3: signup

 /**
  * Signs user up.
  *
  * @return User|null the saved model or null if saving fails
  */
 public function signup()
 {
     if ($this->validate()) {
         $user = new User();
         $user->username = $this->username;
         $user->email = $this->email;
         $user->setPassword($this->password);
         $user->generateAuthKey();
         if ($user->save()) {
             return $user;
         }
     }
     return null;
 }
开发者ID:xishuophp,项目名称:vipoa,代码行数:19,代码来源:SignupForm.php

示例4: create

 /**
  * function ::create ($data)
  */
 public static function create($data)
 {
     $now = strtotime('now');
     $username = Yii::$app->user->identity->username;
     $model = new User();
     if ($model->load($data)) {
         if ($log = new UserLog()) {
             $log->username = $username;
             $log->action = "Create";
             $log->object_class = "User";
             $log->created_at = $now;
             $log->is_success = 0;
             $log->save();
         }
         $model->created_at = $now;
         $model->dob = strtotime($model->dob);
         do {
             $path = FileUtils::generatePath($now);
         } while (file_exists(Yii::$app->params['images_folder'] . $path));
         $model->image_path = $path;
         $targetFolder = Yii::$app->params['images_folder'] . $model->image_path;
         $targetUrl = Yii::$app->params['images_url'] . $model->image_path;
         if (!empty($data['user-image'])) {
             $copyResult = FileUtils::copyImage(['imageName' => $model->image, 'fromFolder' => Yii::$app->params['uploads_folder'], 'toFolder' => $targetFolder, 'resize' => [[120, 120], [200, 200]], 'resizeType' => 2, 'removeInputImage' => true]);
             if ($copyResult['success']) {
                 $model->image = $copyResult['imageName'];
             }
         }
         // User class
         $model->generateAuthKey();
         $model->setPassword($model->password);
         if ($model->save()) {
             if ($log) {
                 $log->object_pk = $model->id;
                 $log->is_success = 1;
                 $log->save();
             }
             return $model;
         }
         $model->getErrors();
         return $model;
     }
     return false;
 }
开发者ID:quyettvq,项目名称:luspel,代码行数:47,代码来源:User.php


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