xxxxxxxxxx
public boolean checkPassword (String userName, String password) {
User user = UserGateway.findByName(userName);
if (user != User.NULL){
String codedPhrase = user.getPhraseEncodedByPassword();
String phrase = cryptographer.decrypt(codedPhrase, password);
if ("Valid Password".equals(phrase)) {
Session.initialize();
return true;
}
}
return false;
}