commit
						52ab94906d
					
				| @ -36,6 +36,7 @@ public class MvcConfig extends WebMvcConfigurerAdapter { | ||||
|     public void addViewControllers(final ViewControllerRegistry registry) { | ||||
|         super.addViewControllers(registry); | ||||
|         registry.addViewController("/login.html"); | ||||
|         registry.addViewController("/registration.html"); | ||||
|         registry.addViewController("/logout.html"); | ||||
|         registry.addViewController("/homepage.html"); | ||||
|         registry.addViewController("/expiredAccount.html"); | ||||
|  | ||||
| @ -68,9 +68,7 @@ public class RegistrationController { | ||||
|     @ResponseBody | ||||
|     public GenericResponse registerUserAccount(@Valid final UserDto accountDto, final HttpServletRequest request) { | ||||
|         LOGGER.debug("Registering user account with information: {}", accountDto); | ||||
|         // if (result.hasErrors()) { | ||||
|         // return new GenericResponse(result.getFieldErrors(), result.getGlobalErrors()); | ||||
|         // } | ||||
| 
 | ||||
|         final User registered = createUserAccount(accountDto); | ||||
|         if (registered == null) { | ||||
|             return new GenericResponse("email", messages.getMessage("message.regError", null, request.getLocale())); | ||||
|  | ||||
| @ -17,7 +17,7 @@ code="label.badUser.title"></spring:message></title> | ||||
| 				 ${param.message} | ||||
| </h1> | ||||
| <br> | ||||
| <a href="<c:url value="/old/user/registration" />"><spring:message | ||||
| <a href="<c:url value="/registration.html" />"><spring:message | ||||
| code="label.form.loginSignUp"></spring:message></a> | ||||
| 
 | ||||
| <c:if test="${param.expired}"> | ||||
|  | ||||
| @ -16,7 +16,7 @@ | ||||
|   <spring:message code="auth.message.expired"></spring:message>  | ||||
| </h1> | ||||
| <br> | ||||
| <a href="<c:url value="/old/user/registration" />"><spring:message | ||||
| <a href="<c:url value="/registration.html" />"><spring:message | ||||
| code="label.form.loginSignUp"></spring:message></a> | ||||
| 
 | ||||
| </body> | ||||
|  | ||||
| @ -32,7 +32,7 @@ | ||||
| </div> | ||||
| 
 | ||||
| <br>  | ||||
| <a href="<c:url value="/old/user/registration" />"><spring:message code="label.form.loginSignUp"></spring:message></a> | ||||
| <a href="<c:url value="/registration.html" />"><spring:message code="label.form.loginSignUp"></spring:message></a> | ||||
| <br> | ||||
| <a href="<c:url value="login.html" />"><spring:message code="label.form.loginLink"></spring:message></a> | ||||
| 
 | ||||
|  | ||||
| @ -97,7 +97,7 @@ ${param.message} | ||||
| 
 | ||||
| 			</form> | ||||
| 			<br> Current Locale : ${pageContext.response.locale} <br> <a | ||||
| 				href="<c:url value="/old/user/registration" />"><spring:message | ||||
| 				href="<c:url value="/registration.html" />"><spring:message | ||||
| 					code="label.form.loginSignUp"></spring:message></a> | ||||
| 			<br><br><br> | ||||
|             <a href="<c:url value="/forgetPassword.html" />"><spring:message | ||||
|  | ||||
| @ -1,55 +1,95 @@ | ||||
| <!DOCTYPE html> | ||||
| <%@ page contentType="text/html;charset=UTF-8" language="java"%> | ||||
| <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%> | ||||
| <%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"%> | ||||
| <%@ taglib prefix="spring" uri="http://www.springframework.org/tags"%> | ||||
| <%@ page session="false"%> | ||||
| <html> | ||||
| <head> | ||||
| <link href="<c:url value="/resources/bootstrap.css" />" rel="stylesheet"> | ||||
| <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css"> | ||||
| <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> | ||||
| <title><spring:message code="label.form.title"></spring:message></title> | ||||
| </head> | ||||
| <body> | ||||
| 	<div class="container"> | ||||
| 		<div class="span12"> | ||||
| 			<h1> | ||||
| 				<spring:message code="label.form.title"></spring:message> | ||||
| 			</h1> | ||||
| 			<form:form modelAttribute="user" method="POST" enctype="utf8"> | ||||
| 				<br> | ||||
| 				<tr> | ||||
| 					<td><label><spring:message code="label.user.firstName"></spring:message></label></td> | ||||
| 					<td><form:input path="firstName" value="" /></td> | ||||
| 					<form:errors path="firstName" cssClass="alert alert-error" element="div" /> | ||||
| 				</tr> | ||||
| 				<tr> | ||||
| 					<td><label><spring:message code="label.user.lastName"></spring:message></label></td> | ||||
| 					<td><form:input path="lastName" value="" /></td> | ||||
| 					<form:errors path="lastName" cssClass="alert alert-error" element="div" /> | ||||
| 				</tr> | ||||
| 				<tr> | ||||
| 					<td><label><spring:message code="label.user.email"></spring:message></label></td> | ||||
| 					<td><form:input path="email" value="" /></td> | ||||
| 					<form:errors path="email" cssClass="alert alert-error" element="div" /> | ||||
| 				</tr> | ||||
| 				<tr> | ||||
| 					<td><label><spring:message code="label.user.password"></spring:message></label></td> | ||||
| 					<td><form:input path="password" value="" type="password" /></td> | ||||
| 					<form:errors path="password" cssClass="alert alert-error" element="div" /> | ||||
| 				</tr> | ||||
| 				<tr> | ||||
| 					<td><label><spring:message code="label.user.confirmPass"></spring:message></label></td> | ||||
| 					<td><form:input path="matchingPassword" value="" type="password" /></td> | ||||
| 					<form:errors cssClass="alert alert-error" element="div" /> | ||||
| 				</tr> | ||||
| 				<button type="submit" class="btn btn-primary"> | ||||
| 					<spring:message code="label.form.submit"></spring:message> | ||||
| 				</button> | ||||
| 			</form:form> | ||||
| 			<br> <a href="<c:url value="login.html" />"><spring:message code="label.form.loginLink"></spring:message></a> | ||||
| 		</div> | ||||
| 	</div> | ||||
|     <div class="container"> | ||||
|         <div > | ||||
|             <h1> | ||||
|                 <spring:message code="label.form.title"></spring:message> | ||||
|             </h1> | ||||
|             <br> | ||||
|             <form action="/" method="POST" enctype="utf8"> | ||||
|                 <div class="form-group row" > | ||||
|                     <label class="col-sm-3"><spring:message code="label.user.firstName"></spring:message></label> | ||||
|                     <span class="col-sm-5"><input class="form-control" name="firstName" value="" /></span> | ||||
|                     <span id="firstNameError" class="alert alert-danger col-sm-4" style="display:none"></span> | ||||
|                      | ||||
|                 </div> | ||||
|                 <div class="form-group row"> | ||||
|                     <label class="col-sm-3"><spring:message code="label.user.lastName"></spring:message></label> | ||||
|                     <span class="col-sm-5"><input class="form-control" name="lastName" value="" /></span> | ||||
|                     <span id="lastNameError" class="alert alert-danger col-sm-4" style="display:none"></span> | ||||
|                      | ||||
|                 </div> | ||||
|                 <div class="form-group row"> | ||||
|                     <label class="col-sm-3"><spring:message code="label.user.email"></spring:message></label> | ||||
|                     <span class="col-sm-5"><input class="form-control" name="email" value="" /></span>                     | ||||
|                     <span id="emailError" class="alert alert-danger col-sm-4" style="display:none"></span> | ||||
|                      | ||||
|                 </div> | ||||
|                 <div class="form-group row"> | ||||
|                     <label class="col-sm-3"><spring:message code="label.user.password"></spring:message></label> | ||||
|                     <span class="col-sm-5"><input class="form-control" name="password" value="" type="password" /></span> | ||||
|                     <span id="passwordError" class="alert alert-danger col-sm-4" style="display:none"></span> | ||||
|                 </div> | ||||
|                 <div class="form-group row"> | ||||
|                     <label class="col-sm-3"><spring:message code="label.user.confirmPass"></spring:message></label> | ||||
|                     <span class="col-sm-5"><input class="form-control" name="matchingPassword" value="" type="password" /></span> | ||||
|                     <span id="globalError" class="alert alert-danger col-sm-4" style="display:none"></span> | ||||
|                 </div> | ||||
|                 <br> | ||||
|                 <a href="#" class="btn btn-primary" onclick="register()"> | ||||
|                     <spring:message code="label.form.submit"></spring:message> | ||||
|                 </a> | ||||
|             </form> | ||||
|             <br>  | ||||
|             <a href="<c:url value="login.html" />"><spring:message code="label.form.loginLink"></spring:message></a> | ||||
|         </div> | ||||
|     </div> | ||||
| 
 | ||||
| <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.11.2/jquery.min.js"></script> | ||||
| <script type="text/javascript"> | ||||
| function register(){ | ||||
|     $(".alert").html("").hide(); | ||||
|     var formData= $('form').serialize(); | ||||
|     $.post("/spring-security-login-and-registration/user/registration",formData ,function(data){ | ||||
|         if(data.message == "success"){ | ||||
|             window.location.href = "<c:url value="/successRegister.html"></c:url>"; | ||||
|         } | ||||
|         else if(data.message == "email"){ | ||||
|             $("#emailError").show().html(data.error); | ||||
|         } | ||||
|         else{ | ||||
|              | ||||
|             var errors = $.parseJSON(data.message); | ||||
|             $.each( errors, function( index,item ){ | ||||
|                 $("#"+item.field+"Error").show().html(item.defaultMessage); | ||||
|             }); | ||||
|             errors = $.parseJSON(data.error); | ||||
|             $.each( errors, function( index,item ){ | ||||
|                 $("#globalError").show().append(item.defaultMessage+"<br>"); | ||||
|             }); | ||||
|         } | ||||
|     }) | ||||
|     .fail(function(data) { | ||||
|         if(data.responseJSON.error.indexOf("MailError") > -1) | ||||
|         { | ||||
|             window.location.href = "<c:url value="/emailError.html"></c:url>"; | ||||
|         } | ||||
|         else{ | ||||
|             window.location.href = "<c:url value="/login.html"></c:url>" + "?message=" + data.responseJSON.message; | ||||
|         } | ||||
|     }); | ||||
| } | ||||
| </script> | ||||
| </body> | ||||
| 
 | ||||
| </html> | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user