Package at.fhj.itm.model

Examples of at.fhj.itm.model.User


   *         the user was not identified.
   * @throws ServiceException if a database error occured
   */
  @Override
  public String recoverUserPassword(String email, String phone) {
    User user = null;
    try {
      begin();
      user = getUserDAO().getUserWithEmailAndPhone(email, phone, getConnection());
      commit();
    } catch (DAOException e) {
      throw new ServiceException("Error in retrieving user with email and password", e);
    } catch (SQLException e) {
      throw new ServiceException("Error in retrieving user with email and password", e);
    } finally {
      closeConnection();
    }
    if (user == null)
      return null;

    user.setLastLoginDate(null);
    user.setSessionID(this.randUtil.getRandSessionID());
    updateUser(user, " for password recovery: sessionID, last login Date");
    return user.getSessionID();
  }
View Full Code Here


   * @return true if the password for the user was updated successfully.
   * @throws ServiceException if a database error occured
   */
  @Override
  public boolean setPassword(String newPassword, String sessionId) {
    User user = null;
    try {
      begin();
      user = getUserDAO().getUserForSessionId(sessionId, getConnection());
      commit();
    } catch (DAOException e) {
      throw new ServiceException("Error in retrieving user with email and password", e);
    } catch (SQLException e) {
      throw new ServiceException("Error in retrieving user with email and password", e);
    } finally {
      closeConnection();
    }
    if (user == null)
      return false;
    if (user.getLastLoginDate() != null) {
      return false;
    }

    user.setPassword(newPassword);
    user.setSessionID(this.randUtil.getRandSessionID());
    updateUser(user, "s password!");
    return true;
  }
View Full Code Here

TOP

Related Classes of at.fhj.itm.model.User

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.