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


PHP Model_User::get_password_validation方法代码示例

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


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

示例1: init

 protected function init()
 {
     $this->add_plugin(new CM_Form_Plugin_ORM(array('password'), array(), Model_User::get_password_validation()));
     $this->set_field('old_password', new CM_Field_Password(), 10);
     $this->get_field('old_password')->set_label('Старый пароль');
     $this->set_field('password', new CM_Field_Password(), 20);
     $this->set_field('password_confirm', new CM_Field_Password(), 30);
 }
开发者ID:ariol,项目名称:adminshop,代码行数:8,代码来源:ChangePassword.php

示例2: construct_form

 protected function construct_form($param)
 {
     if (!$param->loaded()) {
         $this->set_field('password', new CM_Field_Password(), 20);
         $this->set_field('password_confirm', new CM_Field_Password(), 30);
         $this->add_plugin(new CM_Form_Plugin_Validate(Model_User::get_password_validation()));
         $this->get_renderer()->set_field_fieldgroup('password', 'Общее');
         $this->get_renderer()->set_field_fieldgroup('password_confirm', 'Общее');
     }
 }
开发者ID:ariol,项目名称:adminshop,代码行数:10,代码来源:User.php

示例3: update_user

 /**
  * Update an existing user
  *
  * [!!] We make the assumption that if a user does not supply a password, that they do not wish to update their password.
  *
  * Example usage:
  * ~~~
  * $user = ORM::factory('user')
  *	->where('username', '=', 'kiall')
  *	->find()
  *	->update_user($_POST, array(
  *		'username',
  *		'password',
  *		'email',
  *	);
  * ~~~
  *
  * @param array $values
  * @param array $expected
  * @throws ORM_Validation_Exception
  */
 public function update_user($values, $expected = NULL)
 {
     if (empty($values['password'])) {
         unset($values['password'], $values['password_confirm']);
     }
     // Validation for passwords
     $extra_validation = Model_User::get_password_validation($values);
     return $this->values($values, $expected)->update($extra_validation);
 }
开发者ID:Wildboard,项目名称:WbWebApp,代码行数:30,代码来源:user.php

示例4: action_confirmed_restore

 /**
  * Confirmed password change
  */
 public function action_confirmed_restore()
 {
     $this->title = __('user.password_change');
     $token = $this->request->param('token');
     if ($token === null) {
         HTTP::redirect(Route::url('f_auth', ['action' => 'login']));
     }
     $o_confirm = ORM::factory('User_Confirm', ['token' => $token, 'type' => Model_User_Confirm::TYPE_RESTORE]);
     if (!$o_confirm->loaded()) {
         HTTP::redirect(Route::url('f_auth', ['action' => 'login']));
     }
     if (!$o_confirm->user->confirmed) {
         Message::warning(__('user.email_сheck_and_confirm', [':email' => $this->user->email]));
         HTTP::redirect(Route::url('f_auth', ['action' => 'login']));
     }
     // If current time > time recovery password
     if (time() > $o_confirm->expires) {
         $o_confirm->delete();
         Message::error(__('user.error_time_confirm_password_expired'));
         HTTP::redirect(Route::url('f_auth', ['action' => 'login']));
     }
     if ($this->request->is_post()) {
         $o_validation = Model_User::get_password_validation($_POST)->rule('password', 'not_empty')->rule('password_confirm', 'not_empty')->labels(['password' => __('user.password_new'), 'password_confirm' => __('user.password_confirm')]);
         if ($o_validation->check()) {
             $o_confirm->user->password = $o_validation['password'];
             $o_confirm->user->save();
             $this->auth->force_login($o_confirm->user->username);
             $o_confirm->delete();
             Message::success(__('user.password_changed'));
             HTTP::redirect(Route::url('f_user_profile', ['action' => 'view']));
         } else {
             Message::error(__('settings.error_saving'));
             $errors = $o_validation->errors('validation');
         }
     }
     $this->content = View::factory('auth/frontend/v_confirmed_restore')->bind('errors', $errors);
 }
开发者ID:eok8177,项目名称:shopCMS,代码行数:40,代码来源:Auth.php

示例5: update_password

 /**
  * Update user password
  *
  * @param      $values
  * @param null $expected
  *
  * @return ORM
  */
 public function update_password($values, $expected = null)
 {
     // Validation for passwords
     $extra_validation = Model_User::get_password_validation($values)->rule('password_current', 'not_empty')->rule('password_current', array(Auth::instance(), 'check_password'))->rule('password', 'not_empty')->rule('password_confirm', 'not_empty')->labels(array('password_current' => __('user.password_current'), 'password' => __('user.password_new'), 'password_confirm' => __('user.password_confirm')));
     return $this->values($values, $expected)->update($extra_validation);
 }
开发者ID:eok8177,项目名称:shopCMS,代码行数:14,代码来源:User.php


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