mirror of
https://github.com/gitbucket/gitbucket.git
synced 2025-10-30 10:06:07 +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?
|
||||
protected def Unauthorized() = {
|
||||
protected def Unauthorized()(implicit context: app.Context) = {
|
||||
if(request.getAttribute("AJAX") == null){
|
||||
org.scalatra.Unauthorized(redirect("/"))
|
||||
if(context.loginAccount.isDefined){
|
||||
org.scalatra.Unauthorized(redirect("/"))
|
||||
} else {
|
||||
org.scalatra.Unauthorized(redirect("/signin?" + currentURL))
|
||||
}
|
||||
} else {
|
||||
org.scalatra.Unauthorized()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user