@Util public static void PopupPassValidateCopy(String accion, Agente dbAgente, Agente agente) { CustomValidation.clearValidadas(); if (secure.checkGrafico( "noEditable", "editable", accion, (Map<String, Long>) tags.TagMapStack.top("idParams"), null)) { CustomValidation.valid("agente", agente); dbAgente.username = agente.username; } CustomValidation.valid("agente", agente); CustomValidation.required("agente.verificacion", agente.verificacion); CustomValidation.required("agente.newpassword", agente.newpassword); CustomValidation.compare(agente.newpassword, params.get("agente_newpasswordcopy")); if (agente.verificacion != null) { // agente.verificación = contraseña actual if (dbAgente.password.equals(Crypto.passwordHash(agente.verificacion))) { dbAgente.password = Crypto.passwordHash(agente.newpassword); log.info("El usuario <" + dbAgente.username + "> ha modificado su contraseña"); } else { Validation.addError("password", "Contraseña actual incorrecta"); } } // else { // dbAgente.password = Crypto.passwordHash(agente.newpassword); // log.info("El usuario <" + dbAgente.username + "> ha modificado su contraseña"); // } }
public static User connect(String login, String password) { return find( "SELECT u FROM User u WHERE (u.email = ?1 OR u.username = ?1) and u.password = ?2", login, Crypto.passwordHash(password)) .first(); }
public User(String email, String password, String username) { this.email = email; this.password = Crypto.passwordHash(password); this.username = username; Skins.setSkin(this.profile, "DEFAULT"); // set skin as default skin // this.education = new ArrayList<Enrollment>(); }
public static void hashPasswords() { List<User> users = User.findAll(); for (User u : users) { u.password = Crypto.passwordHash(u.password); u.save(); } }
public static User connect(String email, String password) { return find("byEmailAndPassword", email, Crypto.passwordHash(password)).first(); }