@Before static void setConnectedUser() { if (Security.isConnected()) { User user = User.find("byEmail", Security.connected()).first(); renderArgs.put("user", user.fullname); } }
@Before static void setConnectedUser() { if (Security.isConnected()) { User user = User.find("byUsername", Security.connected()).first(); if (!user.isAdmin) { flash.error(Messages.get("UserIsNotAuthorized")); Application.index(); } } }
@Before static void setConnectedUser() { if (Security.isConnected()) { User user = User.find("byEmail", Security.connected()).first(); if (user == null) { user = new User("*****@*****.**", "1234", "Andreas"); user.save(); } renderArgs.put("user", user.fullname); } }
public static void editerBateau(String nomBateau, String couleurVoile, String couleurcoque) { if (Security.isConnected()) { Utilisateur user = Utilisateur.find("byEmail", Security.connected()).first(); renderArgs.put("user", user); } Utilisateur user = Utilisateur.find("byEmail", Security.connected()).first(); if (validation.hasErrors()) { // add http parameters to the flash scope params.flash(); } else { user.couleurcoque = couleurcoque; user.couleurVoile = couleurVoile; user.nomBateau = nomBateau; user.save(); } render("Admin/index.html"); }
public static void sauvegardermoncompte(String pseudo, String password) { if (Security.isConnected()) { Utilisateur user = Utilisateur.find("byEmail", Security.connected()).first(); renderArgs.put("user", user); } Utilisateur user = Utilisateur.find("byEmail", Security.connected()).first(); if (validation.hasErrors()) { // add http parameters to the flash scope params.flash(); } else { user.pseudo = pseudo; user.password = password; user.save(); } render("Admin/index.html"); }