/** * Do modify the reset password attribute * * @param user the DatabaseUser * @param bNewValue the new value * @param plugin the plugin */ public void doModifyResetPassword(DatabaseUser user, boolean bNewValue, Plugin plugin) { DatabaseUser userStored = DatabaseUserHome.findByPrimaryKey(user.getUserId(), plugin); if (userStored != null) { DatabaseUserHome.updateResetPassword(userStored, bNewValue, plugin); } }
/** * Do modify the password * * @param user the DatabaseUser * @param strPassword the new password not encrypted * @param plugin the plugin */ public void doModifyPassword(DatabaseUser user, String strPassword, Plugin plugin) { // Updates password if (StringUtils.isNotBlank(strPassword)) { // Encrypts password or not String strEncryptedPassword = strPassword; if (_userParamService.isPasswordEncrypted(plugin)) { String strAlgorithm = _userParamService.getEncryptionAlgorithm(plugin); strEncryptedPassword = CryptoService.encrypt(strPassword, strAlgorithm); } DatabaseUser userStored = DatabaseUserHome.findByPrimaryKey(user.getUserId(), plugin); if (userStored != null) { userStored.setPasswordMaxValidDate( SecurityUtils.getPasswordMaxValidDate(_userParamService, plugin)); DatabaseUserHome.updatePassword(userStored, strEncryptedPassword, plugin); } } }