Package com.stormpath.tooter.model

Examples of com.stormpath.tooter.model.User


        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "password", "change.password.required.password", "Field password is required");

        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "confirmPassword", "change.password.required.confirm.password", "Field confirm password is required");

        User customer = (User) o;

        if (!customer.getPassword().equals(customer.getConfirmPassword())) {
            errors.rejectValue("password", "password.not.match");
        }
    }
View Full Code Here


        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "email", "signUp.required.email", "Field email is required");

        ValidationUtils.rejectIfEmptyOrWhitespace(errors, "confirmPassword", "signUp.required.confirm.password", "Field confirm password is required");

        User customer = (User) o;

        if (!customer.getPassword().equals(customer.getConfirmPassword())) {
            errors.rejectValue("password", "password.not.match");
        }
    }
View Full Code Here

                // call Account.save() after setting the modified properties.
                // An account can also be retrieved from the DataStore,
                // like the way we do it to get an Application or Directory object,
                // if the account's Rest URL is known to the application.

                User sessionUser = (User) session.getAttribute("sessionUser");
                Account account = sessionUser.getAccount();
                account.setGivenName(user.getFirstName());
                account.setSurname(user.getLastName());
                account.setEmail(user.getEmail());
                account.setUsername(user.getFirstName().toLowerCase() + user.getLastName().toLowerCase());

                String existingGroupUrl = null;
                if (account.getGroupMemberships().iterator().hasNext()) {
                    GroupMembership groupMembership = account.getGroupMemberships().iterator().next();
                    existingGroupUrl = groupMembership.getGroup().getHref();
                    if (!existingGroupUrl.equals(user.getGroupUrl())) {
                        groupMembership.delete();
                        existingGroupUrl = null;
                    }
                }

                if (user.getGroupUrl() != null && !user.getGroupUrl().isEmpty() && existingGroupUrl == null) {
                    account.addGroup(stormpath.getDataStore().getResource(user.getGroupUrl(), Group.class));
                }

                account.save();

                user.setAccount(account);
                user.setUserName(sessionUser.getUserName());
                user.setTootList(sessionUser.getTootList());

                model.addAttribute("messageKey", "updated");
                model.addAttribute("user", user);
            } catch (ResourceException re) {
                ObjectError error = new ObjectError("user", re.getMessage());
View Full Code Here

        return "profile";
    }

    @RequestMapping(method = RequestMethod.GET)
    public String initForm(ModelMap model, HttpSession session) {
        User user = (User) session.getAttribute("sessionUser");

        model.addAttribute("user", user);
        model.addAttribute("ADMINISTRATOR_URL", administratorGroupURL);
        model.addAttribute("PREMIUM_URL", premiumGroupURL);
View Full Code Here

        this.resetPasswordValidator = resetPasswordValidator;
    }

    @RequestMapping(value = "/password/forgot", method = RequestMethod.GET)
    public String initResetPassword(Model model) {
        model.addAttribute("user", new User());
        return "resetPassword";
    }
View Full Code Here

        }
    }

    @RequestMapping(value = "/password/message", method = RequestMethod.GET)
    public String initResetPasswordMsg(Model model) {
        User cust = new User();
        model.addAttribute("customer", cust);
        return "resetPasswordMsg";
    }
View Full Code Here

                AuthenticationRequest request = new UsernamePasswordRequest(customer.getUserName(), customer.getPassword());
                AuthenticationResult authcResult = stormpath.getApplication().authenticateAccount(request);

                Account account = authcResult.getAccount();

                User user = new User(account);

                // If the customer queried from the database does not exist
                // we create it in the application's internal database,
                // so we don't have to go through the process of signing a user up
                // that has already been authenticated in the previous call to the Stormpath API.
                // This is because the application uses an in-memory database (HSQLDB)
                // that only persists while the application is up.
                User dbCustomer = customerDao.getCustomerByUserName(customer.getUserName());
                if (dbCustomer == null) {
                    customerDao.saveCustomer(user);
                }

                if (dbCustomer != null) {
                    user.setId(dbCustomer.getId());
                }

                session.setAttribute("sessionUser", user);
                session.setAttribute("permissionUtil", permissionUtil);
View Full Code Here

    }

    @RequestMapping(method = RequestMethod.GET)
    public String initForm(ModelMap model) {

        User cust = new User();

        Map<String, String> groupMap = null;

        setGroupsToModel(groupMap, model);
View Full Code Here

        Criteria criteria = getSession().createCriteria(User.class);
        criteria.add(Restrictions.eq("userName", userName));
        List<?> list = new ArrayList<Object>();
        list.addAll(criteria.list());

        User customer = null;

        if (!list.isEmpty()) {
            for (Object obj : list) {
                if (obj != null) {
                    customer = (User) obj;
View Full Code Here

                                SessionStatus status,
                                HttpSession session) {

        tootValidator.validate(toot, result);

        User sessionUser = (User) session.getAttribute("sessionUser");

        if (!result.hasErrors()) {

            User persistCustomer = new User(sessionUser);

            List<Toot> tootList;
            Toot persistToot = new Toot();
            persistToot.setTootMessage(toot.getTootMessage());
            persistToot.setCustomer(persistCustomer);

            try {

                tootDao.saveToot(persistToot);
                toot.setTootId(persistToot.getTootId());
                tootList = tootDao.getTootsByUserId(persistCustomer.getId());

                for (Toot itemToot : tootList) {
                    itemToot.setCustomer(sessionUser);
                }
View Full Code Here

TOP

Related Classes of com.stormpath.tooter.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.