Package cn.iver.model

Examples of cn.iver.model.User


        // validate user info from bbs_id
        if(controller.getSessionAttr("user") == null && StringKit.notBlank(controller.getCookie("bbsID"))){
            String bbsID = controller.getCookie("bbsID");
            if(StringKit.notBlank(bbsID)){
                String[] userAndEmail = bbsID.split(Const.BBS_ID_SEPARATOR);
                User user = null;
                if(userAndEmail != null && userAndEmail.length == 2){
                    user = User.dao.getByEmailAndPassword(userAndEmail[0], userAndEmail[1]);
                }
                if(user != null){
                    controller.getSession().setMaxInactiveInterval(1800);
                    controller.setSessionAttr("user", user);
                    controller.setSessionAttr("userID", user.get("id"));
                }else{
                    ai.getController().removeCookie("bbsID");
                }
            }
        }
View Full Code Here


*/
public class AdminInterceptor implements Interceptor {
    @Override
    public void intercept(ActionInvocation ai) {
        Controller controller = ai.getController();
        User user = controller.getSessionAttr("user");
        if (user != null && Const.ADMIN_EMAIL.equals(user.getStr("email"))){
            ai.invoke();
        }else{
            controller.setAttr("msg", "需要管理员权限");
            controller.renderError(500);
        }
View Full Code Here

    @Before(LoginValidator.class)
    public void login(){
        String email = getPara("email");
        String password = getPara("password");
        User user = User.dao.getByEmailAndPassword(email, password);
        if (user != null){
            String bbsID = email + Const.BBS_ID_SEPARATOR + password;
            setCookie("bbsID", bbsID, 3600*24*30);
            setSessionAttr("user", user);
            setSessionAttr("userID", user.get("id"));
            redirect("/");
        }else{
            setAttr("msg", "用户名或密码错误");
            render("/user/login.html");
        }
View Full Code Here

        redirect("/");
    }

    @Before(RegistValidator.class)
    public void save(){
        User user = getModel(User.class);
        user.mySave();
        setAttr("msg", "恭喜你,注册成功,请登录:");
        render("/user/login.html");
    }
View Full Code Here

        render("/user/edit.html");
    }

    @Before({ UserCheckInterceptor.class, UpdateUserValidator.class })
    public void update(){
        User user = getModel(User.class);
        user.myUpdate();
        setAttr("user", user);
        render("/user/user.html");
    }
View Full Code Here

TOP

Related Classes of cn.iver.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.