forked from scalatra/scalatra-website-examples
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Dave Hrycyszyn
committed
Dec 7, 2013
1 parent
0a53a82
commit e55d13d
Showing
10 changed files
with
97 additions
and
32 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 7 additions & 2 deletions
9
2.2/http/forms-auth-demo/src/main/scala/org/scalatra/example/ProtectedController.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
2.2/http/forms-auth-demo/src/main/scala/org/scalatra/example/SessionsController.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
package org.scalatra.example | ||
|
||
import org.slf4j.LoggerFactory | ||
|
||
class SessionsController extends FormsAuthDemoStack with AuthenticationSupport { | ||
|
||
val logger = LoggerFactory.getLogger(getClass) | ||
|
||
|
||
get("/new") { | ||
if (isAuthenticated) redirect("/") | ||
|
||
contentType="text/html" | ||
ssp("/sessions/new", "authenticated" -> isAuthenticated) | ||
} | ||
|
||
post("/") { | ||
logger.info(("Starting authentication")) | ||
scentry.authenticate() | ||
|
||
if (isAuthenticated) { | ||
redirect("/") | ||
}else{ | ||
redirect("/sessions/new") | ||
} | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 0 additions & 12 deletions
12
2.2/http/forms-auth-demo/src/main/webapp/WEB-INF/templates/layouts/default.jade
This file was deleted.
Oops, something went wrong.
6 changes: 6 additions & 0 deletions
6
2.2/http/forms-auth-demo/src/main/webapp/WEB-INF/templates/layouts/default.ssp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
<%@ val body: String %> | ||
<html> | ||
<body> | ||
<%= unescape(body) %> | ||
</body> | ||
</html> |
13 changes: 13 additions & 0 deletions
13
2.2/http/forms-auth-demo/src/main/webapp/WEB-INF/templates/views/sessions/new.ssp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
<p>Please login</p> | ||
|
||
<form action="/sessions" method="post"> | ||
<p> | ||
<label>Login:</label> | ||
<input type="text" name="login"/><br> | ||
<label>Password:</label> | ||
<input type="password" name="password"/><br/> | ||
</p> | ||
<p> | ||
<input type="submit"> | ||
</p> | ||
</form> |