Package net.naijatek.myalumni.framework.exceptions

Examples of net.naijatek.myalumni.framework.exceptions.UserAccountException


       
      MemberVO token = userAccountDao.getUserAccountByUserName(username)
         
        // Check if user account exists
        if (token == null){
            throw new UserAccountException(NotLoginException.WRONG_USERNAME);
             
        } else {
            // encrypt the password and compare to what the user had.
            String encPasswd = Encoder.getMD5_Base64(password);     
            // If the user passwords match, then check the account status.
            if (token.getMemberStatus().equalsIgnoreCase(BaseConstants.ACCOUNT_LOCKED)){
                throw new UserAccountException(NotLoginException.ACCOUNT_LOCKED);
            }
           
            if (token.getMemberStatus().equalsIgnoreCase(BaseConstants.ACCOUNT_DEACTIVATED)){
                throw new UserAccountException(NotLoginException.ACCOUNT_DEACTIVATED);
            }

            if (token.getMemberStatus().equalsIgnoreCase(BaseConstants.ACCOUNT_DELETED)){
                throw new UserAccountException(NotLoginException.ACCOUNT_DELETED);
            }
           
            if (token.getMemberStatus().equalsIgnoreCase(BaseConstants.ACCOUNT_UNAPPROVED)){
                throw new UserAccountException(NotLoginException.ACCOUNT_UNAPPROVED);
            }
           
            if (!encPasswd.equals(token.getMemberPassword())) {
                throw new UserAccountException(NotLoginException.WRONG_PASSWORD);
            }
           
       
        }
       
View Full Code Here


    public void notifyPassword(String userName, HttpServletRequest request) throws UserAccountException {
                              
        // Lookup the user record, and check if user account exists. 
      MemberVO auth = userAccountDao.getUserAccountByUserName(userName);    
        if (auth == null) {
            throw new UserAccountException(NotLoginException.USER_NOT_FOUND);
        }
       
        // Locked
        if (auth.getMemberStatus().equals(BaseConstants.ACCOUNT_LOCKED)){
          throw new UserAccountException(NotLoginException.ACCOUNT_LOCKED);
        }
       
        // deactivated
        if (auth.getMemberStatus().equals(BaseConstants.ACCOUNT_DEACTIVATED)){
          throw new UserAccountException(NotLoginException.ACCOUNT_DEACTIVATED);
        }
       
        //unapproved
        if (auth.getMemberStatus().equals(BaseConstants.ACCOUNT_UNAPPROVED)){
          throw new UserAccountException(NotLoginException.ACCOUNT_UNAPPROVED);
        }
       
       
        SystemConfigVO sysConfigVO = sysConfigDao.getSystemConfig();
        try {
            // For security reasons, we generate a new random password for the user.
            // User should be forced to change this on next logon.
            String newPasswd =  PasswordGenerator.createPassword(8);
           
            // then use an email template to send the notification.       
             SendMailUtil.sendPasswordReminderMail(auth.getEmail(), auth.getFullName(), newPasswd, sysConfigVO);
           
            // update the system with the new user password(encrypted),
            // and insert a trail for that.
            userAccountDao.resetUserPassword(userName, Encoder.getMD5_Base64(newPasswd));
        } catch (Exception ex) {           
            throw new UserAccountException(ex.getMessage());
        }                
    }
View Full Code Here

                               
         // Lookup the user record, and check if user account exists. 
       MemberVO auth = userAccountDao.getUserAccountByEmail(email)
      
         if (auth == null) {
             throw new UserAccountException(NotLoginException.USER_NOT_FOUND);
         }
        
         // Locked
         if (auth.getMemberStatus().equals(BaseConstants.ACCOUNT_LOCKED)){
           throw new UserAccountException(NotLoginException.ACCOUNT_LOCKED);
         }
        
         // deactivated
         if (auth.getMemberStatus().equals(BaseConstants.ACCOUNT_DEACTIVATED)){
           throw new UserAccountException(NotLoginException.ACCOUNT_DEACTIVATED);
         }
        
         //unapproved
         if (auth.getMemberStatus().equals(BaseConstants.ACCOUNT_UNAPPROVED)){
           throw new UserAccountException(NotLoginException.ACCOUNT_UNAPPROVED);
         }
        
        
         SystemConfigVO sysConfigVO = sysConfigDao.getSystemConfig();
         try {
          
             // then use an email template to send the notification.       
              SendMailUtil.sendUserNameReminderMail(auth.getEmail(), auth.getFullName(), auth.getMemberUserName(), sysConfigVO);
            
         } catch (Exception ex) {           
             throw new UserAccountException(ex.getMessage());
         }                
     }
View Full Code Here

                               String newPassword) throws UserAccountException {
       
        // Lookup the user record, and check if user account exists. 
      MemberVO auth = userAccountDao.getUserAccountByUserName(userName);    
        if (auth == null) {
            throw new UserAccountException(NotLoginException.WRONG_USERNAME);
        }
       
        // encrypt the password and compare to what the user had.
        String encPasswd = Encoder.getMD5_Base64(oldPassword);
        if (!encPasswd.equals(auth.getMemberPassword())) {
            throw new UserAccountException(NotLoginException.WRONG_PASSWORD);
        }
       
        if (oldPassword.equals(newPassword)){
          throw new UserAccountException(NotLoginException.SAME_PASSWORD);
        }
       
        //Else Update the user password(encrypted) and insert a trail for that.
        userAccountDao.changeUserPassword(userName, Encoder.getMD5_Base64(newPassword));                 
    }   
View Full Code Here

    public void updateExpiredPassword(String userName, String newPassword, String tempPassword) throws UserAccountException {
        // Lookup the user record, and check if user account exists. 
      MemberVO auth = userAccountDao.getUserAccountByUserName(userName);    
        if (auth == null) {
            throw new UserAccountException(NotLoginException.WRONG_USERNAME);
        }
       
        // encrypt the password and compare to what the user had.
        String encPasswd = auth.getMemberPassword();
        if (!encPasswd.equals(Encoder.getMD5_Base64(tempPassword))) {
            throw new UserAccountException(NotLoginException.WRONG_PASSWORD);
        }
       
        if (newPassword.equals(tempPassword)){
          throw new UserAccountException(NotLoginException.SAME_PASSWORD);
        }
           
        userAccountDao.updateExpiredPassword(userName, Encoder.getMD5_Base64(newPassword));                 
    }    
View Full Code Here

TOP

Related Classes of net.naijatek.myalumni.framework.exceptions.UserAccountException

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.