Beispiel #1
0
 /**
  * Store a newly created resource in storage.
  *
  * @param \Illuminate\Http\Request $request
  *
  * @return \Illuminate\Http\Response
  */
 public function store(Request $request)
 {
     $user = $this->updateOrCreate($request);
     \Password::sendResetLink(['email' => $user->email], function (Message $message) {
         $message->subject('Velkommen til ub-baser');
     });
     return redirect()->action('Admin\\UserController@index')->with('status', 'En epost er sendt til brukeren med instruksjoner for å sette passord.');
 }
 public function postEmail(Request $request)
 {
     $this->validate($request, ['email' => 'required|exists:users,email,active,1']);
     $response = \Password::sendResetLink($request->only('email'), function (Message $message) {
         $message->subject($this->getEmailSubject());
     });
     switch ($response) {
         case \Password::RESET_LINK_SENT:
             return redirect()->back()->with('status', trans($response));
         case \Password::INVALID_USER:
             return redirect()->back()->withErrors(['email' => trans($response)]);
     }
 }
Beispiel #3
0
 /**
  * Handle a POST request to remind a user of their password.
  *
  * @return Response
  */
 public function postRemind()
 {
     \App::make('route');
     \Config::set('auth.defaults.passwords', 'panel');
     $response = \Password::sendResetLink(Input::only('email'), function ($message) {
         $message->subject('Password Reminder');
     });
     switch ($response) {
         case PasswordBrokerContract::INVALID_USER:
             return \Redirect::back()->with('message', \Lang::get($response))->with('mesType', 'error');
         case PasswordBrokerContract::RESET_LINK_SENT:
             return \Redirect::back()->with('message', \Lang::get($response))->with('mesType', 'info');
     }
 }
 /**
  * Execute the console command.
  *
  * @return mixed
  */
 public function handle()
 {
     $credentials = ['email' => $this->argument('email')];
     $user = User::firstOrNew($credentials);
     if (!$user->isDirty()) {
         $this->info('User already exists');
         return;
     }
     $user->name = $this->argument('name');
     $user->rights = $this->option('admin') ? ['admin'] : [];
     $user->save();
     \Password::sendResetLink($credentials, function (Message $message) {
         $message->subject('Velkommen til ub-baser');
     });
     $this->info('User created, email sent to ' . $user->email . '.');
 }
 public function password_request()
 {
     $credentials = array('email' => Input::get('email'));
     $response = Password::sendResetLink($credentials, function ($message) {
         $message->subject('Password Reset Info');
     });
     switch ($response) {
         case PasswordBroker::RESET_LINK_SENT:
             return Redirect::to('login')->with(array('note' => trans($response), 'note_type' => 'success'));
         case PasswordBroker::INVALID_USER:
             return redirect()->back()->with(array('note' => trans($response), 'note_type' => 'error'));
     }
 }
 /**
  * Send reminder email.
  *
  * @return Response
  */
 public function sendReminder()
 {
     $result = Password::sendResetLink(Input::only('email'), function ($message, $user) {
         $message->subject(trans('login.reminder_subject'));
     });
     switch ($result) {
         case Password::INVALID_USER:
             return Redirect::back()->with('error', trans('login.wrong_creds'));
         case Password::RESET_LINK_SENT:
             return Redirect::back()->with('status', trans('login.reminder_sent'));
     }
 }