</Scope>
<Scope Scope="Project">
<Node id="login/login_shared_addressbooks.xhtml" x="400" y="900" zoom="true"/>
- <Node id="login/login_edit_address.xhtml" x="150" y="450" zoom="true"/>
<Node id="login/login_change_password.xhtml" x="1650" y="150" zoom="true"/>
<Node id="privacy.xhtml" x="150" y="300" zoom="true"/>
<Node id="login/login_start_sharing_addressbook.xhtml" x="900" y="450" zoom="true"/>
<Node id="user/resend_link.xhtml" x="400" y="750" zoom="true"/>
<Node id="login/login_index.xhtml" x="900" y="600" zoom="true"/>
<Node id="login/login_own_addressbooks.xhtml" x="150" y="150" zoom="true"/>
- <Node id="terms.xhtml" x="900" y="150" zoom="true"/>
<Node id="admin/admin_logout.xhtml" x="150" y="900" zoom="true"/>
+ <Node id="terms.xhtml" x="900" y="150" zoom="true"/>
<Node id="user/user_list.xhtml" x="400" y="600" zoom="true"/>
<Node id="bye.xhtml" x="650" y="750" zoom="true"/>
<Node id="index.xhtml" x="650" y="450" zoom="true"/>
<Node id="user/register_done.xhtml" x="1400" y="300" zoom="true"/>
<Node id="login/login_change_personal_data.xhtml" x="150" y="600" zoom="true"/>
<Node id="user/user_profile.xhtml" x="400" y="150" zoom="true"/>
+ <Node id="imprint.xhtml" x="1150" y="150" zoom="true"/>
<Node id="*" x="650" y="150" zoom="true"/>
<Node id="user/show_addressbook.xhtml" x="900" y="300" zoom="true"/>
- <Node id="imprint.xhtml" x="1150" y="150" zoom="true"/>
<Node id="user/login_error.xhtml" x="1150" y="450" zoom="true"/>
<Node id="login/login_other_addressbooks.xhtml" x="650" y="600" zoom="true"/>
<Node id="user/show_addressbook_entries.xhtml" x="1650" y="300" zoom="true"/>
--- /dev/null
+/*
+ * Copyright (C) 2016 quix0r
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU 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 General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ */
+package org.mxchange.addressbook.validators.password;
+
+import javax.faces.application.FacesMessage;
+import javax.faces.component.UIComponent;
+import javax.faces.context.FacesContext;
+import javax.faces.validator.Validator;
+import javax.faces.validator.ValidatorException;
+import javax.inject.Inject;
+import org.mxchange.addressbook.beans.login.UserLoginWebSessionController;
+import org.mxchange.jcoreee.validator.string.BaseStringValidator;
+import org.mxchange.jusercore.container.login.LoginContainer;
+import org.mxchange.jusercore.container.login.UserLoginContainer;
+import org.mxchange.jusercore.model.user.UserUtils;
+
+/**
+ * A validator for validating passwords (if they match with stored)
+ * <p>
+ * @author Roland Haeder
+ */
+public class UserPasswordValidator extends BaseStringValidator implements Validator {
+
+ /**
+ * Serial number
+ */
+ private static final long serialVersionUID = 48_581_795_687_317L;
+
+ /**
+ * User login controller
+ */
+ @Inject
+ private UserLoginWebSessionController loginController;
+
+ @Override
+ public void validate (final FacesContext context, final UIComponent component, final Object value) throws ValidatorException {
+ // Trace message
+ //this.getLogger().logTrace(MessageFormat.format("validate: context={0},component={1},value={2} - CALLED!", context, component, value)); //NOI18N
+
+ // The required field
+ String[] requiredFileds = {"currentPassword"}; //NOI18N
+
+ // Pre-validation (example: not null, not a string, empty string ...)
+ super.preValidate(context, component, value, requiredFileds, false);
+
+ // value is known to be an entered password, so instance login container
+ LoginContainer container = new UserLoginContainer(this.loginController.getLoggedInUser(), (String) value);
+
+ // Test it here
+ if (!UserUtils.ifPasswordMatches(container, this.loginController.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.getLogger().logTrace("validate: EXIT!"); //NOI18N
+ }
+}