@Override @Transactional public boolean updatePassword(String user, boolean create) throws IOException { // Make sure user is specified correctly if (StringUtils.isBlank(user)) { System.err.println("You did not specify a valid user name. Please try again."); return false; } // attempt to get the account form the database ILocalAccountPerson account = this.localAccountDao.getPerson(user); if (account == null) { if (!create) { System.err.println("No such user: " + user); return false; } account = this.localAccountDao.createPerson(user); } System.out.print("Enter Password for " + user + ": "); System.out.flush(); // Needed for prompt to appear when running from Ant. final BufferedReader d = new BufferedReader(new InputStreamReader(System.in, UTF_8)); final String spass = d.readLine(); // update the user's password final String encryptedPassword = this.portalPasswordService.encryptPassword(spass); account.setPassword(encryptedPassword); this.localAccountDao.updateAccount(account); System.out.println("Password Updated..."); return true; }
@Override @Transactional public void updatePassword(String user, String spass, boolean create) throws IOException { // Make sure user is specified correctly if (StringUtils.isBlank(user)) { throw new IllegalArgumentException( "You did not specify a valid user name. Please try again."); } // attempt to get the account form the database ILocalAccountPerson account = this.localAccountDao.getPerson(user); if (account == null) { if (!create) { throw new IllegalArgumentException("No such user: " + user); } account = this.localAccountDao.createPerson(user); } // update the user's password final String encryptedPassword = this.portalPasswordService.encryptPassword(spass); account.setPassword(encryptedPassword); this.localAccountDao.updateAccount(account); logger.info("Password Updated for: {}", user); } }
account.setPassword(passwordService.encryptPassword(password)); account.setLastPasswordChange(new Date()); account.removeAttribute("loginToken");
account = this.localAccountDao.createPerson(username); account.setPassword(password); final Calendar lastPasswordChange = userType.getLastPasswordChange(); if (lastPasswordChange != null) {
account.setPassword(passwordService.encryptPassword(form.getPassword())); account.setLastPasswordChange(new Date()); account.removeAttribute("loginToken");