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


PHP Users::setPassword方法代码示例

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


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

示例1: actionCreate

 /**
  * Creates a new Users model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Users();
     $model->setScenario('register');
     $post = Yii::$app->request->post();
     $formName = basename($model->className());
     if ($model->load($post)) {
         // Default value
         $model->is_super_admin = isset($post[$formName]['is_super_admin']) ? $post[$formName]['is_super_admin'] : 0;
         $model->role = $model->is_super_admin ? Identity::ROLE_SUPERADMIN : 30;
         $model->fecha_conexion = isset($post[$formName]['fecha_conexion']) ? $post[$formName]['fecha_conexion'] : Yii::$app->fn->GetDate('none');
         $model->fecha_modif = isset($post[$formName]['fecha_modif']) ? $post[$formName]['fecha_modif'] : Yii::$app->fn->GetDate('none');
         $model->fecha_registro = isset($post[$formName]['fecha_registro']) ? $post[$formName]['fecha_registro'] : Yii::$app->fn->GetDate();
         $model->id_estado = isset($post[$formName]['id_estado']) ? $post[$formName]['id_estado'] : 1;
         if ($model->validate()) {
             $model->setPassword();
             $model->generateAuthKey();
             if ($model->save()) {
                 return $this->redirect(['view', 'id' => $model->id]);
             }
         }
     }
     // Load empty/error form
     return $this->render('create', ['model' => $model]);
 }
开发者ID:juanchi008,项目名称:playa_auto,代码行数:30,代码来源:UsersController.php

示例2: registerAction

 public function registerAction()
 {
     try {
         $form = new \RegisterForm();
         if ($this->request->isPost()) {
             $email = $this->request->getPost('email', 'email');
             $password = $this->request->getPost('password');
             $repeatPassword = $this->request->getPost('repeatPassword');
             $user = new Users();
             $user->setPassword($password, $repeatPassword);
             $user->email = $email;
             $user->created_at = new \Phalcon\Db\RawValue('now()');
             $user->user_name = $this->request->getPost('name', ['string', 'striptags']);
             $user->nickname = $this->request->getPost('nickname', 'string');
             if ($user->save() == false) {
                 foreach ($user->getMessages() as $message) {
                     $this->flash->error((string) $message);
                 }
             } else {
                 $this->tag->setDefault('email', '');
                 $this->tag->setDefault('password', '');
                 $this->auth->login($user->toArray());
                 $user->sendEmailAfterReg();
                 return $this->goToMain();
             }
         }
     } catch (\Exception $e) {
         $this->flash->error($e->getMessage());
     }
     $this->view->form = $form;
 }
开发者ID:kofeinstyle,项目名称:coc,代码行数:31,代码来源:UserController.php

示例3: reg

 public function reg()
 {
     $user = new Users();
     $user->username = $this->username;
     $user->setPassword($this->password);
     $user->generateAuthKey();
     $user->save();
     return $user;
 }
开发者ID:eropkinvitaliy,项目名称:tech-admin,代码行数:9,代码来源:RegForm.php

示例4: beforeSave

 public function beforeSave($insert)
 {
     if (parent::beforeSave($insert)) {
         $adminUserModel = new Users();
         $adminUserModel->setPassword($this->password_hash);
         //print_r($adminUserModel->password_hash);exit();
         $this->password_hash = $adminUserModel->password_hash;
         return true;
     } else {
         return false;
     }
 }
开发者ID:ewwgit,项目名称:eptri,代码行数:12,代码来源:AdminMaster.php

示例5: signup

 public function signup()
 {
     if ($this->validate()) {
         $users = new Users();
         $users->name = $this->name;
         $users->email = $this->email;
         $users->status = $this->status;
         $users->setPassword($this->password);
         $users->generateAuthKey();
         return $users->save() ? $users : null;
     }
     return null;
 }
开发者ID:shapik2004,项目名称:artem,代码行数:13,代码来源:UserForm.php

示例6: reg

 public function reg()
 {
     $user = new Users();
     $user->family = $this->family;
     $user->name = $this->name;
     $user->father = $this->father;
     $user->login = $this->login;
     $user->setPassword($this->password);
     $user->email = $this->email;
     $user->phone = $this->phone;
     //$user->generateAuthKey();
     return $user->save() ? $user : null;
 }
开发者ID:pozdny,项目名称:hunter.dev,代码行数:13,代码来源:RegForm.php


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