示例#1
0
  public static void saveStylist(Stylist stylist, String password1, String password2) {

    System.out.println("Add saveStylist");

    if (password1.equals(password2)) {
      Account acct = new Account();
      acct.email = stylist.email;
      acct.password = password1;
      acct.type = UserTypes.STYLIST;
      acct.save();

      stylist.acctId = new ObjectId(acct.id.toString());
      stylist.save();
      Salon salon = Salon.read(stylist.salonKey);

      String text =
          "Hi, A stylist how may work at your salon has just created an account with the username "
              + stylist.username
              + " you may wish to add them to your list of stylists.";
      String[] to = {salon.email};
      String from = "*****@*****.**";

      Email msg = new Email(text, to, from, "Stylist just signed up", "Repinzle");
      msg.sendMessage();

      Do.login(acct.email, acct.password);

      View.stylist(stylist.username);
    } else {
      stylist("The passwords entered do not match");
    }
  }
示例#2
0
  public static void saveSalon(Salon salon, String password1, String password2) {

    System.out.println("Add saveSalon");

    if (password1.equals(password2)) {
      Account acct = new Account();
      acct.email = salon.email;
      acct.password = password1;
      acct.type = UserTypes.SALON;
      acct.save();
      salon.acctId = acct.id;
      salon.save();

      String text =
          "Hi, your Repinzle account has been created. Your temporary password is: "
              + acct.password;
      String[] to = {salon.email};
      String from = "*****@*****.**";

      Email msg = new Email(text, to, from, "Confirm your Repinzle salon account", "Repinzle");
      msg.sendMessage();

      View.salon(salon.key);
    } else {
      salon("The passwords entered do not match");
    }
  }
示例#3
0
  public static void signup(String email, String password1, String password2) {

    Account acct = new Account();
    if (password1.equals(password2)) {
      acct.email = email;
      acct.password = password1;
      acct.type = UserTypes.USER;
      acct.save();
    }

    User user = new User();
    user.acctId = acct.id;
    user.email = email;
    user.save();
    session.put("userid", user.userid.toString());
    session.put("useremail", email);

    Add.user();
  }