當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Hasher::make方法代碼示例

本文整理匯總了PHP中Illuminate\Contracts\Hashing\Hasher::make方法的典型用法代碼示例。如果您正苦於以下問題:PHP Hasher::make方法的具體用法?PHP Hasher::make怎麽用?PHP Hasher::make使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Illuminate\Contracts\Hashing\Hasher的用法示例。


在下文中一共展示了Hasher::make方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: hashPassword

 /**
  * @param array $attributes
  *
  * @return array
  */
 protected function hashPassword(array $attributes)
 {
     if (isset($attributes['password']) && isset($attributes['password_confirmation']) && $attributes['password'] == $attributes['password_confirmation']) {
         $attributes['password'] = $attributes['password_confirmation'] = $this->hasher->make($attributes['password']);
     }
     return $attributes;
 }
開發者ID:Viktor-V,項目名稱:LPanel,代碼行數:12,代碼來源:UserRepository.php

示例2: fire

 public function fire(array $data)
 {
     $this->validator->setScenario('register')->validate($data);
     $data['password'] = $this->hasher->make($data['password']);
     $user = $this->userModel->create($data);
     event(new UserRegistered($user));
     return $user;
 }
開發者ID:tajrish,項目名稱:api,代碼行數:8,代碼來源:RegisterService.php

示例3: hash

 /**
  * Return a hash that has no / in it suited for url generated.
  *
  * @param $value
  * @return string
  */
 protected function hash($value)
 {
     $hash = $this->hasher->make($value);
     while (strpos($hash, '/') !== false) {
         $hash = $this->hasher->make($value);
     }
     return $hash;
 }
開發者ID:jaffle-be,項目名稱:framework,代碼行數:14,代碼來源:TokenRepository.php

示例4: create

 /**
  * Create a new user in the database.
  *
  * @param  array $data
  * @return \Begin\User
  */
 public function create(array $data)
 {
     $user = $this->getNew();
     $user->name = $data['name'];
     $user->email = $data['email'];
     $user->password = $this->hasher->make($data['password']);
     $user->save();
     return $user;
 }
開發者ID:rajabishek,項目名稱:begin,代碼行數:15,代碼來源:UserRepository.php

示例5: make

 /**
  * @param string $email
  * @param string $password
  * @param bool   $isStaff
  *
  * @throws \DomainException
  * @throws \Illuminate\Database\Eloquent\ModelNotFoundException
  *
  * @return User
  */
 public function make(string $email, string $password, bool $isStaff) : User
 {
     if (!$this->validate($email, $password)) {
         throw new DomainException();
     }
     $user = new User();
     $user->email = $email;
     $user->password = $this->hasher->make($password);
     if ($isStaff) {
         $staffRole = $this->roleResource->mustFindByName(Role::STAFF);
         $staffRole->users()->save($user);
     }
     return $user;
 }
開發者ID:hughgrigg,項目名稱:ching-shop,代碼行數:24,代碼來源:MakeUser.php

示例6: fire

 public function fire(array $data)
 {
     $this->validator->setScenario('recoverPassword')->validate($data);
     $token = $this->tokenHelper->validate($data['token']);
     if ($token === false) {
         $this->response()->errorBadRequest(trans('messages.token_invalid'));
     }
     $user = $token->tokenable->first();
     if ($user === NULL) {
         $this->response()->errorBadRequest(trans('messages.token_invalid'));
     }
     $user->password = $this->hasher->make($data['password']);
     $user->save();
     $token->delete();
     return $user;
 }
開發者ID:tajrish,項目名稱:api,代碼行數:16,代碼來源:RecoverPasswordService.php

示例7: handle

 /**
  * Execute the command.
  *
  * @return void
  */
 public function handle(UserRepositoryInterface $users, Hasher $hasher)
 {
     if (!($user = $users->findByResetToken($this->token))) {
         throw new DisplayException('auth::reset.error');
     }
     $users->resetPassword($user, $hasher->make($this->password));
 }
開發者ID:ChristianGiupponi,項目名稱:Auth,代碼行數:12,代碼來源:ResetCommand.php

示例8: postReset

 public function postReset()
 {
     $credentials = $this->request->only('email', 'password', 'password_confirmation', 'token');
     $response = $this->password->reset($credentials, function ($user, $password) {
         $user->password = $this->hasher->make($password);
         $user->save();
     });
     switch ($response) {
         case $this->password->INVALID_PASSWORD:
         case $this->password->INVALID_TOKEN:
         case $this->password->INVALID_USER:
             return $this->redirector->back()->with('error', $this->translator->get($response));
         case $this->password->PASSWORD_RESET:
             return $this->redirector->to('/');
     }
 }
開發者ID:PhonemeCms,項目名稱:cms,代碼行數:16,代碼來源:RemindersController.php

示例9: getNewHash

 /**
  * @param Request $request
  * @param Hasher $hasher
  * @return mixed|string
  */
 protected function getNewHash(Request $request, Hasher $hasher)
 {
     $email = $request->get('email');
     $hash = $hasher->make(time() . 'someRandome123string' . $email);
     $hash = str_replace('/', '_', $hash);
     return $hash;
 }
開發者ID:jaffle-be,項目名稱:framework,代碼行數:12,代碼來源:MembershipInvitationController.php

示例10: resetPassword

 /**
  * Resets a given users password
  *
  * @param User $user
  * @param $pwd
  * @return User
  */
 public function resetPassword(User $user, $pwd)
 {
     $hashed = $this->hasher->make($pwd);
     $user->setPassword(new HashedPassword($hashed));
     $this->userRepo->update($user);
     return $user;
 }
開發者ID:bakgat,項目名稱:notos,代碼行數:14,代碼來源:UserService.php

示例11: storeOrUpdatePost

 /**
  * @return \jorenvanhocht\Blogify\Models\Post
  */
 private function storeOrUpdatePost()
 {
     if (!empty($this->data->hash)) {
         $post = $this->post->byHash($this->data->hash);
     } else {
         $post = new Post();
         $post->hash = $this->blogify->makeHash('posts', 'hash', true);
     }
     $post->slug = $this->data->slug;
     $post->title = $this->data->title;
     $post->content = $this->data->post;
     $post->status_id = $this->status->byHash($this->data->status)->id;
     $post->publish_date = $this->data->publishdate;
     $post->user_id = $this->user->byHash($this->auth_user->hash)->id;
     $post->reviewer_id = $this->user->byHash($this->data->reviewer)->id;
     $post->visibility_id = $this->visibility->byHash($this->data->visibility)->id;
     $post->category_id = $this->category->byHash($this->data->category)->id;
     $post->being_edited_by = null;
     if (!empty($this->data->password)) {
         $post->password = $this->hash->make($this->data->password);
     }
     $post->save();
     $post->tag()->sync($this->tags);
     return $post;
 }
開發者ID:raccoonsoftware,項目名稱:Blogify,代碼行數:28,代碼來源:PostsController.php

示例12: resetPassword

 /**
  * Reset the given user's password.
  *
  * @param  \Illuminate\Contracts\Auth\CanResetPassword  $user
  * @param  string  $password
  * @return void
  */
 protected function resetPassword($user, $password)
 {
     /** @var $user User */
     $user->setPassword($this->hasher->make($password));
     $this->em->persist($user);
     $this->em->flush();
     Auth::guard($this->getGuard())->login($user);
 }
開發者ID:hoangnd25,項目名稱:laravel-boilerplate,代碼行數:15,代碼來源:PasswordController.php

示例13: update

 /**
  * @param string $hash
  * @param \jorenvanhocht\Blogify\Requests\ProfileUpdateRequest $request
  * @return \Illuminate\Http\RedirectResponse
  */
 public function update($hash, ProfileUpdateRequest $request)
 {
     $user = $this->user->byHash($hash);
     $user->lastname = $request->name;
     $user->firstname = $request->firstname;
     $user->username = $request->username;
     $user->email = $request->email;
     if ($request->has('newpassword')) {
         $user->password = $this->hash->make($request->newpassword);
     }
     if ($request->hasFile('profilepicture')) {
         $this->handleImage($request->file('profilepicture'), $user);
     }
     $user->save();
     $this->tracert->log('users', $user->id, $this->auth_user->id, 'update');
     $message = trans('blogify::notify.success', ['model' => 'User', 'name' => $user->fullName, 'action' => 'updated']);
     session()->flash('notify', ['success', $message]);
     return redirect()->route('admin.dashboard');
 }
開發者ID:raccoonsoftware,項目名稱:Blogify,代碼行數:24,代碼來源:ProfileController.php

示例14: changePassword

 public function changePassword(ChangePasswordRequest $request, Auth $auth, Hasher $hash)
 {
     $user = $auth->user();
     if ($hash->check($request->password, $user->password) == false) {
         return redirect('changePassword')->withErrors('Senha atual incorreta.');
     }
     $user->password = $hash->make($request->new_password);
     $user->save();
     return redirect('/');
 }
開發者ID:natanaelphp,項目名稱:Dividas2.0,代碼行數:10,代碼來源:ChangePasswordController.php

示例15: handle

 /**
  * Execute the command.
  *
  * @param Hasher $hasher
  * @param UserRepository $users
  * @return User
  * @throws UserAlreadyExistsException
  */
 public function handle(Hasher $hasher, UserRepository $users)
 {
     try {
         $users->findByEmail($this->email);
         throw new UserAlreadyExistsException($this->email);
     } catch (ModelNotFoundException $e) {
         $user = User::register($this->name, $this->email, $hasher->make($this->password), 'admin');
         $users->save($user);
         event(new UserWasRegistered($user));
         return $user;
     }
 }
開發者ID:manishkiozen,項目名稱:Cms,代碼行數:20,代碼來源:RegisterAdministratorUserCommand.php


注:本文中的Illuminate\Contracts\Hashing\Hasher::make方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。