Package com.tapestry5book.entities

Examples of com.tapestry5book.entities.User


            oneOf(userDao).findByName("admin");

            will(returnValue(null));
        }});

        User user = authenticator.authenticate("admin", "admin");

        assertNull(user);
    }
View Full Code Here


    public void authenticateWrongPassword() {

        mockery.checking(new Expectations() {{
            oneOf(userDao).findByName("admin");

            will(returnValue(new User("admin", "secret")));
        }});

        User user = authenticator.authenticate("admin", "admin");

        assertNull(user);
    }
View Full Code Here

        this.userDao = userDao;
        this.applicationStateManager = applicationStateManager;
    }

    public User authenticate(String userName, String password) {
        User user = userDao.findByName(userName);

        if (user != null) {
            String digest = DigestUtils.md5Hex(password);

            if (digest.equals(user.getPassword())) {
                return user;
            }
        }

        return null;
View Full Code Here

                registerForm.recordError(messages.get("password-confirmation-failed"));

                return;
            }

            final User existingUser = userDao.findByName(user.getName());

            if (existingUser != null) {
                registerForm.recordError(messages.format("user-already-exists", user.getName()));
            }
        }
View Full Code Here

        return model;
    }

    void onValidateFromLoginForm() {
        if (loginForm.isValid()) {
            User authenticated = authenticator.authenticate(user.getName(), user.getPassword());

            if (authenticated == null) {
                loginForm.recordError(messages.get("invalid-username-or-password"));
            } else {
                loggedIn = authenticated;
View Full Code Here

    @SessionState(create = false)
    private User user;

    void onValidateFromLoginForm() {
        if (loginForm.isValid()) {
            User authenticated = authenticator.authenticate(userName, password);

            if (authenticated == null) {
                loginForm.recordError(messages.get("invalid-username-or-password"));
            } else {
                user = authenticated;
View Full Code Here

    @SessionState(create = false)
    private User loggedIn;

    void onPrepare() {
        user = new User();
    }
View Full Code Here

        user = new User();
    }

    void onValidateFromLoginForm() {
        if (loginForm.isValid()) {
            User authenticated = authenticator.authenticate(user.getName(), user.getPassword());

            if (authenticated == null) {
                loginForm.recordError(messages.get("invalid-username-or-password"));
            } else {
                loggedIn = authenticated;
View Full Code Here

    @Property
    private User user;

    void onPrepare(){
        user = new User();
    }
View Full Code Here

                registerForm.recordError(messages.get("password-confirmation-failed"));

                return;
            }

            final User existingUser = userDao.findByName(user.getName());

            if(existingUser!=null){
                registerForm.recordError(messages.format("user-already-exists", user.getName()));
            }
        }
View Full Code Here

TOP

Related Classes of com.tapestry5book.entities.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.