From f2cf6093e60169f7502b692ca9bf24411c9c8be8 Mon Sep 17 00:00:00 2001 From: jeb228 Date: Wed, 10 Nov 2010 20:13:00 +0000 Subject: [PATCH] NIHVIVO-1207 Make LoginProcessBean.Message a simple class instead of an enum, so LoginShibboleth can create additional instances. --- .../controller/login/LoginProcessBean.java | 50 ++++++++++--------- 1 file changed, 26 insertions(+), 24 deletions(-) diff --git a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/login/LoginProcessBean.java b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/login/LoginProcessBean.java index b3c3eeb99..749579dc9 100644 --- a/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/login/LoginProcessBean.java +++ b/webapp/src/edu/cornell/mannlib/vitro/webapp/controller/login/LoginProcessBean.java @@ -97,54 +97,56 @@ public class LoginProcessBean { NOWHERE, LOGGING_IN, FORCED_PASSWORD_CHANGE, LOGGED_IN } - private enum MLevel { + public enum MLevel { NONE, INFO, ERROR } - public enum Message { - NO_MESSAGE("", MLevel.NONE), + public static class Message { + public static final Message NO_MESSAGE = new Message("", MLevel.NONE); - PASSWORD_CHANGE_SAVED("Your password has been saved.
" - + "Please log in.", MLevel.INFO), + public static final Message PASSWORD_CHANGE_SAVED = new Message( + "Your password has been saved.
" + "Please log in.", + MLevel.INFO); - NO_USERNAME("Please enter your email address.", MLevel.ERROR), + public static final Message NO_USERNAME = new Message( + "Please enter your email address.", MLevel.ERROR); - NO_PASSWORD("Please enter your password.", MLevel.ERROR), + public static final Message NO_PASSWORD = new Message( + "Please enter your password.", MLevel.ERROR); - UNKNOWN_USERNAME("The email or password you entered is incorrect.", - MLevel.ERROR), + public static final Message UNKNOWN_USERNAME = new Message( + "The email or password you entered is incorrect.", MLevel.ERROR); - INCORRECT_PASSWORD("The email or password you entered is incorrect.", - MLevel.ERROR), + public static final Message INCORRECT_PASSWORD = new Message( + "The email or password you entered is incorrect.", MLevel.ERROR); - NO_NEW_PASSWORD("Please enter your new password.", MLevel.ERROR), + public static final Message NO_NEW_PASSWORD = new Message( + "Please enter your new password.", MLevel.ERROR); - MISMATCH_PASSWORD("The passwords entered do not match.", MLevel.ERROR), + public static final Message MISMATCH_PASSWORD = new Message( + "The passwords entered do not match.", MLevel.ERROR); - PASSWORD_LENGTH( + public static final Message PASSWORD_LENGTH = new Message( "Please enter a password between {0} and {1} characters in length.", - MLevel.ERROR), + MLevel.ERROR); - USING_OLD_PASSWORD("Please choose a different password from the " - + "temporary one provided initially.", MLevel.ERROR); + public static final Message USING_OLD_PASSWORD = new Message( + "Please choose a different password from the " + + "temporary one provided initially.", MLevel.ERROR); private final String format; private final MLevel messageLevel; - Message(String format, MLevel messageLevel) { + public Message(String format, MLevel messageLevel) { this.format = format; this.messageLevel = messageLevel; } - String getFormat() { - return this.format; - } - - MLevel getMessageLevel() { + public MLevel getMessageLevel() { return this.messageLevel; } - String formatMessage(Object[] args) { + public String formatMessage(Object[] args) { return new MessageFormat(this.format).format(args); } }