// Path: spanners-mvc/src/main/java/org/dontpanic/spanners/springmvc/domain/User.java
// public class User implements UserDetails {
// 
//     private String username;
//     private String password;
//     private Boolean enabled;
// 
//     public User() {
//     }
// 
//     public User(String username, String password, Boolean enabled) {
//         this.username = username;
//         this.password = password;
//         this.enabled = enabled;
//     }
// 
//     public String getUsername() {
//         return username;
//     }
// 
//     public void setUsername(String username) {
//         this.username = username;
//     }
// 
// 
//     public String getPassword() {
//         return password;
//     }
// 
//     public void setPassword(String password) {
//         this.password = password;
//     }
// 
//     public Boolean getEnabled() {
//         return enabled;
//     }
// 
//     public void setEnabled(Boolean enabled) {
//         this.enabled = enabled;
//     }
// 
//     @Override
//     public boolean isAccountNonExpired() {
//         return true;
//     }
// 
//     @Override
//     public boolean isAccountNonLocked() {
//         return true;
//     }
// 
//     @Override
//     public boolean isCredentialsNonExpired() {
//         return true;
//     }
// 
//     @Override
//     public boolean isEnabled() {
//         return enabled;
//     }
// 
//     @Override
//     public Collection<? extends GrantedAuthority> getAuthorities() {
//         return Collections.emptySet();
//     }
// }
// 
// Path: spanners-mvc/src/main/java/org/dontpanic/spanners/springmvc/forms/SignupForm.java
// public class SignupForm {
// 
// 	private static final String NOT_BLANK_MESSAGE = "{notBlank.message}";
// 
// 	@NotBlank(message = NOT_BLANK_MESSAGE)
// 	private String name;
// 	@NotBlank(message = NOT_BLANK_MESSAGE)
// 	private String password;
// 
// 	public String getName() {
// 		return name;
// 	}
// 
// 	public void setName(String name) {
// 		this.name = name;
// 	}
// 
// 	public String getPassword() {
// 		return password;
// 	}
// 
// 	public void setPassword(String password) {
// 		this.password = password;
// 	}
// }


import org.apache.log4j.Logger;
import org.dontpanic.spanners.springmvc.domain.User;
import org.dontpanic.spanners.springmvc.forms.SignupForm;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.provisioning.UserDetailsManager;
import org.springframework.stereotype.Controller;
import org.springframework.validation.Errors;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import javax.validation.Valid;
package org.dontpanic.spanners.springmvc.controllers;



/**
 * Controller for the signup page. This page creates new user accounts.
 * Created by stevie on 29/12/15.
 */
@Controller
public class SignupController {

    private Logger log = Logger.getLogger(SignupController.class);

    public static final String CONTROLLER_URL = "/signup";
	public static final String VIEW_SUCCESS = "redirect:/";

    private static final boolean ENABLED = true;

    /**
     * UserDetailsManager provided by Spring Security allows CRUD operations on user accounts
     */
    @Autowired private UserDetailsManager userDetailsManager;

    @Autowired private PasswordEncoder passwordEncoder;

	@RequestMapping(value = CONTROLLER_URL)
// Path: spanners-mvc/src/main/java/org/dontpanic/spanners/springmvc/domain/User.java
// public class User implements UserDetails {
// 
//     private String username;
//     private String password;
//     private Boolean enabled;
// 
//     public User() {
//     }
// 
//     public User(String username, String password, Boolean enabled) {
//         this.username = username;
//         this.password = password;
//         this.enabled = enabled;
//     }
// 
//     public String getUsername() {
//         return username;
//     }
// 
//     public void setUsername(String username) {
//         this.username = username;
//     }
// 
// 
//     public String getPassword() {
//         return password;
//     }
// 
//     public void setPassword(String password) {
//         this.password = password;
//     }
// 
//     public Boolean getEnabled() {
//         return enabled;
//     }
// 
//     public void setEnabled(Boolean enabled) {
//         this.enabled = enabled;
//     }
// 
//     @Override
//     public boolean isAccountNonExpired() {
//         return true;
//     }
// 
//     @Override
//     public boolean isAccountNonLocked() {
//         return true;
//     }
// 
//     @Override
//     public boolean isCredentialsNonExpired() {
//         return true;
//     }
// 
//     @Override
//     public boolean isEnabled() {
//         return enabled;
//     }
// 
//     @Override
//     public Collection<? extends GrantedAuthority> getAuthorities() {
//         return Collections.emptySet();
//     }
// }
// 
// Path: spanners-mvc/src/main/java/org/dontpanic/spanners/springmvc/forms/SignupForm.java
// public class SignupForm {
// 
// 	private static final String NOT_BLANK_MESSAGE = "{notBlank.message}";
// 
// 	@NotBlank(message = NOT_BLANK_MESSAGE)
// 	private String name;
// 	@NotBlank(message = NOT_BLANK_MESSAGE)
// 	private String password;
// 
// 	public String getName() {
// 		return name;
// 	}
// 
// 	public void setName(String name) {
// 		this.name = name;
// 	}
// 
// 	public String getPassword() {
// 		return password;
// 	}
// 
// 	public void setPassword(String password) {
// 		this.password = password;
// 	}
// }


// Path: spanners-mvc/src/main/java/org/dontpanic/spanners/springmvc/controllers/SignupController.java
import org.apache.log4j.Logger;
import org.dontpanic.spanners.springmvc.domain.User;
import org.dontpanic.spanners.springmvc.forms.SignupForm;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.security.provisioning.UserDetailsManager;
import org.springframework.stereotype.Controller;
import org.springframework.validation.Errors;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import javax.validation.Valid;

package org.dontpanic.spanners.springmvc.controllers;



/**
 * Controller for the signup page. This page creates new user accounts.
 * Created by stevie on 29/12/15.
 */
@Controller
public class SignupController {

    private Logger log = Logger.getLogger(SignupController.class);

    public static final String CONTROLLER_URL = "/signup";
	public static final String VIEW_SUCCESS = "redirect:/";

    private static final boolean ENABLED = true;

    /**
     * UserDetailsManager provided by Spring Security allows CRUD operations on user accounts
     */
    @Autowired private UserDetailsManager userDetailsManager;

    @Autowired private PasswordEncoder passwordEncoder;

	@RequestMapping(value = CONTROLLER_URL)
	public SignupForm displayPage() {