Package cn.edu.zju.acm.onlinejudge.form

Examples of cn.edu.zju.acm.onlinejudge.form.ResetPasswordForm


     *             any errors happened
     */
    @Override
    public ActionForward execute(ActionMapping mapping, ActionForm form, ContextAdapter context) throws Exception {

        ResetPasswordForm passwordForm = (ResetPasswordForm) form;
        String code = passwordForm.getCode();

        UserPersistence userPersistence = PersistenceManager.getInstance().getUserPersistence();
        UserProfile user = null;
        if (code != null && code.trim().length() > 0) {
            user = userPersistence.getUserProfileByCode(code);
        }

        if (user == null) {
            ActionMessages messages = new ActionMessages();
            messages.add("message", new ActionMessage("onlinejudge.resetPassword.invalidCode"));
            this.saveErrors(context.getRequest(), messages);
            return this.handleSuccess(mapping, context, "message");

        }

        if (passwordForm.getPassword() == null) {
            return this.handleSuccess(mapping, context, "failure");
        }

        user.setPassword(passwordForm.getPassword());
        userPersistence.updateUserProfile(user, user.getId());
        userPersistence.deleteConfirmCode(user.getId(), user.getId());

        ActionMessages messages = new ActionMessages();
        messages.add("message", new ActionMessage("onlinejudge.resetPassword.success"));
View Full Code Here

TOP

Related Classes of cn.edu.zju.acm.onlinejudge.form.ResetPasswordForm

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.