Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
N
nouiWithSpringMVC
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
gechengyang
nouiWithSpringMVC
Commits
9bc4d82a
Commit
9bc4d82a
authored
Sep 05, 2020
by
WeiCong
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1.后台实现登陆界面的验证码功能
2.调整部分参数配置
parent
97637c72
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
35 additions
and
19 deletions
+35
-19
DatabaseLoginContextForELCS.java
...com/brilliance/eibs/auth/DatabaseLoginContextForELCS.java
+6
-0
ErrorCode.java
...ava/org/sss/presentation/noui/api/response/ErrorCode.java
+1
-0
Constants.java
...main/java/org/sss/presentation/noui/common/Constants.java
+2
-0
LoginController.java
...org/sss/presentation/noui/controller/LoginController.java
+6
-1
eIBS.xml
src/main/resources/eIBS.xml
+18
-17
spring-mvc.xml
src/main/resources/spring-mvc.xml
+1
-0
web.xml
src/main/webapp/WEB-INF/web.xml
+1
-1
transaction.properties
src/main/webapp/cfg/transaction.properties
+0
-0
No files found.
src/main/java/cn/com/brilliance/eibs/auth/DatabaseLoginContextForELCS.java
View file @
9bc4d82a
...
...
@@ -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
);
...
...
src/main/java/org/sss/presentation/noui/api/response/ErrorCode.java
View file @
9bc4d82a
...
...
@@ -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"
,
"无效用户"
);
...
...
src/main/java/org/sss/presentation/noui/common/Constants.java
View file @
9bc4d82a
...
...
@@ -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"
;
...
...
src/main/java/org/sss/presentation/noui/controller/LoginController.java
View file @
9bc4d82a
...
...
@@ -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
)
{
...
...
src/main/resources/eIBS.xml
View file @
9bc4d82a
...
...
@@ -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.Password
Filter"
/>
<property
name=
"passwordFilter"
class=
"org.sss.
presentation.noui.filter.PasswordSM2
Filter"
/>
<!-- 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=
"
5
000,5000"
class=
"long[]"
/>
<property
name=
"millises"
value=
"
60
000,5000"
class=
"long[]"
/>
<property
name=
"timeouts"
value=
"600000,600000"
class=
"long[]"
/>
</service>
<!-- <service class="org.sss.presentation.zk.ZkUtils" initMethodName="init" deinitMethodName="deinit">
...
...
src/main/resources/spring-mvc.xml
View file @
9bc4d82a
...
...
@@ -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>
...
...
src/main/webapp/WEB-INF/web.xml
View file @
9bc4d82a
...
...
@@ -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.DatabaseLoginContext
ForELCS
</param-value>
</context-param>
<context-param>
<param-name>
nouiTimeout
</param-name>
...
...
src/main/webapp/cfg/transaction.properties
View file @
9bc4d82a
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment