]> git.mxchange.org Git - pizzaservice-war.git/commitdiff
renamed package
authorRoland Häder <roland@mxchange.org>
Fri, 13 May 2016 09:12:48 +0000 (11:12 +0200)
committerRoland Haeder <roland@mxchange.org>
Fri, 13 May 2016 19:45:28 +0000 (21:45 +0200)
Signed-off-by: Roland Häder <roland@mxchange.org>
src/java/org/mxchange/pizzaapplication/validator/password/PizzaUserPasswordValidator.java [new file with mode: 0644]
src/java/org/mxchange/pizzaapplication/validators/password/PizzaUserPasswordValidator.java [deleted file]

diff --git a/src/java/org/mxchange/pizzaapplication/validator/password/PizzaUserPasswordValidator.java b/src/java/org/mxchange/pizzaapplication/validator/password/PizzaUserPasswordValidator.java
new file mode 100644 (file)
index 0000000..e834e1f
--- /dev/null
@@ -0,0 +1,102 @@
+/*
+ * Copyright (C) 2016 Roland Haeder
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as
+ * published by the Free Software Foundation, either version 3 of the
+ * License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.pizzaapplication.validator.password;
+
+import java.text.MessageFormat;
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.validator.FacesValidator;
+import javax.faces.validator.Validator;
+import javax.faces.validator.ValidatorException;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import org.mxchange.jcoreee.validator.string.BaseStringValidator;
+import org.mxchange.jcoreeelogger.beans.local.logger.Log;
+import org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal;
+import org.mxchange.jusercore.container.login.LoginContainer;
+import org.mxchange.jusercore.container.login.UserLoginContainer;
+import org.mxchange.jusercore.model.user.UserUtils;
+import org.mxchange.pizzaapplication.beans.login.PizzaUserLoginWebSessionController;
+
+/**
+ * A validator for validating passwords (if they match with stored)
+ * <p>
+ * @author Roland Haeder<roland@mxchange.org>
+ */
+@FacesValidator (value = "PizzaUserPasswordValidator")
+public class PizzaUserPasswordValidator extends BaseStringValidator implements Validator {
+
+       /**
+        * Serial number
+        */
+       private static final long serialVersionUID = 48_581_795_687_317L;
+
+       /**
+        * Logger instance
+        */
+       @Log
+       private LoggerBeanLocal loggerBeanLocal;
+
+       /**
+        * User login controller
+        */
+       private PizzaUserLoginWebSessionController userLoginController;
+
+       /**
+        * Default constructor
+        */
+       public PizzaUserPasswordValidator () {
+               // Try to get it
+               try {
+                       // Get initial context
+                       Context context = new InitialContext();
+
+                       // Lookup logger
+                       this.loggerBeanLocal = (LoggerBeanLocal) context.lookup("java:global/jcore-logger-ejb/logger!org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal"); //NOI18N
+               } catch (final NamingException ex) {
+                       // Continue to throw it
+                       throw new RuntimeException(MessageFormat.format("context.lookup() failed: {0}", ex.getMessage()), ex); //NOI18N
+               }
+       }
+
+       @Override
+       public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException {
+               // Trace message
+               this.loggerBeanLocal.logTrace(MessageFormat.format("validate: context={0},component={1},value={2} - CALLED!", context, component, value)); //NOI18N
+
+               // The required field
+               String[] requiredFields = {"currentPassword"}; //NOI18N
+
+               // Pre-validation (example: not null, not a string, empty string ...)
+               super.preValidate(context, component, value, requiredFields, false);
+
+               // value is known to be an entered password, so instance login container
+               LoginContainer container = new UserLoginContainer(this.userLoginController.getLoggedInUser(), (String) value);
+
+               // Test it here
+               if (!UserUtils.ifPasswordMatches(container, this.userLoginController.getLoggedInUser())) {
+                       // Password mismatches
+                       throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Password mismatching.", "The password the user has entered does not match the stored password.")); //NOI18N
+               }
+
+               // Trace message
+               this.loggerBeanLocal.logTrace("validate: EXIT!"); //NOI18N
+       }
+
+}
diff --git a/src/java/org/mxchange/pizzaapplication/validators/password/PizzaUserPasswordValidator.java b/src/java/org/mxchange/pizzaapplication/validators/password/PizzaUserPasswordValidator.java
deleted file mode 100644 (file)
index d46aa76..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-/*
- * Copyright (C) 2016 Roland Haeder
- *
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as
- * published by the Free Software Foundation, either version 3 of the
- * License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU Affero General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
-package org.mxchange.pizzaapplication.validators.password;
-
-import java.text.MessageFormat;
-import javax.faces.application.FacesMessage;
-import javax.faces.component.UIComponent;
-import javax.faces.context.FacesContext;
-import javax.faces.validator.FacesValidator;
-import javax.faces.validator.Validator;
-import javax.faces.validator.ValidatorException;
-import javax.naming.Context;
-import javax.naming.InitialContext;
-import javax.naming.NamingException;
-import org.mxchange.jcoreee.validator.string.BaseStringValidator;
-import org.mxchange.jcoreeelogger.beans.local.logger.Log;
-import org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal;
-import org.mxchange.jusercore.container.login.LoginContainer;
-import org.mxchange.jusercore.container.login.UserLoginContainer;
-import org.mxchange.jusercore.model.user.UserUtils;
-import org.mxchange.pizzaapplication.beans.login.PizzaUserLoginWebSessionController;
-
-/**
- * A validator for validating passwords (if they match with stored)
- * <p>
- * @author Roland Haeder<roland@mxchange.org>
- */
-@FacesValidator (value = "PizzaUserPasswordValidator")
-public class PizzaUserPasswordValidator extends BaseStringValidator implements Validator {
-
-       /**
-        * Serial number
-        */
-       private static final long serialVersionUID = 48_581_795_687_317L;
-
-       /**
-        * Logger instance
-        */
-       @Log
-       private LoggerBeanLocal loggerBeanLocal;
-
-       /**
-        * User login controller
-        */
-       private PizzaUserLoginWebSessionController userLoginController;
-
-       /**
-        * Default constructor
-        */
-       public PizzaUserPasswordValidator () {
-               // Try to get it
-               try {
-                       // Get initial context
-                       Context context = new InitialContext();
-
-                       // Lookup logger
-                       this.loggerBeanLocal = (LoggerBeanLocal) context.lookup("java:global/jcore-logger-ejb/logger!org.mxchange.jcoreeelogger.beans.local.logger.LoggerBeanLocal"); //NOI18N
-               } catch (final NamingException ex) {
-                       // Continue to throw it
-                       throw new RuntimeException(MessageFormat.format("context.lookup() failed: {0}", ex.getMessage()), ex); //NOI18N
-               }
-       }
-
-       @Override
-       public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException {
-               // Trace message
-               this.loggerBeanLocal.logTrace(MessageFormat.format("validate: context={0},component={1},value={2} - CALLED!", context, component, value)); //NOI18N
-
-               // The required field
-               String[] requiredFields = {"currentPassword"}; //NOI18N
-
-               // Pre-validation (example: not null, not a string, empty string ...)
-               super.preValidate(context, component, value, requiredFields, false);
-
-               // value is known to be an entered password, so instance login container
-               LoginContainer container = new UserLoginContainer(this.userLoginController.getLoggedInUser(), (String) value);
-
-               // Test it here
-               if (!UserUtils.ifPasswordMatches(container, this.userLoginController.getLoggedInUser())) {
-                       // Password mismatches
-                       throw new ValidatorException(new FacesMessage(FacesMessage.SEVERITY_ERROR, "Password mismatching.", "The password the user has entered does not match the stored password.")); //NOI18N
-               }
-
-               // Trace message
-               this.loggerBeanLocal.logTrace("validate: EXIT!"); //NOI18N
-       }
-
-}