public static Result index() { String email = session().get("email"); if (email != null) { return redirect(routes.Chats.allChats()); } else { return unauthorized(views.html.login.render()); } }
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()); } }