Package org.springmodules.feedxt.web.view

Examples of org.springmodules.feedxt.web.view.SignUpUserView


    public void setApplicationEventPublisher(ApplicationEventPublisher applicationEventPublisher) {
        this.applicationEventPublisher = applicationEventPublisher;
    }

    protected Object formBackingObject(HttpServletRequest request) throws Exception {
        SignUpUserView factoryView = this.generator.generate();
        factoryView.setUserRepository(this.userRepository);
        return factoryView;
    }
View Full Code Here


        factoryView.setUserRepository(this.userRepository);
        return factoryView;
    }

    protected ModelAndView onSubmit(HttpServletRequest request, HttpServletResponse response, Object command, BindException errors) throws Exception {
        SignUpUserView factoryView = (SignUpUserView) command;
        User user = (User) factoryView.makeUser();
        try {
            this.userService.signUpUserAccount(user, factoryView.getUsername(), factoryView.getPassword());
            this.userHolder.setUser(user);
            this.applicationEventPublisher.publishEvent(new LoginEvent(this, request.getSession(), user));
        } catch (UserAlreadyExistentException ex) {
            errors.reject("user.duplicated.username", "Username already existent.");
            return new AjaxModelAndView(null, errors);
View Full Code Here

    public boolean supports(Class aClass) {
        return SignUpUserView.class.isAssignableFrom(aClass);
    }

    public void validate(Object object, Errors errors) {
        SignUpUserView user = (SignUpUserView) object;
        if (user.getFirstname() == null || user.getFirstname().equals("")) {
            errors.rejectValue("firstname", "user.empty.firstname", "Empty firstname.");
        }
        if (user.getSurname() == null || user.getSurname().equals("")) {
            errors.rejectValue("surname", "user.empty.surname", "Empty surname.");
        }
        if (user.getBirthdate() == null) {
            errors.rejectValue("birthdate", "user.empty.birthdate", "Empty birthdate.");
        }
        if (user.getUsername() == null || user.getUsername().equals("")) {
            errors.rejectValue("username", "user.empty.username", "Empty username.");
        }
        if (user.getPassword() == null || user.getPassword().equals("")) {
            errors.rejectValue("password", "user.empty.password", "Empty password.");
        }
        if (user.getPassword() != null && !user.getPassword().equals("") && user.getPassword().length() < 5) {
            errors.rejectValue("password", "user.short.password", "Short password : it must have at least 5 characters.");
        }
        if (user.getConfirmedPassword() == null || !user.getConfirmedPassword().equals(user.getPassword())) {
            errors.rejectValue("password", "user.wrong.password", "Password doesn't match.");
        }
    }
View Full Code Here

TOP

Related Classes of org.springmodules.feedxt.web.view.SignUpUserView

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.