<ant antfile="${project.addressbook-lib}/build.xml" inheritall="false" target="jar">
<property name="deploy.on.save" value="false"/>
</ant>
+ <ant antfile="${project.juser-lib}/build.xml" inheritall="false" target="jar">
+ <property name="deploy.on.save" value="false"/>
+ </ant>
</target>
<target depends="init" if="dist.ear.dir" name="deps-ear-jar" unless="no.deps">
<ant antfile="${project.addressbook-lib}/build.xml" inheritall="false" target="jar">
<property name="deploy.on.save" value="false"/>
</ant>
+ <ant antfile="${project.juser-lib}/build.xml" inheritall="false" target="jar">
+ <property name="deploy.on.save" value="false"/>
+ </ant>
</target>
<target depends="init, deps-module-jar, deps-ear-jar" name="deps-jar" unless="no.deps"/>
<target depends="init,deps-jar" name="-pre-pre-compile">
<copyfiles files="${reference.addressbook-lib.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
<copyfiles files="${file.reference.cdi-api.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
<copyfiles files="${file.reference.gf-client.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
+ <copyfiles files="${reference.juser-lib.jar}" iftldtodir="${build.web.dir}/WEB-INF" todir="${dist.ear.dir}/lib"/>
<mkdir dir="${build.web.dir}/META-INF"/>
<manifest file="${build.web.dir}/META-INF/MANIFEST.MF" mode="update"/>
</target>
<copyfiles files="${reference.addressbook-lib.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
<copyfiles files="${file.reference.cdi-api.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
<copyfiles files="${file.reference.gf-client.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
+ <copyfiles files="${reference.juser-lib.jar}" todir="${build.web.dir}/WEB-INF/lib"/>
</target>
<target depends="init" if="dist.ear.dir" name="-clean-webinf-lib">
<delete dir="${build.web.dir}/WEB-INF/lib"/>
-->
<target depends="init" name="deps-clean" unless="no.deps">
<ant antfile="${project.addressbook-lib}/build.xml" inheritall="false" target="clean"/>
+ <ant antfile="${project.juser-lib}/build.xml" inheritall="false" target="clean"/>
</target>
<target depends="init" name="do-clean">
<condition property="build.dir.to.clean" value="${build.web.dir}">
-build.xml.data.CRC32=d8bc4ea8
+build.xml.data.CRC32=f85eb01a
build.xml.script.CRC32=be5f34f7
build.xml.stylesheet.CRC32=651128d4@1.68.1.1
# This file is used by a NetBeans-based IDE to track changes in generated files such as build-impl.xml.
# Do not edit this file. You may delete it but then the IDE will never regenerate such files for you.
-nbproject/build-impl.xml.data.CRC32=d8bc4ea8
-nbproject/build-impl.xml.script.CRC32=855e3438
+nbproject/build-impl.xml.data.CRC32=f85eb01a
+nbproject/build-impl.xml.script.CRC32=045dff2a
nbproject/build-impl.xml.stylesheet.CRC32=99ea4b56@1.68.1.1
${file.reference.juser-lib.jar}:\
${reference.addressbook-lib.jar}:\
${file.reference.cdi-api.jar}:\
- ${file.reference.gf-client.jar}
+ ${file.reference.gf-client.jar}:\
+ ${reference.juser-lib.jar}
# Space-separated list of extra javac options
javac.compilerargs=-Xlint:unchecked -Xlint:deprecation
javac.debug=true
persistence.xml.dir=${conf.dir}
platform.active=default_platform
project.addressbook-lib=../addressbook-lib
+project.juser-lib=../juser-lib
project.license=gpl30
reference.addressbook-lib.jar=${project.addressbook-lib}/dist/addressbook-lib.jar
+reference.juser-lib.jar=${project.juser-lib}/dist/juser-lib.jar
resource.dir=setup
run.test.classpath=\
${javac.test.classpath}:\
<file>${file.reference.gf-client.jar}</file>
<path-in-war>WEB-INF/lib</path-in-war>
</library>
+ <library dirs="200">
+ <file>${reference.juser-lib.jar}</file>
+ <path-in-war>WEB-INF/lib</path-in-war>
+ </library>
</web-module-libraries>
<web-module-additional-libraries/>
<source-roots>
<clean-target>clean</clean-target>
<id>jar</id>
</reference>
+ <reference>
+ <foreign-project>juser-lib</foreign-project>
+ <artifact-type>jar</artifact-type>
+ <script>build.xml</script>
+ <target>jar</target>
+ <clean-target>clean</clean-target>
+ <id>jar</id>
+ </reference>
</references>
</configuration>
</project>
--- /dev/null
+/*
+ * Copyright (C) 2015 Roland Haeder
+ *
+ * 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.beans.login;
+
+import javax.enterprise.context.SessionScoped;
+import javax.faces.view.facelets.FaceletException;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import org.mxchange.addressbook.beans.user.UserWebController;
+import org.mxchange.jusercore.exceptions.UserNotFoundException;
+import org.mxchange.jusercore.exceptions.UserStatusLockedException;
+import org.mxchange.jusercore.exceptions.UserStatusUnconfirmedException;
+import org.mxchange.jusercore.model.login.UserLoginSessionBeanRemote;
+import org.mxchange.jusercore.model.user.User;
+
+/**
+ * A web bean for user registration
+ * <p>
+ * @author Roland Haeder
+ */
+@Named ("loginController")
+@SessionScoped
+public class UserLoginWebBean implements UserLoginWebController {
+
+ /**
+ * Reemote register session bean
+ */
+ private UserLoginSessionBeanRemote login;
+
+ /**
+ * User controller
+ */
+ @Inject
+ private UserWebController userController;
+
+ /**
+ * Serial number
+ */
+ private static final long serialVersionUID = 47_828_986_719_691_592L;
+
+ /**
+ * Default constructor
+ */
+ public UserLoginWebBean () {
+ try {
+ // Get initial context
+ Context context = new InitialContext();
+
+ // Try to lookup
+ this.login = (UserLoginSessionBeanRemote) context.lookup("ejb/stateless-login"); //NOI18N
+ } catch (final NamingException ex) {
+ // Continue to throw
+ throw new FaceletException(ex);
+ }
+ }
+
+ @Override
+ public void doLogin () {
+ // Get user instance
+ User user = this.userController.createUserInstance();
+
+ try {
+ // Call bean
+ this.login.loginUser(user);
+ } catch (final UserNotFoundException | UserStatusLockedException | UserStatusUnconfirmedException ex) {
+ // Throw again
+ throw new FaceletException(ex);
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (C) 2015 Roland Haeder
+ *
+ * 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.beans.login;
+
+import java.io.Serializable;
+
+/**
+ * An interface for registration web controllers
+ * <p>
+ * @author Roland Haeder
+ */
+public interface UserLoginWebController extends Serializable {
+
+ /**
+ * Logins the user, if the account is found, confirmed and unlocked.
+ */
+ public void doLogin ();
+}
--- /dev/null
+/*
+ * Copyright (C) 2015 Roland Haeder
+ *
+ * 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.beans.register;
+
+import javax.enterprise.context.SessionScoped;
+import javax.faces.view.facelets.FaceletException;
+import javax.inject.Inject;
+import javax.inject.Named;
+import javax.naming.Context;
+import javax.naming.InitialContext;
+import javax.naming.NamingException;
+import org.mxchange.addressbook.beans.user.UserWebController;
+import org.mxchange.jusercore.exceptions.UserAlreadyRegisteredException;
+import org.mxchange.jusercore.model.register.UserRegistrationSessionBeanRemote;
+import org.mxchange.jusercore.model.user.User;
+
+/**
+ * A web bean for user registration
+ * <p>
+ * @author Roland Haeder
+ */
+@Named ("registerController")
+@SessionScoped
+public class UserRegisterWebBean implements UserRegisterWebController {
+
+ /**
+ * Reemote register session bean
+ */
+ private UserRegistrationSessionBeanRemote register;
+
+ /**
+ * User controller
+ */
+ @Inject
+ private UserWebController userController;
+
+ /**
+ * Serial number
+ */
+ private static final long serialVersionUID = 47_828_986_719_691_592L;
+
+ /**
+ * Default constructor
+ */
+ public UserRegisterWebBean () {
+ try {
+ // Get initial context
+ Context context = new InitialContext();
+
+ // Try to lookup
+ this.register = (UserRegistrationSessionBeanRemote) context.lookup("ejb/stateless-register"); //NOI18N
+ } catch (final NamingException ex) {
+ // Continue to throw
+ throw new FaceletException(ex);
+ }
+ }
+
+ @Override
+ public void doRegister () {
+ // Get user instance
+ User user = this.userController.createUserInstance();
+
+ try {
+ // Call bean
+ this.register.registerUser(user);
+ } catch (final UserAlreadyRegisteredException ex) {
+ // Continue to throw
+ throw new FaceletException(ex);
+ }
+ }
+}
--- /dev/null
+/*
+ * Copyright (C) 2015 Roland Haeder
+ *
+ * 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.beans.register;
+
+import java.io.Serializable;
+
+/**
+ * An interface for registration web controllers
+ * <p>
+ * @author Roland Haeder
+ */
+public interface UserRegisterWebController extends Serializable {
+
+ /**
+ * Registers the user, if not found. Otherwise this method should throw an
+ * exception.
+ */
+ public void doRegister ();
+}
*/
private String userName;
+ /**
+ * User password (unencrypted from web form)
+ */
+ private String userPassword;
+
/**
* ZIP code
*/
this.userName = userName;
}
+ @Override
+ public String getUserPassword () {
+ return this.userPassword;
+ }
+
+ @Override
+ public void setUserPassword (final String userPassword) {
+ this.userPassword = userPassword;
+ }
+
@Override
public Integer getZipCode () {
return this.zipCode;
*/
public void setUserName (final String userName);
+ /**
+ * Getter for unencrypted user password
+ * <p>
+ * @return Unencrypted user password
+ */
+ public String getUserPassword ();
+
+ /**
+ * Setter for unencrypted user password
+ * <p>
+ * @param userPassword Unencrypted user password
+ */
+ public void setUserPassword (final String userPassword);
+
/**
* Company name
* <p>
<div class="table_row">
<div class="table_left">
- <h:outputLabel for="id" value="#{msg.ENTER_USER_NAME}" />
+ <h:outputLabel for="userName" value="#{msg.ENTER_USER_NAME}" />
</div>
<div class="table_right">
- <h:inputText class="input" id="id" size="10" maxlength="20" required="true" requiredMessage="#{msg.LOGIN_NO_USER_NAME_MESSAGE}" />
+ <h:inputText class="input" id="userName" value="#{userController.userName}" size="10" maxlength="20" required="true" requiredMessage="#{msg.LOGIN_NO_USER_NAME_MESSAGE}" />
</div>
</div>
<div class="table_row">
<div class="table_left">
- <h:outputLabel for="password" value="#{msg.ENTER_PASSWORD}" />
+ <h:outputLabel for="userPassword" value="#{msg.ENTER_PASSWORD}" />
</div>
<div class="table_right">
- <h:inputSecret class="input" id="password" size="10" maxlength="255" required="true" requiredMessage="#{msg.LOGIN_NO_PASSWORD_MESSAGE}" />
+ <h:inputSecret class="input" id="userPassword" value="#{userController.userPassword}" size="10" maxlength="255" required="true" requiredMessage="#{msg.LOGIN_NO_PASSWORD_MESSAGE}" />
</div>
</div>
<div class="table_footer">
<h:commandButton class="reset" type="reset" value="#{msg.BUTTON_RESET_FORM}" />
- <h:commandButton class="submit" type="submit" action="#{controller.doLogin()}" value="#{msg.BUTTON_USER_LOGIN}" />
+ <h:commandButton class="submit" type="submit" action="#{loginController.doLogin()}" value="#{msg.BUTTON_USER_LOGIN}" />
</div>
</div>
</h:form>
<welcome-file-list>
<welcome-file>faces/index.xhtml</welcome-file>
</welcome-file-list>
+ <security-constraint>
+ <display-name>Constraint1</display-name>
+ <web-resource-collection>
+ <web-resource-name>loginArea</web-resource-name>
+ <description>Login area</description>
+ <url-pattern>/llogin/*</url-pattern>
+ </web-resource-collection>
+ <auth-constraint>
+ <description>User Authentication</description>
+ <role-name>user</role-name>
+ </auth-constraint>
+ </security-constraint>
+ <login-config>
+ <auth-method>FORM</auth-method>
+ <realm-name>Loginbereich / Login area</realm-name>
+ <form-login-config>
+ <form-login-page>/user/login.xhtml</form-login-page>
+ <form-error-page>/user/login_error.xhtml</form-error-page>
+ </form-login-config>
+ </login-config>
+ <security-role>
+ <description>A logged-in user that has previously registered himself/herself.</description>
+ <role-name>user</role-name>
+ </security-role>
+ <mime-mapping>
+ <extension>tpl</extension>
+ <mime-type>text/plain</mime-type>
+ </mime-mapping>
</web-app>
<ui:define name="content">
<div class="para">
<!-- TODO Internatialize this somehow //-->
- Noch kein Kunde? Einfach beim Bestellen anmelden oder <h:link id="user_register" outcome="user_register" title="Als Kunde anmelden">hier</h:link> anmelden.
+ Noch kein Benutzerkonto? Einfach <h:link id="user_register" outcome="user_register" title="Als Benutzer anmelden">hier</h:link> anmelden.
</div>
<div class="para">
--- /dev/null
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
+<html xmlns="http://www.w3.org/1999/xhtml"
+ xmlns:ui="http://java.sun.com/jsf/facelets"
+ xmlns:h="http://xmlns.jcp.org/jsf/html"
+ xmlns:c="http://xmlns.jcp.org/jsp/jstl/core"
+ xmlns:f="http://xmlns.jcp.org/jsf/core"
+ >
+
+ <ui:composition template="/WEB-INF/templates/guest/guest_base.tpl" id="login_error">
+ <ui:define name="title">#{msg.PAGE_TITLE_USER_LOGIN_ERROR}</ui:define>
+
+ <ui:define name="menu">
+ <ui:include id="menu" class="guest_menu" src="/WEB-INF/templates/guest/guest_menu.tpl" />
+ </ui:define>
+
+ <ui:define name="content_header">
+ #{msg.SUB_TITLE_USER_LOGIN_ERROR}
+ </ui:define>
+
+ <ui:define name="content">
+ Hier kommt die Fehlermeldung hin.
+ </ui:define>
+
+ <ui:define name="footer">
+ <ui:include id="footer" class="guest_footer" src="/WEB-INF/templates/guest/guest_footer.tpl" />
+ </ui:define>
+ </ui:composition>
+</html>