コード例 #1
0
 public static Result index() {
   String email = session().get("email");
   if (email != null) {
     return redirect(routes.Chats.allChats());
   } else {
     return unauthorized(views.html.login.render());
   }
 }
コード例 #2
0
  public static Result enter() {
    Map<String, String[]> params;
    params = request().body().asFormUrlEncoded();

    String email = params.get("email")[0];
    User user = User.find.byId(email);
    if (user == null) {
      return redirect(routes.Application.login());
    } else {
      session("email", email);
      return redirect(routes.Chats.allChats());
    }
  }