return new ForwardResolution("/WEB-INF/jsp/inregistrare.jsp");
}
public Resolution submit() {
IGeologDao geoDao = new GeologDao();
Geolog geolog = geoDao.geologExistent(username, parola);
if (geolog != null) {
getContext().getRequest().getSession(true).setAttribute("user", geolog.getIdGeolog());
return new ForwardResolution("/WEB-INF/jsp/geologLogat.jsp");
} else {
String confirmareVizibilitate;
String acceptare = "in asteptare";
if (getVizibilitate() == null) {
confirmareVizibilitate = "nu";
} else {
confirmareVizibilitate = "da";
}
byte[] parolaB = parola.getBytes();
try {
MessageDigest algorithm = MessageDigest.getInstance("MD5");
algorithm.reset();
algorithm.update(parolaB);
byte messageDigest[] = algorithm.digest();
StringBuffer hexString = new StringBuffer();
for (int i = 0; i < messageDigest.length; i++) {
hexString.append(Integer.toHexString(0xFF & messageDigest[i]));
}
parola = hexString + "";
} catch (Exception e) {
}
if (!isEmailValid(email)) {
setEmailInvalid(true);
return new ForwardResolution("/WEB-INF/jsp/inregistrare.jsp");
}
if (!isNumeric(telefon) || telefon.length() != 10) {
setTelefonInvalid(true);
return new ForwardResolution("/WEB-INF/jsp/inregistrare.jsp");
}
setGeologAdaugat(true);
geoDao.saveOrUpdate(new Geolog(nume, prenume, telefon, email, adresa, username, parola, confirmareVizibilitate, acceptare));
return new ForwardResolution("/WEB-INF/jsp/inregistrare.jsp");
}
}