📄 resendemail.java
字号:
/* * 作者: 胡李青 * qq: 31703299 * Copyright (c) 2007 huliqing * 主页 http://www.tbuy.biz/ * 你可以免费使用该软件,未经许可请勿作用于任何商业目的 */package biz.tbuy.user.bean;import biz.tbuy.common.Constants;import biz.tbuy.common.MailOper;import biz.tbuy.common.Utils;import biz.tbuy.common.logs.Elog;import biz.tbuy.user.UserAction;import biz.tbuy.user.UserModel;import biz.tbuy.user.UserinfoAction;import biz.tbuy.user.UserinfoModel;import javax.servlet.http.HttpSession;/** * @author huliqing * <p><b>qq:</b>31703299 * <p><b>E-mail:</b><a href="mailto:huliqing.cn@gmail.com">huliqing.cn@gmail.com</a> * <p><b>Homepage:</b><a href="http://www.tbuy.biz/">http://www.tbuy.biz/</a> */public class ResendEmail extends BaseBean{ private String _id; /* 用户的id */ private String _validateCode; /* 验证码 */ /** Creates a new instance of ResendEmail */ public ResendEmail() { } public void setId(String id) { _id = id; } public String getId() { return _id; } public void setValidateCode(String validateCode) { _validateCode = validateCode; } public String getValidateCode() { return _validateCode; } /** * 重新发送一封确认邮件至用户的邮箱中 */ public String resend() { // 检查ID是否为空 if (_id.trim().equals("")) { return Constants.OUT_FAILURE; } // 检相验证码,如果需要注册验证 HttpSession session = (HttpSession)getFacesContext(). getExternalContext().getSession(false); if (_validateCode == null || !_validateCode.toUpperCase().equals(session.getAttribute("validateCode"))) { Utils.addErrorMessage(getBundle(), "resendEmail_validateCodeError"); return Constants.OUT_FAILURE; } // 获取用户并重发激活邮件 MailOper mOper = new MailOper(); UserModel user = UserAction.getUser(_id); UserinfoModel userinfo = UserinfoAction.getUserinfoById(_id); if (user == null) { Utils.addErrorMessage(getBundle(), "resendEmail_noUserId"); return Constants.OUT_FAILURE; } if (mOper.sendEnableEmail(user, userinfo.getEmail())) { Utils.addInfoMessage(getBundle(), "resendEmail_resendSuccess"); return Constants.OUT_SUCCESS; } else { Elog.log("Error:login:resendEmail:系统在重新发送确认邮件的过程" + "中出现问题"); Utils.addErrorMessage(getBundle(), "resendEmail_resendFailure"); return Constants.OUT_FAILURE; } }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -