本文整理匯總了PHP中Library\Utility\Helper::bCryptVerifyPassword方法的典型用法代碼示例。如果您正苦於以下問題:PHP Helper::bCryptVerifyPassword方法的具體用法?PHP Helper::bCryptVerifyPassword怎麽用?PHP Helper::bCryptVerifyPassword使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Library\Utility\Helper
的用法示例。
在下文中一共展示了Helper::bCryptVerifyPassword方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: ajaxChangePasswordAction
public function ajaxChangePasswordAction()
{
/**
* @var UserManager $rUserDao
* @var \DDD\Domain\User\User $rUser
*/
$request = $this->getRequest();
$result = ['status' => 'success', 'msg' => TextConstants::SUCCESS_UPDATE];
try {
if ($request->isXmlHttpRequest()) {
$form = new ProfilePasswordForm('changePassword');
$messages = '';
$data = $request->getPost();
$form->setInputFilter(new ProfilePasswordFilter());
if ($request->isPost()) {
/**
* @var \DDD\Service\User $userService
*/
$userService = $this->getServiceLocator()->get('service_user');
$filter = $form->getInputFilter();
$form->setInputFilter($filter);
$rUserDao = $this->getServiceLocator()->get('dao_user_user_manager');
$rUser = $rUserDao->findUserById((int) $data['userId']);
if (!Helper::bCryptVerifyPassword($data['currentPassword'], $rUser->getPassword())) {
return new JsonModel(['status' => 'error', 'msg' => 'Current password is wrong.']);
}
$form->setData($data);
if ($form->isValid()) {
$userService->changePassword($data);
Helper::setFlashMessage(['success' => TextConstants::SUCCESS_UPDATE]);
} else {
$errors = $form->getMessages();
foreach ($errors as $key => $row) {
if (!empty($row)) {
$messages .= ucfirst($key) . ' ';
$messages_sub = '';
foreach ($row as $keyer => $rower) {
$messages_sub .= $rower;
}
$messages .= $messages_sub . '<br>';
}
}
$result['status'] = 'error';
$result['msg'] = $messages;
}
}
}
} catch (\Exception $e) {
echo $e->getMessage();
$result['status'] = 'error';
$result['msg'] = TextConstants::SERVER_ERROR;
}
return new JsonModel($result);
}