Commit 9bc4d82a by WeiCong

1.后台实现登陆界面的验证码功能

2.调整部分参数配置
parent 97637c72
......@@ -172,6 +172,8 @@ public class DatabaseLoginContextForELCS extends AbstractLoginContext {
this._userName = null;
String userName = getParameter(parameterMap, "j_username");
String password = getParameter(parameterMap, "j_password");
String sendcode = getParameter(parameterMap, "j_sendcode");
String verifycode = getParameter(parameterMap, "j_verifycode");
// String dncode = getParameter(parameterMap, "j_dncode");
if (userName == null || password == null /*|| dncode==null*/ ){
parameterMap.put(ERROR, ErrorCode.LOGIN_PARAMETER_CHECK);
......@@ -196,6 +198,10 @@ public class DatabaseLoginContextForELCS extends AbstractLoginContext {
sessionTimeout = -1;
return setLogon(true, userName, null, "游客成功登录.", stmt, rs);
}
if(sendcode==null || verifycode==null || !sendcode.equalsIgnoreCase(verifycode)){
parameterMap.put(ERROR, ErrorCode.LOGIN_VERIFYCODE_ERROR);
return setLogon(false, userName, ErrorCode.LOGIN_VERIFYCODE_ERROR.getCode(), ErrorCode.LOGIN_VERIFYCODE_ERROR.getMessage(), stmt, rs);
}
userId = rs.getString(1);
log.debug("userId=" + userId);
String dbPassword = rs.getString(2);
......
......@@ -17,6 +17,7 @@ public enum ErrorCode {
LOGIN_EXPRIED_USR("R9990","用户已被注销"),
LOGIN_PWD_ERROR("R9989","密码错误!"),
LOGIN_DN_ERROR("R9988","DN码错误!"),
LOGIN_VERIFYCODE_ERROR("R9986","验证码错误!"),
LOGIN_STATE_ABNORMAL_ERROR("R9987","无效用户");
......
......@@ -9,6 +9,8 @@ public class Constants {
public final static String USERNAME = "username";
public final static String PASSWORD = "password";
public final static String DNCODE = "dncode";
public final static String SENDCODE = "sendcode";
public final static String VERIFYCODE = "verifycode";
public final static String DISPLAY_FILE_NAME = "fileName";
......
......@@ -48,10 +48,14 @@ public class LoginController {
Map<String, Object> map = new HashMap<>();//此map会存储返回错误码
String userId = noUiRequest.getDataMap().get(Constants.USERNAME).toString();
String password = noUiRequest.getDataMap().get(Constants.PASSWORD).toString();
String dncode = noUiRequest.getDataMap().get(Constants.DNCODE).toString();
String dncode = noUiRequest.getDataMap().get(Constants.DNCODE)==null?null:noUiRequest.getDataMap().get(Constants.DNCODE).toString();
String sendcode = noUiRequest.getDataMap().get(Constants.SENDCODE)==null?null:noUiRequest.getDataMap().get(Constants.SENDCODE).toString();
String verifycode = session.getAttribute(Constants.VERIFYCODE)==null?null:session.getAttribute(Constants.VERIFYCODE).toString();
map.put("j_username", userId);
map.put("j_password", password);
map.put("j_dncode", dncode);
map.put("j_sendcode", sendcode);
map.put("j_verifycode", verifycode);
NoUiContext context = NoUiContextManager.createNoUiContext(noUiRequest);
try {
if (context.getSession().login(map)) {
......@@ -95,6 +99,7 @@ public class LoginController {
}else {
final ErrorCode errorCode = (ErrorCode) map.get(ERROR);
log.error(errorCode);
session.removeAttribute(Constants.VERIFYCODE);
return ResultUtil.result(errorCode.getCode(), errorCode.getMessage(), null,noUiParam.getVersion());
}
} catch (Exception e) {
......
......@@ -22,26 +22,27 @@
</service>
-->
<service class="org.sss.module.hibernate.HibernateUtils" initMethodName="init" deinitMethodName="deinit">
<!-- 生成数据库脚本(设置全路径或相对路径,生成出来作为参考,为空则不生成) -->
<property name="scriptFile" value="/Users/JasonHoo/Downloads/eIBS.sql" />
<!-- 自动重建数据库表 -->
<property name="autoCreate" value="false" class="boolean" />
<!-- 设置默认查询最大读取数(0为无限制) -->
<property name="maxFetchSize" value="1000" class="int" />
<!-- 是否使用sequence(目前仅支持Oracle/DB2/PostgreSQL) -->
<property name="sequenceUsed" value="true" class="boolean" />
<!-- 是否忽略dbFetch时的错误,用于兼容旧程序fetch不存在列返回空的处理 -->
<property name="ignoreFetchError" value="false" class="boolean" />
<!-- sequence的命名前缀 -->
<property name="sequencePrefix" value="seq_" />
<!-- 生成代码基本包名(不可修改) -->
<!-- 生成数据库脚本(设置全路径或相对路径,生成出来作为参考,为空则不生成) -->
<property name="scriptFile" value="" />
<!-- 自动重建数据库表 -->
<property name="autoCreate" value="false" class="boolean" />
<!-- 设置默认查询最大读取数(0为无限制) -->
<property name="maxFetchSize" value="5000" class="int" />
<!-- 是否使用sequence(目前仅支持Oracle/DB2/PostgreSQL) -->
<property name="sequenceUsed" value="false" class="boolean" />
<!-- 是否忽略dbFetch时的错误,用于兼容旧程序fetch不存在列返回空的处理 -->
<property name="ignoreFetchError" value="false" class="boolean" />
<!-- sequence的命名前缀 -->
<property name="sequencePrefix" value="seq_" />
</service>
<!-- <service class="org.sss.presentation.zk.ZkDisplayUtils">
<property name="unit" value="px" />
<property name="leftOffset" value="5" class="int" />
<property name="topOffset" value="55" class="int" />
</service> -->
<service class="org.sss.presentation.noui.util.NoUiUtils"
initMethodName="init" deinitMethodName="deinit">
<service class="org.sss.presentation.noui.util.NoUiUtils"
initMethodName="init" deinitMethodName="deinit">
<property name="connectKeeped" value="true" class="boolean" />
<property name="debugMode" value="false" class="boolean" />
<!-- WAR包本身的目录为变量$ROOT,WAR/WEB-INF/classes目录为变量$HOME -->
......@@ -50,13 +51,13 @@
<property name="resourcePath" value="$ROOT/upload" /> -->
<!-- 代码转换的实现(可替换,但必须实现ICodetable接口) -->
<property name="tbl" class="org.sss.common.impl.CodetableImpl"
methodName="getInstance">
methodName="getInstance">
<property name="homePath" value="$HOME" direct="false" />
</property>
<!-- 国际化的实现(可替换,但必须实现II18n接口) -->
<property name="i18n" class="org.sss.common.impl.I18nImpl" />
<!-- 密码编解码的实现(可替换,但必须实现IFilter接口) -->
<property name="passwordFilter" class="org.sss.common.impl.PasswordFilter" />
<property name="passwordFilter" class="org.sss.presentation.noui.filter.PasswordSM2Filter" />
<!-- Module工厂实现(不可替换) -->
<property name="factory" class="org.sss.module.hibernate.ModuleSessionFactory" />
<!-- 后台应用服务启动用户名 -->
......@@ -70,7 +71,7 @@
<!-- 服务列表(以逗号隔开多个服务名,服务名前加下划线忽略后台应用服务超时时间) -->
<property name="serviceNames" value="" class="java.lang.String[]" />
<property name="userNames" value="bgUser1,bgUser2" class="java.lang.String[]" />
<property name="millises" value="5000,5000" class="long[]" />
<property name="millises" value="60000,5000" class="long[]" />
<property name="timeouts" value="600000,600000" class="long[]" />
</service>
<!-- <service class="org.sss.presentation.zk.ZkUtils" initMethodName="init" deinitMethodName="deinit">
......
......@@ -24,6 +24,7 @@
<mvc:mapping path="/**" />
<!--login 不需要拦截 -->
<mvc:exclude-mapping path="/login" />
<mvc:exclude-mapping path="/VerifyCode" />
<mvc:exclude-mapping path="/fileBrowser/**" />
<bean class="org.sss.presentation.noui.jwt.TokenInterceptor"></bean>
</mvc:interceptor>
......
......@@ -26,7 +26,7 @@
</context-param>
<context-param>
<param-name>loginContextName</param-name>
<param-value>cn.com.brilliance.eibs.auth.DatabaseLoginContext</param-value>
<param-value>cn.com.brilliance.eibs.auth.DatabaseLoginContextForELCS</param-value>
</context-param>
<context-param>
<param-name>nouiTimeout</param-name>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment