mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-11-02 03:26:06 +01:00
Fix Unauthorized error behaviour.
This commit is contained in:
@@ -69,9 +69,13 @@ abstract class ControllerBase extends ScalatraFilter
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO redirect to the sign-in page if not logged in?
|
// TODO redirect to the sign-in page if not logged in?
|
||||||
protected def Unauthorized() = {
|
protected def Unauthorized()(implicit context: app.Context) = {
|
||||||
if(request.getAttribute("AJAX") == null){
|
if(request.getAttribute("AJAX") == null){
|
||||||
|
if(context.loginAccount.isDefined){
|
||||||
org.scalatra.Unauthorized(redirect("/"))
|
org.scalatra.Unauthorized(redirect("/"))
|
||||||
|
} else {
|
||||||
|
org.scalatra.Unauthorized(redirect("/signin?" + currentURL))
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
org.scalatra.Unauthorized()
|
org.scalatra.Unauthorized()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user