Laravel:登录后的空白页,然后检查角色

时间:2015-10-16 17:18:58

标签: php laravel redirect laravel-5.1 laravel-routing

我使用Laravel的原生auth模块进行登录并使用委托用户角色。

当用户登录时,laravel的本机身份验证模块仅检查用户名/电子邮件和密码。然后记录用户。我已检查用户是否使用某个user_type登录(user_type也已发布)并且用户具有该角色,然后用户被发送到该角色的仪表板,否则用户将被Auth :: logout注销并重定向到登录页面,错误的user_type错误。

除user_type错误外,所有代码都有效,然后显示空白登录页面。我已经尝试了很多重定向组合,但没有运气。

我的注销和重定向代码是

protected function logoutRedirect(Request $request)
{
    Auth::logout();

    return redirect($this->loginPath())
        ->withInput($request->only($this->loginUsername(), 'remember'))
        ->withErrors([
            $this->loginRole() => $this->getWrongRoleMessage(),
        ]);

    /*
    return view('auth.login')
        ->withInput($request->only($this->loginUsername(), 'remember'))
        ->withErrors($this->getWrongRoleMessage());
    */

    /*
    return redirect('/auth/login')->withErrors([$this->loginRole() => $this->getWrongRoleMessage()]);
    */
}

我已经在评论的形式中放置了我可以在上面的代码中尝试的所有重定向方法。如果您能找到错误或者您可以提出更好的解决方案,请告诉我们。我是laravel的新人,所以如果你帮助我解决这个初学者的问题,我将不胜感激。

PS:顺便说一句,我使用的是Laravel 5.1和localhost(xampp + MS windows 7)

1 个答案:

答案 0 :(得分:0)

最后,我通过搜索解决方案来意外地找到了解决方案。令人惊讶的是,在任何论坛的任何地方都没有提到这一点。

以下是带回错误的代码。

    ; First term: 14x3
    mov al, 14
    mov bl, 3
    mul bl        ; ax = 42 (or, al=42 and ah=0)


    ; next we're going to DIV, which uses `AX`, so we better copy our result out of ax:
    mov cx, ax    ; or: mov cl, al


    ; Second term, 16/4 (16/3 would be more interesting!)
    mov ax, 16    ; we could mov al, 16 since ah is already 0
    mov dl, 4
    div dl        ; now al=4 and ah=0  (With 16/3, al=5 and ah=1!)


    ; Add to our result:
    add cl, al
;   adc ch, 0     ; take care of overflow if we want a 16 bit result


    ; calculate the 3rd term    
    mov al, 3     ; that was easy :-)

    ; and add the 3rd term to our result:
    sub cl, al    ; we could have done sub cl, 3