账号密码校验方式原创
金蝶云社区-陈来珍
陈来珍
3人赞赏了该文章 1377次浏览 未经作者许可,禁止转载编辑于2023年03月16日 10:13:52
  • 案例背景:

        在自定义表单中用插件的方式校验用户的账号、密码是否正确

  • 参考案例:

	//校验方式是账号密码
		LoginUserAuth lua = (LoginUserAuth)BeanUtils.getBean(SelfCreateAuth.class.getName());
		//输入的账号,密码
		UserAccount userAccount = new UserAccount("19878646323", "Cxxxxxx");
		//指定数据中心(数据中心id,租户id)
		Account currentCenter=AccountUtils.getCorrectAccount("679008189806~~~", "cosmic-simple");
		UserAuthResult userAuthrize = lua.userAuthrize(userAccount, currentCenter);
		if (userAuthrize.isSucess()) {
			//账号密码认证成功
		}else {
			this.getView().showMessage(userAuthrize.getErrDesc());
		}

上面的校验类SelfCreaterAuth是通过账号密码登录的方式校验逻辑,其他的方式在反编译的类可以看到校验逻辑kd.bos.login.actions.LoginAction.login(HttpServletRequest servletRequest, HttpServletResponse servletResponse)

image.png

赞 3