Package org.apache.click.examples.domain

Examples of org.apache.click.examples.domain.User


    private void loadUsers(final DataContext dataContext) throws IOException {
        loadFile("users.txt", dataContext, new LineProcessor() {
            public void processLine(String line, DataContext context) {
                StringTokenizer tokenizer = new StringTokenizer(line, ",");

                User user = new User();

                user.setUsername(next(tokenizer));
                user.setPassword(next(tokenizer));
                user.setFullname(next(tokenizer));
                user.setEmail(next(tokenizer));

                context.registerNewObject(user);
            }
        });
    }
View Full Code Here


* @author Malcolm Edgar
*/
public class UserService extends CayenneTemplate {

    public boolean isAuthenticatedUser(User user) {
        User user2 = getUser(user.getUsername());

        if (user2 != null && user2.getPassword().equals(user.getPassword())) {
            return true;
        } else {
            return false;
        }
    }
View Full Code Here

            if (!password1.equals(password2)) {
                passwordField.setError("Password and password again do not match");
                return true;
            }

            User user = userService.getUser(username);

            if (user != null) {
                userNameField.setError(getMessage("usernameExistsError"));
                return true;
            }
View Full Code Here

    private void loadUsers(final DataContext dataContext) throws IOException {
        loadFile("users.txt", dataContext, new LineProcessor() {
            public void processLine(String line, DataContext context) {
                StringTokenizer tokenizer = new StringTokenizer(line, ",");

                User user = new User();

                user.setUsername(next(tokenizer));
                user.setPassword(next(tokenizer));
                user.setFullname(next(tokenizer));
                user.setEmail(next(tokenizer));

                context.registerNewObject(user);
            }
        });
    }
View Full Code Here

    /**
     * @see org.springframework.security.userdetails.UserDetailsService#loadUserByUsername(String)
     */
    public UserDetails loadUserByUsername(String username) throws UsernameNotFoundException, DataAccessException {

        User user = userService.getUser(username);

        if (user != null) {
            return new UserDetailsAdaptor(user);

        } else {
View Full Code Here

*/
@Component
public class UserService extends CayenneTemplate {

    public boolean isAuthenticatedUser(User user) {
        User user2 = getUser(user.getUsername());

        if (user2 != null && user2.getPassword().equals(user.getPassword())) {
            return true;
        } else {
            return false;
        }
    }
View Full Code Here

    public User getUser(String username) {
        return (User) findObject(User.class, "username", username);
    }

    public User createUser(String fullName, String email, String username, String password) {
        User user = new User();
        getDataContext().registerNewObject(user);

        user.setEmail(email);
        user.setFullname(fullName);
        user.setUsername(username);
        user.setPassword(password);

        commitChanges();

        return user;
    }
View Full Code Here

        }
    }

    public boolean onOkClicked() {
        if (form.isValid()) {
            User user = new User();
            form.copyTo(user);

            if (userService.isAuthenticatedUser(user)) {

                user = userService.getUser(user.getUsername());
                getContext().setSessionAttribute("user", user);

                getContext().setCookie("username",
                                       user.getUsername(),
                                       Integer.MAX_VALUE);

                String redirect = redirectField.getValue();
                if (StringUtils.isNotBlank(redirect)) {
                    setRedirect(redirect);
View Full Code Here

*/
@Component
public class UserService extends CayenneTemplate {

    public boolean isAuthenticatedUser(User user) {
        User user2 = getUser(user.getUsername());

        return user2 != null && user2.getPassword().equals(user.getPassword());
    }
View Full Code Here

    public User getUser(String username) {
        return (User) findObject(User.class, "username", username);
    }

    public User createUser(String fullName, String email, String username, String password) {
        User user = new User();
        getDataContext().registerNewObject(user);

        user.setEmail(email);
        user.setFullname(fullName);
        user.setUsername(username);
        user.setPassword(password);

        commitChanges();

        return user;
    }
View Full Code Here

TOP

Related Classes of org.apache.click.examples.domain.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.