コード例 #1
0
ファイル: AuthController.php プロジェクト: verchielxy/eform
 public function postLogin(LoginPRequest $request)
 {
     $user = User::where('user_email', '=', $request->input('login_name'))->firstOrFail();
     if ($user->user_role == 'member' || $user->user_role == 'vip' || $user->user_role == 'admin') {
         if ($user->user_active == 0) {
             $email = Email::create(['email_cuid' => 0, 'email_ruid' => $user->user_id, 'email_block' => 'user_confirm', 'email_target' => $user->user_email, 'email_title' => '欢迎来到[ ' . WEBSITE_NAME . ' ],请您按照提示激活您的账号', 'email_datas' => str_random(15), 'email_is_sent' => 0]);
             $this->dispatch(new SendReminderEmail($email));
             $res = redirect('/login')->with('msgError', '您的账号还没有进行邮箱验证');
         } else {
             if (Hash::check(WEBSITE_SECRET . $request->input('login_password'), $user->user_password)) {
                 Auth::login($user);
                 Mylog::cc($request, $user, 'login');
                 if (session('firsturl')) {
                     $res = redirect(session('firsturl'));
                 } else {
                     $res = redirect(DEFAULT_AUTH_REDIRECT_URL);
                 }
             } else {
                 $res = redirect()->back()->withInput()->with('msgError', '密码不正确');
             }
         }
     } else {
         $res = redirect()->back()->withInput()->with('msgError', '登陆异常,请联系管理员解决');
     }
     return $res;
 }
コード例 #2
0
 public function postLogin(LoginPRequest $request)
 {
     $user = User::where('user_email', '=', $request->input('login_name'))->firstOrFail();
     if ($user->user_role == 'member' && $user->user_active == 1 || $user->user_role == 'admin') {
         if (Hash::check(WEBSITE_SECRET . $request->input('login_password'), $user->user_password)) {
             Auth::login($user);
             Mylog::cc($request, $user, 'login');
             if (session('uri')) {
                 $res = redirect(session('uri'));
             } elseif ($user->isAdmin()) {
                 $res = redirect(DEFAULT_MANAGE_REDIRECT_URL);
             } else {
                 $res = redirect(DEFAULT_AUTH_REDIRECT_URL);
             }
         } else {
             $res = redirect()->back()->withInput()->with('msgError', '密码不正确');
         }
     } elseif ($user->user_role == 'member' && $user->user_active == 0) {
         $res = redirect()->back()->withInput()->with('msgError', '您的账号还没有进行邮箱验证');
     } elseif ($user->user_role == 'ban') {
         $res = redirect()->back()->withInput()->with('msgError', '您的账号被管理员禁止登录');
     }
     return $res;
 }