public function getResetWebsite($token = null)
 {
     $page = 'recuperar-senha';
     $websiteSettings = \App\Exceptions\Handler::readFile("websiteSettings.json");
     $pages = Pages::where('slug', '=', $page)->first();
     $user = PasswordResets::where('token', '=', $token)->first();
     if (is_null($token)) {
         throw new NotFoundHttpException();
     }
     return view('website.profile.recoveryPassword')->with(compact('token', 'page', 'websiteSettings', 'pages', 'user'));
 }
예제 #2
0
 public function store(UserRequest $request)
 {
     $fields = $request->all();
     $user = User::create($fields);
     $user->groups()->sync($request->input("group_list"));
     $token = $this->createNewToken();
     PasswordResets::create(['user_id' => $user->id, 'token' => $token]);
     $data = ['name' => $user->name, 'url' => url('/password/change-password', ["token" => $token]), "to" => $user->email, "ton" => $user->name, 'from' => env('MAIL_DEFAULT_FROM'), 'fromn' => env('MAIL_DEFAULT_FROMN')];
     Mail::send('emailtemps.newuserpassword', $data, function ($message) use($data) {
         $message->to($data['to'], $data['ton']);
         $message->from($data['from'], $data['fromn']);
         $message->subject('New User Welcome ');
     });
     return redirect('users');
 }
예제 #3
0
 public function postFixPassword(PasswdResetFixRequest $request)
 {
     $pr = PasswordResets::where('token', $request['token'])->where('created_at', '>', Carbon::now()->subHours($this->exp))->first();
     if ($pr != null) {
         $u = User::findOrFail($pr->user_id);
         if ($u != null) {
             $u->update(['password' => $request['password1']]);
             flash()->overlay("Your password has been changed, login to access system.");
             PasswordResets::where('token', $request['token'])->delete();
         } else {
             flash()->overlay("Your password change failed.");
         }
     }
     return redirect('/auth/login');
 }