Package org.appfuse.model

Examples of org.appfuse.model.User


    @Before
    @After
    public void removeSignupUser() {
        UserManager userManager = applicationContext.getBean(UserManager.class);
        try {
            User signup = userManager.getUserByUsername("self-registered");
            userManager.removeUser(signup);
        } catch (UsernameNotFoundException e) {
            // OK: ignore
        }
    }
View Full Code Here


    @Autowired
    private SignupController c = null;

    @Test
    public void testDisplayForm() throws Exception {
        User user = c.showForm();
        assertNotNull(user);
    }
View Full Code Here

        address.setCity("Denver");
        address.setProvince("Colorado");
        address.setCountry("USA");
        address.setPostalCode("80210");

        User user = new User();
        user.setAddress(address);

        user.setUsername("self-registered");
        user.setPassword("Password1");
        user.setConfirmPassword("Password1");
        user.setFirstName("First");
        user.setLastName("Last");
        user.setEmail("self-registered@raibledesigns.com");
        user.setWebsite("http://raibledesigns.com");
        user.setPasswordHint("Password is one with you.");

        HttpServletResponse response = new MockHttpServletResponse();

        // start SMTP Server
        Wiser wiser = new Wiser();
View Full Code Here

    }

    @Test
    public void testShowResetPasswordForm() throws Exception {
        String username = "admin";
        User user = userManager.getUserByUsername(username);
        String token = userManager.generateRecoveryToken(user);

        MockHttpServletRequest request = newGet("/updatePassword");
        request.addParameter("username", username);
        request.addParameter("token", token);
View Full Code Here

    }

    @Test
    public void testResetPassword() throws Exception {
        String username = "admin";
        User user = userManager.getUserByUsername(username);
        String token = userManager.generateRecoveryToken(user);
        String password = "new-pass";

        MockHttpServletRequest request = newGet("/updatePassword");
        request.addParameter("username", username);
View Full Code Here

    protected User loadUser(final HttpServletRequest request) {
        final String userId = request.getParameter("id");
        if (isFormSubmission(request) && StringUtils.isNotBlank(userId)) {
            return getUserManager().getUser(userId);
        }
        return new User();
    }
View Full Code Here

                }
            } else {
                // if user is not an admin then load roles from the database
                // (or any other user properties that should not be editable
                // by users without admin role)
                final User cleanUser = getUserManager().getUserByUsername(
                        request.getRemoteUser());
                user.setRoles(cleanUser.getRoles());
            }

            final Integer originalVersion = user.getVersion();

            // set a random password if user is added by admin
View Full Code Here

        }

        if (!isFormSubmission(request)) {
            final String userId = request.getParameter("id");

            User user;
            if (userId == null && !isAdd(request)) {
                user = getUserManager().getUserByUsername(request.getRemoteUser());
            } else if (!StringUtils.isBlank(userId) && !"".equals(request.getParameter("version"))) {
                user = getUserManager().getUser(userId);
            } else {
                user = new User();
                user.addRole(new Role(Constants.USER_ROLE));
            }

            return user;
        } else {
            // populate user object from database, so all fields don't need to be hidden fields in form
View Full Code Here

        if (StringUtils.isEmpty(password)) {
            saveError(request, getText("errors.required", getText("updatePassword.newPassword.label", locale), locale));
            return showForm(username, null, request);
        }

        User user = null;
        final boolean usingToken = StringUtils.isNotBlank(token);
        if (usingToken) {
            log.debug("Updating Password for username " + username + ", using reset token");
            user = getUserManager().updatePassword(username, null, token, password,
                    RequestUtil.getAppURL(request));
View Full Code Here

        log.debug("Processing Password Hint...");

        // look up the user's information
        try {
            User user = userManager.getUserByUsername(username);

            StringBuffer msg = new StringBuffer();
            msg.append("Your password hint is: ").append(user.getPasswordHint());
            msg.append("\n\nLogin at: ").append(RequestUtil.getAppURL(request));

            message.setTo(user.getEmail());
            String subject = '[' + text.getMessage("webapp.name") + "] " +
                             text.getMessage("user.passwordHint");
            message.setSubject(subject);
            message.setText(msg.toString());
            mailEngine.send(message);

            saveMessage(request, text.getMessage("login.passwordHint.sent", new Object[] { username, user.getEmail() }));
        } catch (UsernameNotFoundException e) {
            log.warn(e.getMessage());
            saveError(request, text.getMessage("login.passwordHint.error", new Object[] { username }));
        } catch (MailException me) {
            log.warn(me.getMessage());
View Full Code Here

TOP

Related Classes of org.appfuse.model.User

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.