NC65 如何添加个性化中心

需求:用户在登录NC系统时 可以进行手机短信提醒

           手机号用户可以自己进行维护。

思路:NC65有一个个性化中心   里面有个邮箱绑定功能

           因而可以根据邮箱绑定的功能 添加一个手机号绑定功能

效果如下:

系统案例                                                                                          

 

手机号案例:

 

具体步骤:

1、寻找邮箱绑定源码  登录集团账号 找到邮箱绑定的注册类

nc.individuation.defaultData.MailBingPage(可以去studio去搜索找到在哪个模块下)

 

2、在studio下搜索编译后的文件 找到对应的.class文件 

3、模仿邮箱绑定的功能 调整为手机号绑定功能

 源码如下:

package nc.individuation.defaultData;

import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.Font;
import java.util.Properties;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

import nc.bs.framework.common.NCLocator;
import nc.desktop.ui.WorkbenchEnvironment;
import nc.individuation.property.pub.AbstractIndividuationPage;
import nc.itf.fdgyl.IFdDBService;
import nc.ui.pub.beans.UILabel;
import nc.ui.pub.beans.UIPanel;
import nc.ui.pub.beans.UIPasswordField;
import nc.ui.pub.beans.UITextField;
import nc.ui.tools.query.PubTools;
import nc.vo.pub.BusinessException;
import nc.vo.sm.UserVO;

import com.borland.jbcl.layout.VerticalFlowLayout;


public class MobileBingPage extends AbstractIndividuationPage implements nc.pubitf.setting.defaultdata.IUAPDefaultSettingConst, nc.individuation.property.pub.IExceptionHandler  {

	private static final long serialVersionUID = 1L;
	private UILabel mobilePromptUL;
	private UserVO currentUser;
	private UITextField mobileTfd;
	private UIPanel mobilePanel;
	private UILabel mobileUL;
	private UILabel promotUL1;
	private UILabel promotUL2;
	private UIPanel up1;
	private UIPanel up2;
	private String mobileValue;
	private UIPanel pwdPanel;
	private UILabel pwdPromptUL;
	private UIPasswordField pwdTfd;
	private String password;
	 
	 public MobileBingPage()
	 {
		this.currentUser = WorkbenchEnvironment.getInstance().getLoginUser();
		initUI();
	 }
	
	 private void initUI() {
		setLayout(new VerticalFlowLayout());
	    createElementDiff();
	    initMobilePanel();
	    initPwdPanel();
	    initPromotPanel();
	    add(new UIPanel());
	    add(this.up1);
	    add(this.up2);
	    add(new UIPanel());
	    add(this.mobilePanel);
//	    add(this.pwdPanel);
	 }

	 private void createElementDiff()
	 {
		this.mobilePromptUL = new UILabel();
	    this.mobilePromptUL.setPreferredSize(new Dimension(80, 20));
	    this.mobilePromptUL.setHorizontalAlignment(4);
	    if (this.currentUser.getUser_note() == null) {
//	      this.promotUL1 = new UILabel("为了你的账户安全,请绑定手机号。绑定时需要提供系统密码以确定身份");
	      this.promotUL1 = new UILabel("为了你的账户安全,请绑定手机号。");
	      this.mobileUL = new UILabel();
	      this.promotUL2 = new UILabel("");
	      this.mobilePromptUL.setText("手机号");
	    }
	    else {
	      this.promotUL1 = new UILabel("您已成功绑定手机号:");
	      this.mobileUL = new UILabel(this.currentUser.getUser_note());
//	      this.promotUL2 = new UILabel("输入新手机号可以更改绑定手机号。更改手机号时需要您提供系统登录密码以确定您的身份。");
	      this.promotUL2 = new UILabel("输入新手机号可以更改绑定手机号。");
	      this.mobilePromptUL.setText("新手机号");
	    }
	    this.mobileUL.setFont(new Font("宋体", 1, 12));
	}
	private void initMobilePanel()
	{
	   this.mobilePanel = new UIPanel();
	   this.mobilePanel.setOpaque(false);
	   this.mobilePanel.setLayout(new FlowLayout(3, 40, 5));

	   this.mobileTfd = new UITextField();
	   this.mobileTfd.setPreferredSize(new Dimension(200, 20));
	   this.mobilePanel.add(this.mobilePromptUL);
	   this.mobilePanel.add(this.mobileTfd);
	} 
	
	private void initPwdPanel()
	  {
	    this.pwdPanel = new UIPanel();
	    this.pwdPanel.setOpaque(false);
	    this.pwdPanel.setLayout(new FlowLayout(3, 40, 5));
	    this.pwdPromptUL = new UILabel();
	    this.pwdPromptUL.setText("系统登录密码");

	    this.pwdPromptUL.setPreferredSize(new Dimension(80, 20));
	    this.pwdPromptUL.setHorizontalAlignment(4);
	    this.pwdPanel.add(this.pwdPromptUL);
	    this.pwdTfd = new UIPasswordField();
	    this.pwdTfd.setPreferredSize(new Dimension(200, 20));
	    this.pwdPanel.add(this.pwdTfd);
	  }
	
	 private void initPromotPanel()
	  {
	    this.up1 = new UIPanel();
	    this.up1.setLayout(new FlowLayout(3, 20, 0));
	    this.up2 = new UIPanel();
	    this.up2.setLayout(new FlowLayout(3, 20, 0));
	    this.up1.add(this.promotUL1);
	    this.up1.add(this.mobileUL);
	    this.up2.add(this.promotUL2);
	  }
     /**
      * 应用
      */
	 public void onApply()throws Exception
	  {
	    getViewValues();
	    validateInput();
	    doUpdateMobile();
	  }
      
	 public void onOK()throws Exception
	  {
	    if (isEditStatus()) {
	      onApply();
	    }
	    else
	      super.onCancel();
	  }
	 
	 private boolean isEditStatus()
	  {
	    boolean isEditing = true;
	    if ("".equals(this.mobileTfd.getText().trim()))
	    {
	      isEditing = false;
	    }
	    return isEditing;
	  }
	  private void getViewValues()
	  {
	    this.mobileValue = this.mobileTfd.getText();
	    this.password = new String(this.pwdTfd.getPassword());
	  }

	  private boolean validateMobileForm(String mobile)
	  {
	    boolean flag = false;
	    try {
	      String check = "^((13[0-9])|(14[5|7])|(15([0-3]|[5-9]))|(18[0,5-9]))\\d{8}$";
	      Pattern regex = Pattern.compile(check);
	      Matcher matcher = regex.matcher(mobile);
	      flag = matcher.matches();
	    } catch (Exception e) {
	      flag = false;
	    }
	    return flag;
	  }
	  
	  private void validateInput() throws BusinessException
	  {
	    if (!validateMobileForm(this.mobileValue))
	      throw new BusinessException("手机号格式错误!请检查!");
	  }

	  private void doUpdateMobile()throws BusinessException
	  {
		 updateMobile();
	     updateView();
	     this.currentUser.setUser_note(this.mobileValue);
	  }

	  private void updateMobile() throws BusinessException
	  {
		    Properties p = PubTools.getParameterInfo();
			String design = p.getProperty("design");
			StringBuffer sbup = new StringBuffer();
			String sql = " update sm_user set user_note ='"+this.mobileValue+"' where user_code = '"+currentUser.getUser_code()+"';";
			sbup.append(sql);
			try {
				this.getFdDBService().updateDatas(sbup,design);
			} catch (BusinessException e) {
				e.printStackTrace();
			}
	  }

	 public IFdDBService getFdDBService() {
			IFdDBService fddbService = NCLocator.getInstance().lookup(
					IFdDBService.class);
			return fddbService;
	  }
	
	 private void updateView()
	  {
	    this.mobileUL.setText(this.mobileValue);
	    this.mobilePromptUL.setText("新手机号");
	    this.promotUL1.setText("您已成功绑定手机号:");
	    this.promotUL2.setText("输入新手机号可以更改绑定手机号。");
	    this.mobileTfd.setText(null);
	    this.pwdTfd.setText(null);
	  }

	 
	 @Override
	 public String getDescription() {
	 	return "绑定手机号可用于登录时提示手机短消息,增加您账户的安全性。";
	 }

	 @Override
	 public String getTitle() {
		return "手机号绑定";
	 }

	@Override
	public void handleException(Throwable arg0) {
		// TODO 自动生成的方法存根
		
	}

}

4、把新增的类注册到个性化中心下

5、重启服务器 (注:新增类 个性化中心 注册后 一定要重启服务器才生效)

6、手机号的存放的位置 用户的备注字段

     效果图:

    

    7、测试功能

总结: studio调试的时候 是立即生效的  但是打补丁到nchome下modules后 一定要重启服务器才生效  

 

 

用友 NC 是一款企业级管理软件,在近万家大中型企业使用。实现建模、开发、继承、运行、管理一体化的 IT 解决方案信息化平台,其代码实现逻辑上存在多处反序列化漏洞。   2020 年 6 月 4 日,有国内安全组织披露用友 NC 存在反序列化远程命令执行“0-Day”漏洞。经分析,漏洞真实存在,攻击者通过构造特定的 HTTP 请求,可以成功利用漏洞在目标服务器上执行任意命令,该漏洞风险极大,可能造成严重的信息泄露事件。鉴于漏洞利用的源代码已经公开,建议用户尽快修复此漏洞。   2、攻击原理   通过UClient打开用友NC,UClient本质为UBroswer,一个专用的用友NC浏览器嵌入了JAVA运行环境,以解决NC 6系列之前的版本中applet在不同设备上的应用问题。经过文件目录查看分析得知用友UClient安装后,会在用户目录下新建uclient文件夹,根据看到的NCLogin65.jar文件,结合java运行进程信息,分析得知是一些界面和登陆逻辑代码,nc_client_home则是NC应用依赖的其他一些代码和jar包,因此可以使用Luyten反编译工具查看NCLogin65.jar,通过简单运行NC应用,尝试进行用户登陆,使用wireshark抓包,查看app.log运行日志,发现大量serialize和deserialize,说明系统中应用了序列化方式来传送数据。在LoginUI类中的login方法打断点,启动Idea进行跟踪调试,当跟踪到loginImple方法时,发现多处调用了NCLocator的lookup方法查找Service接口进行操作,通过跟踪发现,实际使用了RmiNCLocator类,RmiNCLocator类的lookup方法,这里的lookup,已初步判断出无需继续跟踪调试,可以直接通过jndi注入漏洞进行利用。   黑客就是通过构造特定的 HTTP 请求,成功利用漏洞可在目标服务器上执行任意命令,漏洞暂无安全补丁发布,属 0Day 等级,风险极大。黑客利用漏洞可完全控制服务器,获取服务器的敏感信息。   3、影响范围   用友NC全版本
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值