本文整理汇总了PHP中VBX_User::salt_encrypt方法的典型用法代码示例。如果您正苦于以下问题:PHP VBX_User::salt_encrypt方法的具体用法?PHP VBX_User::salt_encrypt怎么用?PHP VBX_User::salt_encrypt使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类VBX_User
的用法示例。
在下文中一共展示了VBX_User::salt_encrypt方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: validate_returning_user
/**
* Validate the user's signature & state
* State is generated in the welcome controller and passed through the oauth process
*
* @todo process $state passed back through the oauth process
*
* @param int $user_id
* @return mixed VBX_User or false
*/
protected function validate_returning_user($user_id)
{
// jump through hoops to get around the Tenantization
$userdata = $this->db->get_where('users', array('id' => $user_id))->result();
if (!empty($userdata[0])) {
$user = new VBX_User($userdata[0]);
$list = implode(',', array($user->id, $user->password, $user->tenant_id, $user->is_admin));
$expected_signature = VBX_User::salt_encrypt($list);
$actual_signature = $this->session->userdata('signature');
if ($expected_signature == $actual_signature) {
return $user;
} else {
return false;
}
}
}
示例2: setup_user
private function setup_user($user)
{
$this->load->database();
$this->config->load('openvbx');
$this->load->model('vbx_user');
$admin = new VBX_User();
$admin->email = $user['email'];
$admin->password = VBX_User::salt_encrypt($user['password']);
$admin->first_name = $user['firstname'];
$admin->last_name = $user['lastname'];
$admin->tenant_id = $user['tenant_id'];
$admin->is_admin = true;
$admin->voicemail = 'Please leave a message after the beep.';
try {
$admin->save();
} catch (Exception $e) {
throw new InstallException($e->getMessage(), 4);
}
}
示例3: password
public function password()
{
if (!$this->session->userdata('loggedin')) {
redirect('auth/login');
}
$user = VBX_user::get(array('id' => $this->user_id));
$old_pw = $this->input->post('old_pw');
$new_pw = $this->input->post('new_pw1');
$new_pw2 = $this->input->post('new_pw2');
$this->data['error'] = false;
$message = '';
if ($user->password != VBX_User::salt_encrypt($old_pw)) {
$this->data['error'] = true;
$message = 'Password incorrect';
} else {
if ($new_pw != $new_pw2) {
$this->data['error'] = true;
$message = 'Password mismatch';
} else {
$user->password = VBX_User::salt_encrypt($new_pw);
try {
$user->save();
$message = 'Password changed';
$this->session->set_userdata('signature', VBX_User::signature($user->id));
} catch (VBX_UserException $e) {
$this->data['error'] = true;
$message = 'Unable to set password, please try again later.';
error_log($e->getMessage());
}
}
}
$this->data['message'] = $message;
echo json_encode($this->data);
}