Package com.apps.datastore.dao

Examples of com.apps.datastore.dao.AccountObject


    boolean active = (Boolean) qe.getProperty(ACTIVATED_PROPERTY);
    String authKey=(String) qe.getProperty(AUTHENTICATION_KEY_PROPERTY);
    long notifyConfig = (Long)qe.getProperty(PREFERENCE_NOTIFY_CONFIG_PROPERTY);
    String phoneNumber = (String)qe.getProperty(PREFERENCE_PHONE_NUMBER_PROPERTY);
    CARRIER carrier = CARRIER.get((String)qe.getProperty(PREFERENCE_CARRIER_PROPERTY));
    return new AccountObject(accountId,password,active,authKey, notifyConfig, phoneNumber, carrier);
  }
View Full Code Here


    if(!valid){
      xmlout += "\t<login>false</login>\n";
      xmlout += "\t<error>Invalid email or password</error>\n";
    }
    else {
      AccountObject obj = login(email, password);

      if (obj != null && obj.isActivated()) {
        xmlout += "\t<login>true</login>\n";
        xmlout += "\t<user>" + obj.getEmail() + "</user>\n";
        xmlout += "\t<key>" + obj.getAuthkey() + "</key>\n";
      } else if (obj == null) {
        xmlout += "\t<login>false</login>\n";
        xmlout += "\t<error>Invalid email or password</error>\n";
      } else if (!obj.isActivated()) {
        xmlout += "\t<login>false</login>\n";
        xmlout += "\t<error>Your account is not activated</error>\n";
      }
    }
    xmlout += "</authentication>";
View Full Code Here

    for(int i = 0; i < cookies.length; i++) {
      if(cookies[i].getName().equals("user"))
        user = cookies[i].getValue();   
    }
   
    AccountObject lao = d.getAccountObject(user);
    if (lao !=null) {
     
      //Check if any of them are null,
      //if so, set to whatever they had last time.
     
      if(!notifyConfig.isEmpty()){
        //Error Checking
        long ncfg = Long.parseLong(notifyConfig);
        lao.setNotifyConfig(ncfg);
      }
      if(!phoneNumber.isEmpty())
        lao.setPhoneNumber(phoneNumber);
      if(!carrier.isEmpty())
        lao.setCarrier(carrier);
      d.updateAccountObject(lao);
      resp.sendRedirect("/debug.jsp?msg=preference_update_success");
    }
    else
      resp.sendRedirect("/debug.jsp?msg=preference_update_failed");
View Full Code Here

  }

  public AccountObject login(String username, String password) {

    AccountObject lio = d.getAccountObject(username);
   
    if (lio != null ) {
   
      if (BCryptUtils.checkpw(password, lio.getPassword())) {
      } else {
        lio=null;
      }

    }
View Full Code Here

    }
   
    if(user == null)
      resp.sendRedirect("/debug.jsp?msg=pref_updated_failed");
    else if(password.equals(confirmPassword)){
      AccountObject lao=d.getAccountObject(user);
      //Username should exist cause user is logged in, but to be safe.
      if(lao != null){
        String hashed = BCryptUtils.hashpw(password, BCryptUtils.gensalt());
        lao.setPassword(hashed);
        d.updateAccountObject(lao);
        //SUCCESS
        resp.sendRedirect("/debug.jsp?msg=pref_updated_sucess");
       
      }
View Full Code Here

    if(cookies[i].getName().equals("user"))
      user = cookies[i].getValue();   
  }
  String xmlout = "<response>\n";
  if(user != null) {
    AccountObject ao = ad.getAccountObject(user);
    if(ao != null){
      long seatcfg = Long.parseLong(req.getParameter("seatcfg"));
      String email = ao.getEmail();
      String phoneNumber =ao.getPhoneNumber();
      long notifycfg = ao.getNotifyConfig();
      CARRIER carrier = ao.getCarrier();
      if((phoneNumber.isEmpty() || carrier.name().equals("NULL")) && notifycfg == 2)
        xmlout += "\t<message>Invalid carrier or phone number, check your account preferences</message>\n";
      else {
        boolean success;
        try {
View Full Code Here

        BCryptUtils.gensalt());
    boolean result = false;

    if (!d.checkAccountExist(username)) {

      AccountObject obj = new AccountObject(username,
          encryptedPassword, false, randomString, 1, "",CARRIER.NULL);

      result = d.addAccount(obj);

    }
View Full Code Here

          if (cookies[i].getName().equals("auth"))
            auth = cookies[i].getValue();
        }

        if (user != null && auth != null) {
          AccountObject ao = d.getAccountObject(user);
          if (ao.getAuthkey().equals(auth) && ao.isActivated())
            authorized = true;
        }
      }
    }
    if (authorized) {
View Full Code Here

TOP

Related Classes of com.apps.datastore.dao.AccountObject

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.