Package edu.asu.securebanking.model

Examples of edu.asu.securebanking.model.InternalAccount


  @RequestMapping(value="/findMeeting", method = RequestMethod.POST)
  public synchronized ModelAndView findtransactionbyid(@ModelAttribute("transaction") InternalUserTransaction transaction,
      BindingResult result, Principal principal) throws InternalException {
    String name = principal.getName();
    InternalAccount currentuser = intBo.findUserByusername(name);

    if(currentuser.getDeptid() == 5){
      ModelAndView modelAndView = new ModelAndView("CompanyManagementFindMeeting");
      InternalUserTransaction transactionbyid = transactionBO.findTransactionByIdAndDeptId(transaction.getTransId(),5);//5:Company Management
      System.out.println("transaction.getEmployeeId()"+ transactionbyid.getEmployeeId() + "transaction.getDescription()" + transactionbyid.getDescription()+"transaction.getTransId()" + transactionbyid.getTransId()+" transaction.getStatus()" +transactionbyid.getStatus());
      modelAndView.addObject("transactionbyid", transactionbyid);
      return modelAndView;
View Full Code Here


  @RequestMapping(method = RequestMethod.GET)
  public synchronized ModelAndView initForm(ModelMap model, Principal principal){


    String name = principal.getName();
    InternalAccount currentuser = intBo.findUserByusername(name);

    if(currentuser.getDeptid() == 1){
      ModelAndView modelAndView = new ModelAndView("salestransactionManagement");
      modelAndView.addObject("currentuser", currentuser);

      ExternalAccount extuser = new ExternalAccount();
      modelAndView.addObject("extuser", extuser);

      System.out.println("enteringcc");
      List<ExternalAccount> ccreqs = extBo.getccreq();
      if(ccreqs != null){
        modelAndView.addObject("ccreqs", ccreqs);
      }

      List<CreditcardRequests> appccreqs = ccreqsBo.getallCreditcardRequests();
      modelAndView.addObject("appccreqs", appccreqs);

      return modelAndView;

    } else if(currentuser.getDeptid() == 4){
      ModelAndView modelAndView = new ModelAndView("hrtransactionManagement");
      modelAndView.addObject("currentuser", currentuser);

      InternalAccount user = new InternalAccount();
      modelAndView.addObject("user", user);

      return modelAndView;
    } else{
      ModelAndView modelAndView = new ModelAndView("accessdenied");
View Full Code Here

  @RequestMapping(value="/updatesalary", method = RequestMethod.POST)
  public synchronized ModelAndView updatesalary(@ModelAttribute("user") InternalAccount user,
      BindingResult result, Principal principal) throws InternalException {
    String name = principal.getName();
    InternalAccount currentuser = intBo.findUserByusername(name);

    ModelAndView modelAndView = new ModelAndView("internalmgmtsuccessmsg");
    intBo.updatesalary(user.getEmployeeId(), user.getSalary());
    System.out.println("Salary updated!");
    String message = "Salary for Employee ID "+user.getEmployeeId()+ " updated!";
View Full Code Here

  /*----------------Sales----------------------*/

  @RequestMapping(value="/displayexternalusers")
  public synchronized ModelAndView displayexternalusers(Principal principal) {
    String name = principal.getName();
    InternalAccount currentuser = intBo.findUserByusername(name);
    if(currentuser.getDeptid() == 1){
      ModelAndView modelAndView = new ModelAndView("listExternalUsers");
      List<ExternalAccount> users = extBo.getdetails();
      System.out.println(users.listIterator());
      modelAndView.addObject("users", users);
      return modelAndView;
View Full Code Here

    int userid = 0;
    int empid = 0;
    String email = null;
    String username = name;
    boolean ftl = false;
    InternalAccount ia=null;
    ExternalAccount ea = loginAttemptBO.findAccountByNameExternal(name);
    if(ea == null){
      ia = loginAttemptBO.findAccountByNameInternal(name);
      if(ia != null){
        userid = 0;
        empid = ia.getEmployeeId();
        email = ia.getEmail();
        ftl = ia.getFirstTimeLogin();
      }
    }else{
      //external use case
      userid = ea.getUserid();
      empid = 0;
View Full Code Here

    Authentication auth = SecurityContextHolder.getContext().getAuthentication();
    if (!(auth instanceof AnonymousAuthenticationToken)) {
      ModelAndView modelAndView = new ModelAndView("welcomepage");
      String name = principal.getName();
      InternalAccount currentuser = internalAccountBO.findUserByusername(name);
      modelAndView.addObject("currentuser", currentuser);
      return modelAndView;
    } else{
      ModelAndView modelAndView = new ModelAndView("login");
      return modelAndView;
View Full Code Here

    return "login";
  }
  @RequestMapping(value="/ForgetPwd", method = RequestMethod.GET)
  public ModelAndView forgetPwd(ModelMap model) {
     InternalAccount forgot_user = new InternalAccount();
     ModelAndView modelAndView = new ModelAndView("ForgetPassword");
     modelAndView.addObject("forgot_user", forgot_user);
      return modelAndView;
  }
View Full Code Here

   
    Authentication auth = SecurityContextHolder.getContext().getAuthentication();
    if (!(auth instanceof AnonymousAuthenticationToken)) {
      ModelAndView modelAndView = new ModelAndView("welcomepage");
      String name = principal.getName();
      InternalAccount currentuser = internalAccountBO.findUserByusername(name);
      modelAndView.addObject("currentuser", currentuser);
      return modelAndView;
    } else{
      ModelAndView modelAndView = new ModelAndView("login");
      return modelAndView;
View Full Code Here

    LoginAttemptBO loginAttemptBO = (LoginAttemptBO)appContext.getBean("loginAttemptBO");
    OTPBO otpBO = (OTPBO)appContext.getBean("OTPBO");
   
    int userid=0;
    int empid=0;
    InternalAccount ia = null;
    String name = principal.getName();
   
    ExternalAccount ea = loginAttemptBO.findAccountByNameExternal(name);
    if(ea == null){
      ia = loginAttemptBO.findAccountByNameInternal(name);
      if(ia != null){
        userid = 0;
        empid = ia.getEmployeeId();
       
      }
    }else{
      //external use case
      userid = ea.getUserid();
      empid = 0;   
    }
    OTP indatabase = otpBO.findAccountByName(userid,empid);
   
    //suppose user provided valid one-time-password
     
        java.util.Date current_date = new java.util.Date();
        java.sql.Timestamp current_timestamp = new java.sql.Timestamp(current_date.getTime());
        long current_time = current_timestamp.getTime();
        long db_time = indatabase.gettime().getTime();
        long time_diff = current_time - db_time; //5 minutes = 5 * 60 * 1000 (ms) =300,000
        // Need to be modified!!!
        if(oneTimePassword.equals(indatabase.getotp()) && time_diff < 300000){
          System.out.println("Ok!!!");
         
          // delete the one time login entry
          otpBO.delete(indatabase);
          //set first time login to false
          if(ea != null)
          {
            ea.setFirstTimeLogin(false);
            externalAccountBO.update(ea);
          }
          if(ia != null)
          {
            ia.setFirstTimeLogin(false);
            internalAccountBO.update(ia);
          }
         
          return "OTPValidationSuccess";
        }else{
View Full Code Here

    String otp_pwd = this.generateOTP();
   
    //find user from database and update password
   
    if(userType == "INTERNAL"){
      InternalAccount ia = loginAttemptBO.findAccountByNameInternal(forgot_user.getUsername());
      if(ia != null)
      {
          try{
              MessageDigest digest = MessageDigest.getInstance("SHA-256");
              byte[] hash = digest.digest(otp_pwd.getBytes("UTF-8"));
              StringBuffer hexString = new StringBuffer();

              for (int i = 0; i < hash.length; i++) {
                  String hex = Integer.toHexString(0xff & hash[i]);
                  if(hex.length() == 1) hexString.append('0');
                  hexString.append(hex);
              }
              this.sendPwdRecoveryEmail(ia.getEmail(), ia.getUsername(), otp_pwd);
              ia.setPassword(hexString.toString());
              //ia.setPassword(otp_pwd);
              createInternalAccountBO.update(ia);
          } catch(Exception ex){
             throw new RuntimeException(ex);
          }
View Full Code Here

TOP

Related Classes of edu.asu.securebanking.model.InternalAccount

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.