繁体   English   中英

斯卡拉戏! 仅针对新用户的页面

[英]scala play! page only for new users

我希望只有在访客未登录时才可以使用我的注册页面。

我想用Security.Authenticated方法来完成。 怎么做?

而不是使用安全特征,可以定义自己的操作类型? 这是未经测试的...

def NotLoggedInAction(f: Request[AnyContent] => Result): Action[AnyContent] = {
    Action { request =>
      if(isLoggedIn(request)) Redirect(views.html.noneForYou)
      else f(request)
    }
}

def isLoggedIn(request: Request) = ??? // You implement this

def mustBeSecured = NotLoggedInAction { implicit request =>
   // Your application logic here.
}

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM