作者:stevebauma
项目:quickly-share-i
/**
* Unlocks a batch by checking the specified
* password against the batch password.
*
* @param BatchUnlockRequest $request
*
* @return bool
*/
public function unlock(BatchUnlockRequest $request)
{
$hasher = new BcryptHasher();
if ($hasher->check($request->input('password'), $this->password)) {
// Store the UUID in the users session so they can have
// access to it for as long as the session exists
$request->session()->put($this->uuid, $this->uuid);
return true;
}
return false;
}
作者:satriash
项目:tou
/**
* Set the default password work factor.
*
* @param int $rounds
* @return $this
* @static
*/
public static function setRounds($rounds)
{
return \Illuminate\Hashing\BcryptHasher::setRounds($rounds);
}
作者:nmk
项目:basic-starte
/**
* Check if the given hash has been hashed using the given options.
*
* @param string $hashedValue
* @param array $options
* @return bool
* @static
*/
public static function needsRehash($hashedValue, $options = array())
{
return \Illuminate\Hashing\BcryptHasher::needsRehash($hashedValue, $options);
}
作者:stevebauma
项目:ithu
/**
* Checks the specified pin against the current password folder pin.
*
* @param string $pin
*
* @return bool
*/
public function checkPin($pin)
{
$hasher = new BcryptHasher();
return $hasher->check($pin, $this->pin);
}
作者:lakedawso
项目:voca
/**
* Hash any hashable attributes
*
* @return null
*/
private function hashHashable()
{
$hasher = new BcryptHasher();
$filtered = array_filter($this->attributes);
foreach ($filtered as $key => $value) {
if (in_array($key, $this->hashable) && $value != $this->getOriginal($key)) {
$this->attributes[$key] = $hasher->make($value);
}
}
}
作者:brunomartins-co
项目:espacofarmaceutic
public function getAuthPassword()
{
$hasher = new BcryptHasher();
return $hasher->make($this->password);
}
作者:Jv-Juve
项目:carServic
public function changePassword()
{
$adminId = Input::get("adminId");
$username = Input::get("username");
$oldPassword = Input::get("oldPassword");
$newPassword = Input::get("newPassword");
$newPasswordConfirm = Input::get("newPasswordConfirm");
$hasher = new BcryptHasher();
if (Auth::attempt(array('username' => $username, 'password' => $oldPassword))) {
$result = Admin::where("admin_id", "=", $adminId)->update(["password" => $hasher->make($newPassword)]);
if ($result == 0) {
return Response::json(array('errCode' => 1, 'errMsg' => "[修改失败]数据库错误"));
}
} else {
return Response::json(array('errCode' => 1, 'errMsg' => "[修改失败]原密码错误"));
}
return Response::json(array('errCode' => 0));
}
作者:Adamzynon
项目:mybb
/**
* @param Request $request
* @param BcryptHasher $hasher
*
* @return \Illuminate\Http\RedirectResponse
*/
public function postPassword(Request $request, BcryptHasher $hasher)
{
$this->failedValidationRedirect = route('account.password');
$this->validate($request, ['password1' => 'required|min:6', 'password' => 'required']);
if ($this->guard->getProvider()->validateCredentials($this->guard->user(), $request->only('password'))) {
// Don't save the password in plaintext!
ConfirmationManager::send('password', $this->guard->user(), 'account.password.confirm', $hasher->make($request->get('password1')));
return redirect()->route('account.profile')->withSuccess(trans('account.confirm'));
}
return redirect()->route('account.password')->withInput($request->only('password1'))->withErrors(['password1' => trans('member.invalidCredentials')]);
}
作者:iwillhappy131
项目:laravel-admi
/**
* @param $value
* @return bool
*/
public function check($value)
{
$store = $this->session->get('captcha');
if ($this->sensitive) {
$value = $this->str->lower($value);
$store = $this->str->lower($store);
}
return $this->hasher->check($value, $store);
}
作者:lihuibi
项目:notejam_blin
public function updateSettings(Request $request, Hash $hash)
{
$user = $request->user();
$rules = ['old_password' => 'required|min:8', 'password' => 'required|confirmed|min:8'];
$validator = app('validation')->make($request->all(), $rules);
if ($validator->fails()) {
$request->session->add(['errors' => $validator->errors()->all()]);
return app('twig')->render('user/settings.htm', ['oldInputs' => $request->all()]);
}
if (!$hash->check($request->input('old_password'), $user->password)) {
$request->session->add(['errors' => ['Old password incorrect.']]);
return app('twig')->render('user/settings.htm', ['oldInputs' => $request->all()]);
}
$user->password = $hash->make($request->input('old_password'));
$user->save();
$request->session->add(['success' => 'settings updated successfuly.']);
return app('twig')->render('user/settings.htm');
}
作者:voton
项目:captch
/**
*
* @param $value
* @return bool
*/
public function check($value)
{
$store = $this->session->get('captcha' . (Input::has('captcha_id') ? '_' . Input::get('captcha_id') : ''));
if ($this->sensitive) {
$value = $this->str->lower($value);
$store = $this->str->lower($store);
}
return $this->hasher->check($value, $store);
}
作者:diandianxiy
项目:ApiTestin
/**
* Captcha check
*
* @param $value
* @return bool
*/
public function check($value)
{
if (!$this->session->has('captcha')) {
return false;
}
$key = $this->session->get('captcha.key');
if (!$this->session->get('captcha.sensitive')) {
$value = $this->str->lower($value);
}
$this->session->remove('captcha');
return $this->hasher->check($value, $key);
}
作者:kfuch
项目:cribb
/**
* Create a new HashedPassword
*
* @param Password $password
* @return HashedPassword
*/
public function hash(Password $password)
{
return new HashedPassword($this->hasher->make($password->toString()));
}
作者:Evy
项目:cffs-ap
/**
* Check if password matches
*
* @param Password $password
* @param HashedPassword $hashedPassword
* @return boolean
*/
public function check(Password $password, HashedPassword $hashedPassword)
{
return $this->hasher->check($password->toString(), $hashedPassword->toString());
}
作者:snb4craz
项目:cribb
/**
* Create a new HashedPassword
*
* @param Password $password
* @return HashedPassword
*/
public function hash(Password $password)
{
return new HashedPassword($this->hasher->make((string) $password));
}
作者:PeterMartine
项目:Laravel-Shibboleth-Service-Provide
/**
* Validate a user against the given credentials.
*
* @param \Illuminate\Auth\Authenticatable $user
* @param array $credentials
* @return bool
*/
public function validateCredentials(Authenticatable $user, array $credentials)
{
return $credentials['type'] === 'shibboleth' ? true : $this->hasher->check($credentials['password'], $user->getAuthPassword());
}