Package org.encuestame.core.service.imp

Examples of org.encuestame.core.service.imp.SecurityOperations


            JsonMappingException, IOException {

        log.debug("update profile type:" + type);
        log.debug("update profile data:" + data);
        try {
            final SecurityOperations security = getSecurityService();
            final ValidateOperations operations = new ValidateOperations(security);
            final HashMap<String, Object> listError = new HashMap<String, Object>();
            //filter data
            data = filterValue(data);
            if (type.equals(Profile.EMAIL.toString())) {
                //TODO: review pattern email format validator.
                log.debug("update email");
                final UserAccount account = getSecurityService().getUserAccount(getUserPrincipalUsername());
                if (operations.validateUserEmail(data, account)) {
                    security.updateAccountProfile(Profile.EMAIL, data);
                    setSuccesResponse();
                } else {
                    listError.put(type, getMessage("e_005", request, null));
                }
            } else if(type.equals(Profile.USERNAME.toString())) {
                log.debug("update username");
                final UserAccount account = getSecurityService().getUserAccount(getUserPrincipalUsername());
                if (operations.validateUsername(data, account)) {
                    security.updateAccountProfile(Profile.USERNAME, data);
                    setSuccesResponse(getMessage("settings_config_profile_success", request, null));
                } else {
                    listError.put(type, getMessage("e_018", request, null));
                }
            } else if(type.equals(Profile.PICTURE.toString())) {
                 log.debug("update PICTURE");
                 security.updateAccountProfile(Profile.PICTURE, data);
                 setSuccesResponse(getMessage("settings_config_picture_success", request, null));
            else if(type.equals(Profile.WELCOME.toString())) {
                log.debug("update WELCOME");
                security.updateAccountProfile(Profile.WELCOME, data);
                setSuccesResponse(getMessage("settings_welcome", request, null));
            else if(type.equals(Profile.PAGE_INFO.toString())) {
                log.debug("update PAGE_INFO");
                security.updateAccountProfile(Profile.PAGE_INFO, data);
                setSuccesResponse(getMessage("settings_page_info", request, null));
            } else {
                setError(getMessage("e_023", request, null), response);
            }
            if (!listError.isEmpty()) {
View Full Code Here


            @RequestParam(value = "language", required = false) String language,
            @RequestParam(value = "bio", required = false) String bio,
            HttpServletResponse response) throws JsonGenerationException,
            JsonMappingException, IOException {
        try {
            final SecurityOperations security = getSecurityService();
            // get the user account of previous user logged.
            final UserAccount account = getUserAccount();
            final ValidateOperations operations = new ValidateOperations(security);
            final HashMap<String, Object> listError = new HashMap<String, Object>();
            //filter values.
View Full Code Here

        String finalPath = "/user/created";
        user.setEmail(filterValue(emailForm));
        user.setPassword(password);
        user.setFullName(filterValue(realName));
        user.setUsername(filterValue(usernameForm));
        final SecurityOperations _service = getSecurityService();
        final ValidateOperations validation = new ValidateOperations(_service);
        if (validation.validateSignUpForm(usernameForm, emailForm, password)) {
            log.debug(" the signup process successfull");
            try {
                _service.singupUser(user, false);
            } catch (Exception e) {
                 RequestSessionMap.getCurrent(req).put("signupError", Boolean.TRUE);
                 finalPath = "redirect:/user/signup";
                 log.error("error on signup : " + e.getMessage());
                 e.printStackTrace();
View Full Code Here

             code = filterValue(code);
             vote = (UtilVoteCaptcha) model.asMap().get("captchaForm");
             log.info("vote2--> "+vote.toString());
             final String IP = getIpClient(req);
             //security service
             final SecurityOperations securityService = getServiceManager().getApplicationServices().getSecurityService();
             //check if captcha is valid
             final ReCaptchaResponse reCaptchaResponse = getReCaptcha().checkAnswer(req.getRemoteAddr(), challenge, response);
             //validation layer
             final ValidateOperations validation = new ValidateOperations(securityService);
             validation.validateCaptcha(reCaptchaResponse, result);
View Full Code Here

TOP

Related Classes of org.encuestame.core.service.imp.SecurityOperations

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.