public function accountIsActive($code) { $user = User::where('activation_code', '=', $code)->first(); $user->active = 1; $user->activation_code = ''; if ($user->save()) { Auth::loginUsingId($user->id); } return redirect(config('easyAuthenticator.login_redirect')); }
public function accountIsActive($code) { $user = User::where('activation_code', '=', $code)->first(); $user->active = 1; $user->activation_code = ''; if ($user->save()) { Auth::login($user); } return true; }
/** * Handle a login request to the application. * * @param \Illuminate\Http\Request $request * @return \Illuminate\Http\Response */ public function postLogin(Request $request) { $this->validate($request, ['email' => 'required', 'password' => 'required']); $user = User::where('email', '=', $request->email)->first(); if ($user) { if ($user->provider != 'laravel') { return redirect($this->loginPath())->withInput($request->only('email', 'remember'))->withErrors(['email' => 'This email address has already been registered']); } } $credentials = $request->only('email', 'password'); if ($this->auth->attempt($credentials, $request->has('remember'))) { return redirect()->intended($this->redirectPath()); } return redirect($this->loginPath())->withInput($request->only('email', 'remember'))->withErrors(['email' => 'These credentials do not match our records.']); }