Package models

Examples of models.User$UserMapper


     *
     * @param token a token attached to the user we're confirming.
     * @return Confirmationpage
     */
    public static Result confirm(String token) {
        User user = User.findByConfirmationToken(token);
        if (user == null) {
            flash("error", Messages.get("error.unknown.email"));
            return badRequest(confirm.render());
        }

View Full Code Here


     * Password Page. Ask the user to change his password.
     *
     * @return index settings
     */
    public static Result index() {
        User user = User.findByEmail(request().username());
        Form<AskForm> askForm = form(AskForm.class);
        askForm = askForm.fill(new AskForm(user.email));
        return ok(email.render(User.findByEmail(request().username()), askForm));
    }
View Full Code Here

     *
     * @return email page with flash error or success
     */
    public static Result runEmail() {
        Form<AskForm> askForm = form(AskForm.class).bindFromRequest();
        User user = User.findByEmail(request().username());

        if (askForm.hasErrors()) {
            flash("error", Messages.get("signup.valid.email"));
            return badRequest(email.render(user, askForm));
        }
View Full Code Here

     * Validate a email.
     *
     * @return email page with flash error or success
     */
    public static Result validateEmail(String token) {
        User user = User.findByEmail(request().username());

        if (token == null) {
            flash("error", Messages.get("error.technical"));
            return badRequest(emailValidate.render(user));
        }

        Token resetToken = Token.findByTokenAndType(token, Token.TypeToken.email);
        if (resetToken == null) {
            flash("error", Messages.get("error.technical"));
            return badRequest(emailValidate.render(user));
        }

        if (resetToken.isExpired()) {
            resetToken.delete();
            flash("error", Messages.get("error.expiredmaillink"));
            return badRequest(emailValidate.render(user));
        }

        user.email = resetToken.email;
        user.save();

        session("email", resetToken.email);

        flash("success", Messages.get("account.settings.email.successful", user.email));

View Full Code Here

     * Send a mail with the reset link.
     *
     * @return password page with flash error or success
     */
    public static Result runPassword() {
        User user = User.findByEmail(request().username());
        try {
            Token.sendMailResetPassword(user);
            flash("success", Messages.get("resetpassword.mailsent"));
            return ok(password.render(user));
        } catch (MalformedURLException e) {
View Full Code Here

public class Application extends Controller {

    public static void index() {
        if(Auth.isLoggedIn()) {
            User user = User.findByEmail(Auth.getEmail());
      if(null == user) {
        user = new User();
        user.email = Auth.getEmail();
        user.created = new Date();
        user.insert();
        Profile.edit(user.id);
        return;
      }
            Profile.index(null);
        }
View Full Code Here

        request.cookies.putAll(cookies);
        response = GET(request, api_base);
        assertStatus(StatusCode.OK, response);
        InputStream is = new ByteArrayInputStream(response.out.toByteArray());
    Reader reader = new InputStreamReader(is);
        User user = new Gson().fromJson(reader, User.class);
        assertTrue("El nombre del usuario ha de ser eduardo.perrino ", username.startsWith(user.username));
        user.basic_information.firstName = "Juan lucas";
        request = newRequest();
        request.cookies.putAll(cookies);
        response = FunctionalTest.PUT(request, api_base,"application/json", new Gson().toJson(user, User.class));
View Full Code Here

     assertIsOk(response);
     is = new ByteArrayInputStream(response.out.toByteArray());
     reader = new InputStreamReader(is);
     data = new Gson().fromJson(reader, dataType);
     assertTrue("La residencia sólo tiene dos internos", data.data.size() == 2);
     User internal = data.data.get(0);
     addFamiliar(internal);
  }
View Full Code Here

     User internal = data.data.get(0);
     addFamiliar(internal);
  }
 
  private static void addFamiliar(User internal) {
    User familiar = new User();
    familiar.username = "angela.martin";
    familiar.password = "test2012";
    familiar.access = true;
    BasicInformation basicInformation = new BasicInformation();
    familiar.basic_information = basicInformation;
View Full Code Here

          User.findByUsername("laura.garcia").isAdmin());
      /*Configuracion de la Familia 1*/
      addProfileToUser("eva.perez", Profile.ProfileType.INTERNSHIP);
      assertTrue("La residencia tiene registrado a eva.perez",
          UserProfile.findByProfile(Profile.findByType(ProfileType.INTERNSHIP)).size()==1);
      User eva = User.findByUsername("eva.perez");
      assertTrue("El username de la interna es eva.perez", eva.username.equals("eva.perez"));
      assertTrue("El username de la interna (" + eva.id + ") es eva.perez", User.findById(eva.id).username.equals("eva.perez"));
      addProfileToUser("juan.gomez", Profile.ProfileType.FAMILIAR);
      addProfileToUser("abel.martin", Profile.ProfileType.FAMILIAR);
      assertTrue("La residencia tiene registrados dos familiares (juan.gomez y abel.martin)",
          UserProfile.findByProfile(Profile.findByType(ProfileType.FAMILIAR)).size()==2);
      createFamiliarRelation(User.findByUsername("eva.perez"), User.findByUsername("juan.gomez"));
      createFamiliarRelation(User.findByUsername("eva.perez"), User.findByUsername("abel.martin"));
      int familiars = 2;
      assertTrue("eva.perez tiene " + familiars + " familiares",
          InternshipFamiliar.getByInternship(User.findByUsername("eva.perez")).size()==familiars);
      /*Configuración de la Familia 2*/
      addProfileToUser("judith.agirre", Profile.ProfileType.INTERNSHIP);
      User judith = User.findByUsername("judith.agirre");
      assertTrue("El username de la interna es judith.agirre", judith.username.equals("judith.agirre"));
      assertTrue("El username de la interna (" + judith.id + ") es judith.agirrez",
          User.findById(judith.id).username.equals("judith.agirre"));
      addProfileToUser("tomas.cuenca", Profile.ProfileType.FAMILIAR);
      assertTrue("La residencia tiene registrados 3 familiares (juan.gomez, abel.martin y tomas.cuenca)",
View Full Code Here

TOP

Related Classes of models.User$UserMapper

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.