Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
C
cerebro
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nimrod
cerebro
Commits
091bb8f6
Commit
091bb8f6
authored
7 years ago
by
Leonardo Menezes
Browse files
Options
Downloads
Patches
Plain Diff
handle custom base path correctly on logout
closes #142
parent
bcbc3d8e
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
app/controllers/AuthController.scala
+11
-5
11 additions, 5 deletions
app/controllers/AuthController.scala
with
11 additions
and
5 deletions
app/controllers/AuthController.scala
+
11
−
5
View file @
091bb8f6
...
...
@@ -5,15 +5,21 @@ import javax.inject.{Inject, Singleton}
import
akka.actor.ActorSystem
import
controllers.auth.
{
AuthAction
,
AuthenticationModule
}
import
forms.LoginForm
import
play.api.Configuration
import
play.api.mvc.
{
Action
,
Controller
}
@Singleton
class
AuthController
@Inject
()(
system
:
ActorSystem
,
authentication
:
AuthenticationModule
)
extends
Controller
{
class
AuthController
@Inject
()(
system
:
ActorSystem
,
authentication
:
AuthenticationModule
,
configuration
:
Configuration
)
extends
Controller
{
import
AuthController._
private
val
badFormMsg
=
"invalid login form data"
def
index
=
Action
{
implicit
request
=>
if
(
authentication
.
isEnabled
)
{
request
.
session
.
get
(
AuthAction
.
SESSION_USER
).
map
{
user
=>
...
...
@@ -47,15 +53,15 @@ class AuthController @Inject()(system: ActorSystem, authentication: Authenticati
}
resp
.
withSession
(
AuthAction
.
SESSION_USER
->
username
)
case
None
=>
Redirect
(
routes
.
AuthController
.
index
).
flashing
(
LOGIN_MSG
->
"
wrong user and/
or password"
)
Redirect
(
routes
.
AuthController
.
index
).
flashing
(
LOGIN_MSG
->
"
Incorrect username
or password"
)
}
}
)
}
def
logout
=
Action
{
request
=>
Redirect
(
"/
login"
).
withNewSession
def
logout
=
Action
{
_
=>
val
prefix
=
configuration
.
getString
(
"play.http.context"
).
getOrElse
(
"/"
)
Redirect
(
s
"${prefix}
login"
).
withNewSession
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment