/**
  * Update the user's password.
  *
  * @return \Illuminate\Http\Response
  */
 public function patchPassword()
 {
     $input = Binput::only(['password', 'password_confirmation']);
     $val = UserRepository::validate($input, array_keys($input));
     if ($val->fails()) {
         return Redirect::route('account.profile')->withInput()->withErrors($val->errors());
     }
     unset($input['password_confirmation']);
     $user = Credentials::getUser();
     $this->checkUser($user);
     $mail = ['url' => URL::to(Config::get('credentials.home', '/')), 'email' => $user->getLogin(), 'subject' => Config::get('app.name') . ' - New Password Notification'];
     Mail::queue('credentials::emails.newpass', $mail, function ($message) use($mail) {
         $message->to($mail['email'])->subject($mail['subject']);
     });
     $user->update($input);
     return Redirect::route('account.profile')->with('success', 'Your password has been updated successfully.');
 }
 /**
  * Attempt to find the user id of the currently logged in user.
  *
  * @return int|null
  */
 protected function getUserId()
 {
     if (Credentials::check()) {
         return Credentials::getUser()->id;
     } elseif (isset($this['user_id']) && $this['user_id']) {
         return $this['user_id'];
     }
 }
Exemple #3
0
 /**
  * Removes the user from the given group.
  *
  * @param \Cartalyst\Sentry\Groups\GroupInterface $group
  *
  * @return bool
  */
 public function removeGroup(GroupInterface $group)
 {
     RevisionRepository::create(['revisionable_type' => get_class($this), 'revisionable_id' => $this->getKey(), 'key' => 'removed_group', 'old_value' => null, 'new_value' => $group->getName(), 'user_id' => Credentials::getUser()->id]);
     return parent::removeGroup($group);
 }