/** * Check if the passwords are equals. The password could also be hashes. * * @param storedPass * @param givenPass * @return true if found the are identically */ public static boolean equals(String storedPass, String givenPass) { if (storedPass == null || givenPass == null) return false; // do not accept empty pass storedPass = storedPass.trim(); givenPass = givenPass.trim(); if (givenPass.length() == 0) return false; if (givenPass.startsWith("`")) { //givenPass = decode(givenPass); return false; // given password can't be encoded, this will give the ability to use the encoded string itself as password instead of clear text } if (storedPass.startsWith(PREFIX)) { if (storedPass.startsWith(PREFIX_HASH_MD5)) { return validatePasswordMD5(givenPass, storedPass); } storedPass = decode(storedPass); } return storedPass.equals(givenPass); }
properties.put("mail.smtp.auth", "true"); properties.put("mail.user", CFG_MAIL_USER.value()); properties.put("mail.password", MPassword.decode(CFG_MAIL_PASSWORD.value()));
} else if (cmd.equals("decodepassword")) { System.out.println( MPassword.decode(parameters[0]));
@Override public InternalDbConnection createConnection() throws Exception { // ResourceNode concon = config.getNode("connection"); String driver = config.getExtracted("driver"); String url = config.getExtracted("url"); String user = config.getExtracted("user"); String pass = config.getExtracted("pass"); if (!MString.isEmpty(driver)) { if (activator != null) activator.getClazz(driver); else Class.forName(driver); } log().t(driver,url,user); Connection con = DriverManager.getConnection(url,user,MPassword.decode(pass)); getDialect().prepareConnection(con); JdbcConnection dbCon = new JdbcConnection(this,con); long timeoutUnused = MPeriod.toMilliseconds( config.getExtracted("timeout_unused"), 0 ); long timeoutLifetime = MPeriod.toMilliseconds( config.getExtracted("timeout_lifetime"), 0 ); if (timeoutUnused > 0) dbCon.setTimeoutUnused(timeoutUnused); if (timeoutLifetime > 0) dbCon.setTimeoutLifetime(timeoutLifetime); return dbCon; }