Package com.dyuproject.demos.todolist.model

Examples of com.dyuproject.demos.todolist.model.Credential


            request.setAttribute(Constants.MSG, Feedback.PASSWORD_DID_NOT_MATCH.getMsg());
            dispatchToFormView(null, rc, getWebContext());
            return;
        }
       
        Credential cred = new Credential();
        cred.setUsername(username);
        cred.setPassword(password);
        cred.setRole(Integer.valueOf(0));
        User user = null;
        try
        {
            user = (User)rc.getConsumer().consume(rc);
        }
        catch(ValidationException ve)
        {
            cred.setUser((User)ve.getPojo());
            request.setAttribute(Constants.MSG, ve.getMessage());
            dispatchToFormView(cred, rc, getWebContext());
            return;
        }
        cred.setUser(user);
        boolean created = _credentialDao.create(cred);
        if(created)
        {
            MainService.saveUser(user, rc, getWebContext());
            MainService.redirectToOverview(rc, getWebContext());
View Full Code Here


    {
        HttpServletRequest request = rc.getRequest();
        HttpServletResponse response = rc.getResponse();
       
        User user = MainService.getUser(rc, getWebContext());
        Credential cred = _credentialDao.get(user.getId());
        if(cred==null)
        {           
            response.sendError(404);
            return;
        }
       
        String oldPassword = request.getParameter(Constants.OLD_PASSWORD);
        String newPassword = request.getParameter(Constants.NEW_PASSWORD);
        String confirmPassword = request.getParameter(Constants.CONFIRM_PASSWORD);

        Feedback feedback = null;
       
        if(oldPassword==null || newPassword==null || confirmPassword==null)
            feedback = Feedback.CHANGE_PASSWORD_REQUIRED;
        else if(oldPassword.equals(newPassword))
            feedback = Feedback.NO_CHANGES_MADE;
        else if(newPassword.equals(confirmPassword))
        {
            if(cred.getPassword().equals(oldPassword))
            {
                cred.setPassword(newPassword);
                if(CredentialDao.executeUpdate())
                {
                    request.setAttribute(Constants.MSG, Feedback.PASSWORD_CHANGED.getMsg());
                    dispatchToView(null, rc, getWebContext());
                    return;
View Full Code Here

            request.setAttribute(Constants.MSG, Feedback.AUTH_REQUIRED.getMsg());
            response.setContentType(Constants.TEXT_HTML);
            getWebContext().getJSPDispatcher().dispatch("login/index.jsp", request, response);
            return;
        }
        Credential credential = _credentialDao.get(username, password);
        if(credential==null)
        {
            request.setAttribute(Constants.MSG, Feedback.USER_NOT_FOUND.getMsg());
            dispatchToLogin(rc, getWebContext());
            return;
        }
        User user = credential.getUser();
        saveUser(user, rc, getWebContext());
        redirectToOverview(rc, getWebContext());
    }
View Full Code Here

TOP

Related Classes of com.dyuproject.demos.todolist.model.Credential

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.