Code/Resource
Windows Develop
Linux-Unix program
Internet-Socket-Network
Web Server
Browser Client
Ftp Server
Ftp Client
Browser Plugins
Proxy Server
Email Server
Email Client
WEB Mail
Firewall-Security
Telnet Server
Telnet Client
ICQ-IM-Chat
Search Engine
Sniffer Package capture
Remote Control
xml-soap-webservice
P2P
WEB(ASP,PHP,...)
TCP/IP Stack
SNMP
Grid Computing
SilverLight
DNS
Cluster Service
Network Security
Communication-Mobile
Game Program
Editor
Multimedia program
Graph program
Compiler program
Compress-Decompress algrithms
Crypt_Decrypt algrithms
Mathimatics-Numerical algorithms
MultiLanguage
Disk/Storage
Java Develop
assembly language
Applications
Other systems
Database system
Embeded-SCM Develop
FlashMX/Flex
source in ebook
Delphi VCL
OS Develop
MiddleWare
MPI
MacOS develop
LabView
ELanguage
Software/Tools
E-Books
Artical/Document
ConfigAction.java
Package: meybomailweb.rar [view]
Upload User: gtz2001
Upload Date: 2016-12-29
Package Size: 2489k
Code Size: 4k
Category:
WEB Mail
Development Platform:
Java
- package net.meybo.mail.action;
- import java.util.List;
- import net.meybo.mail.ActiveUser;
- import net.meybo.mail.Config;
- import net.meybo.mail.MailServer;
- import net.meybo.mail.client.UserManage;
- import com.easyjf.util.CommUtil;
- import com.easyjf.web.ActionContext;
- import com.easyjf.web.IWebAction;
- import com.easyjf.web.Module;
- import com.easyjf.web.Page;
- import com.easyjf.web.WebForm;
- /**
- * 地址管理处理Action
- * <p>Title: </p>
- * <p>Description: 基于EasyJWeb框架,实现IWebAction接口,处理配置文件信息</p>
- * <p>Copyright: Copyright (c) 2006</p>
- * <p>Company: 脉博软件</p>
- * @author 阚吉彬
- * @version 1.0
- */
- public class ConfigAction implements IWebAction {
- public Page execute(WebForm form, Module module) throws Exception {
- String method=CommUtil.null2String(form.get("easyJWebCommand"));
- ActiveUser user=(ActiveUser)ActionContext.getContext().getRequest().getSession().getAttribute("user");
- if(user==null)
- {
- form.addResult("msg","您没有登录或者是超时,请重登录!");
- return new Page("noLoin","/login.ejf","html");
- }
- Page forward=null;
- if(method.equals("")||"setting".equals(method))
- {
- forward=doSetting(form,module,user);
- }
- else if("personal".equals(method))//处理用户登录
- {
- forward= doPersonal(form,module);
- }
- else if("refuse".equals(method))
- {
- forward=doRefuse(form,module,user);
- }
- else if("filter".equals(method))
- {
- forward=doFilter(form,module,user);
- }
- else if("password".equals(method))
- {
- forward=doPassword(form,module,user);
- }
- else if("exit".equals(method))
- {
- ActionContext.getContext().getSession().removeAttribute("user");
- forward=new Page("goto","/exit.htm","html");
- }
- return forward;
- }
- private Page doSetting(WebForm form, Module module,ActiveUser user)
- {
- MailServer server=Config.findServerByDomain(user.getServerDomain());
- String subCommand=CommUtil.null2String(form.get("subCommand"));
- String forwardTo=CommUtil.null2String(form.get("autoForwardTo"));
- String autoForward=CommUtil.null2String(form.get("autoForward"));
- System.out.println(forwardTo+":"+autoForward+":"+subCommand);
- if("change".equals(subCommand))
- {
- if(((!autoForward.equals("")) && (!forwardTo.equals(""))) || autoForward.equals("")){
- if(autoForward.equals(""))forwardTo="null";
- if(UserManage.modifyUserInfo(user,"forward",forwardTo,server.getHostIp(),server.getManagePort())==0)
- form.addResult("msg","自动转发设置成功!");
- else form.addResult("msg","自动转发设置失败!");
- }
- }
- String forward=UserManage.getUserInfo(user,"forward",server.getHostIp(),server.getManagePort());
- if(forward!=null && (!forward.equals("")))
- {
- form.addResult("autoForward","true");
- form.addResult("autoForwardTo",forward);
- }
- return module.findPage("setting");
- }
- private Page doPersonal(WebForm form, Module module)
- {
- List list=Config.getDomains();
- form.addResult("list",list);
- return module.findPage("personal");
- }
- private Page doRefuse(WebForm form, Module module,ActiveUser user)
- {
- List list=Config.getDomains();
- form.addResult("list",list);
- return module.findPage("refuse");
- }
- private Page doFilter(WebForm form, Module module,ActiveUser user)
- {
- List list=Config.getDomains();
- form.addResult("list",list);
- return module.findPage("filter");
- }
- private Page doPassword(WebForm form, Module module,ActiveUser user)
- {
- String subCommand=CommUtil.null2String(form.get("subCommand"));
- if("change".equals(subCommand))
- {
- String oldPassword=CommUtil.null2String(form.get("oldPassword"));
- String password=CommUtil.null2String(form.get("password"));
- String password1=CommUtil.null2String(form.get("password1"));
- if(oldPassword.equals(user.getPassword()))
- {
- if(password.equals(password1))
- {
- MailServer server=Config.findServerByDomain(user.getServerDomain());
- if(UserManage.modifyPassword(user,password,server.getHostIp(),server.getManagePort())==0)
- {
- user.setPassword(password);
- form.addResult("msg","密码修改成功,请注意保存密码!");
- }
- else
- form.addResult("msg","密码修改失败,可能是权限不够!");
- }
- else
- {
- form.addResult("msg","两次输入的密码不正确!");
- }
- }
- else
- form.addResult("msg","旧密码不正确!");
- }
- return module.findPage("password");
- }
- /**
- * @param args
- */
- public static void main(String[] args) {
- // TODO Auto-generated method stub
- }
- }