示例#1
0
 /**
  * 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'];
     }
 }
示例#2
0
 /**
  * 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('core.home', '/')), 'email' => $user->getLogin(), 'subject' => Config::get('core.name') . ' - New Password Notification'];
     Mail::queue('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.');
 }