public static void sendModeration(String name, float point) { Task t = new Task(name, point); t.status = TaskStatus.PENDING; t.suggestedBy = SUser.findByEmail(Auth.connected()); t.save(); thanks(); }
public static void fbLogin() { String token = params.get("token"); if (null != token && !token.isEmpty()) { FacebookClient fb = new DefaultFacebookClient(token); User fbUser = fb.fetchObject("me", User.class); Logger.info("Facebook User:"******"Such a user does not exists. Create/Register one..."); // Register a new... // Email uniqueness is controlled by Facebook I suppose, so no need to check on our side... sesUser = new SUser(fbUser.getName(), fbUser.getEmail()); sesUser.fbId = fbUser.getId(); sesUser.save(); } Auth.fbLogin(token, sesUser); } else { redirect("/"); } }
@Before public static void initLogin() { if (Security.isConnected()) { SUser u = SUser.findByEmail(Security.connected()); if (null != u) { renderArgs.put("user", u.email); renderArgs.put("user_name", u.name); renderArgs.put("loggedIn", true); } } }