Skip to content
Permalink
Browse files

UserServiceを使ったログイン処理。

Signed-off-by: Takuya UESHIN <ueshin@happy-camper.st>
  • Loading branch information
ueshin committed Dec 6, 2010
1 parent 420bdc2 commit ca60f4856a9193a3c35c72037e2112e9f0541357
Showing with 37 additions and 11 deletions.
  1. +0 −10 app/controllers.scala
  2. +14 −0 app/controllers/Application.scala
  3. +18 −0 app/controllers/Defaults.scala
  4. +3 −1 app/views/Application/index.html
  5. +2 −0 conf/routes

This file was deleted.

@@ -0,0 +1,14 @@
package controllers

import _root_.play._
import _root_.play.mvc._
import _root_.play.modules.gae._

object Application extends Controller with Defaults {

def index = Template

def login = GAE.login("Application.index")

def logout = GAE.logout("Application.index")
}
@@ -0,0 +1,18 @@
package controllers

import _root_.play._
import _root_.play.mvc._
import _root_.play.modules.gae._

trait Defaults extends Controller {

@Before
def check = {
Option(GAE.getUser) match {
case Some(user) => {
renderArgs += "user" -> user
}
case None =>
}
}
}
@@ -1,4 +1,6 @@
#{extends 'main.html' /}
#{set title:'Home' /}

#{welcome /}
Welcome #{if user}${user.email}#{/if}#{else}Guest#{/else}!

#{if user}<a href="@{Application.logout}">Logout</a>#{/if}#{else}<a href="@{Application.login}">Login</a>#{/else}
@@ -4,6 +4,8 @@

# Home page
GET / Application.index
GET /login Application.login
GET /logout Application.logout

# Map static resources from the /app/public folder to the /public path
GET /public/ staticDir:public

0 comments on commit ca60f48

Please sign in to comment.
You can’t perform that action at this time.