Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
onionZunyi
beauty_ssm
提交
e427371e
B
beauty_ssm
项目概览
onionZunyi
/
beauty_ssm
与 Fork 源项目一致
Fork自
爱吃血肠 / beauty_ssm
通知
6
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
B
beauty_ssm
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
提交
e427371e
编写于
3月 13, 2018
作者:
爱吃血肠
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
提交上次代码
上级
390065f2
变更
8
显示空白变更内容
内联
并排
Showing
8 changed file
with
129 addition
and
23 deletion
+129
-23
src/main/java/com/yingjun/ssm/service/UserService.java
src/main/java/com/yingjun/ssm/service/UserService.java
+6
-0
src/main/java/com/yingjun/ssm/service/impl/UserServiceImpl.java
...in/java/com/yingjun/ssm/service/impl/UserServiceImpl.java
+9
-0
src/main/java/com/yingjun/ssm/util/CodeUtil.java
src/main/java/com/yingjun/ssm/util/CodeUtil.java
+20
-0
src/main/java/com/yingjun/ssm/web/UserController.java
src/main/java/com/yingjun/ssm/web/UserController.java
+36
-0
src/main/webapp/WEB-INF/jsp/common/home.jsp
src/main/webapp/WEB-INF/jsp/common/home.jsp
+1
-1
src/main/webapp/WEB-INF/jsp/user/userLogin.jsp
src/main/webapp/WEB-INF/jsp/user/userLogin.jsp
+1
-1
src/main/webapp/WEB-INF/jsp/user/userResgiter.jsp
src/main/webapp/WEB-INF/jsp/user/userResgiter.jsp
+6
-4
src/main/webapp/resource/script/userResgiter.js
src/main/webapp/resource/script/userResgiter.js
+50
-17
未找到文件。
src/main/java/com/yingjun/ssm/service/UserService.java
浏览文件 @
e427371e
...
...
@@ -72,4 +72,10 @@ public interface UserService {
* return 当前用户
*/
public
User
checkUserLogin
(
User
user
);
/**
* 处理用户注册
* @param user
*/
public
void
userRegister
(
User
user
);
}
\ No newline at end of file
src/main/java/com/yingjun/ssm/service/impl/UserServiceImpl.java
浏览文件 @
e427371e
...
...
@@ -81,6 +81,15 @@ public class UserServiceImpl implements UserService {
}
/**
* 处理用户注册
* @param user
*/
@Override
public
void
userRegister
(
User
user
)
{
}
public
UserDao
getTUserDao
()
{
return
this
.
userDao
;
}
...
...
src/main/java/com/yingjun/ssm/util/CodeUtil.java
0 → 100644
浏览文件 @
e427371e
package
com.yingjun.ssm.util
;
/**
* 生成6位随机验证码
* @author liyunfeng
*/
public
class
CodeUtil
{
public
static
Integer
getRandNum
(
int
min
,
int
max
)
{
Integer
randNum
=
min
+
(
int
)(
Math
.
random
()
*
((
max
-
min
)
+
1
));
return
randNum
;
}
public
static
String
rand
(){
return
getRandNum
(
100000
,
999999
).
toString
().
trim
();
}
public
static
void
main
(
String
[]
args
){
rand
();
}
}
src/main/java/com/yingjun/ssm/web/UserController.java
浏览文件 @
e427371e
...
...
@@ -6,7 +6,9 @@ import com.yingjun.ssm.entity.User;
import
com.yingjun.ssm.enums.ResultEnum
;
import
com.yingjun.ssm.exception.BizException
;
import
com.yingjun.ssm.service.UserService
;
import
com.yingjun.ssm.util.CodeUtil
;
import
com.yingjun.ssm.util.LoginContext
;
import
com.yingjun.ssm.util.MailUtil
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
org.springframework.beans.factory.annotation.Autowired
;
...
...
@@ -63,6 +65,40 @@ public class UserController {
LOG
.
info
(
"用户注册"
);
return
"/user/userResgiter"
;
}
/**
* 处理用户注册
* @return
*/
@ResponseBody
@RequestMapping
(
value
=
"/register"
,
produces
=
{
"application/json;charset=UTF-8"
})
public
BaseResult
<
Object
>
register
(
User
user
)
{
try
{
userService
.
userRegister
(
user
);
}
catch
(
BizException
e
)
{
return
new
BaseResult
<>(
false
,
e
.
getMessage
());
}
catch
(
Exception
e
)
{
return
new
BaseResult
<>(
false
,
ResultEnum
.
INVALID_USER
.
getMsg
());
}
return
new
BaseResult
<>(
true
,
"登陆成功"
);
}
/**
* 用户注册时获取邮箱验证码
* @return
*/
@ResponseBody
@RequestMapping
(
value
=
"/getEmailCode"
,
produces
=
{
"application/json;charset=UTF-8"
})
public
BaseResult
<
Object
>
getEmailCode
(
@RequestParam
String
email
,
HttpSession
session
)
{
try
{
String
code
=
CodeUtil
.
rand
();
MailUtil
.
sendMail
(
email
,
code
);
session
.
setAttribute
(
"code"
,
code
);
}
catch
(
BizException
e
)
{
return
new
BaseResult
<>(
false
,
e
.
getMessage
());
}
catch
(
Exception
e
)
{
return
new
BaseResult
<>(
false
,
ResultEnum
.
INVALID_USER
.
getMsg
());
}
return
new
BaseResult
<>(
true
,
"登陆成功"
);
}
/**
* 用户登录成功到达首页
* @return
...
...
src/main/webapp/WEB-INF/jsp/common/home.jsp
浏览文件 @
e427371e
...
...
@@ -20,7 +20,7 @@
<!--首页头部-->
<header>
<div
class=
"header-content"
>
<div
class=
"logo"
><span
class=
"logo-img"
>
京东益世
集群注册平台
</span></div>
<div
class=
"logo"
><span
class=
"logo-img"
>
集群注册平台
</span></div>
<div
class=
"header-menu"
>
<ul>
<li
class=
"active"
><a
href=
"/user/home"
>
首页
</a></li>
...
...
src/main/webapp/WEB-INF/jsp/user/userLogin.jsp
浏览文件 @
e427371e
...
...
@@ -51,7 +51,7 @@
</li>
</ul>
<div
class=
"forgatPwd"
>
<a
href=
"
userResgiter.jsp
"
>
新用户注册
</a>
<a
href=
"
/user/userRegister
"
>
新用户注册
</a>
<a
href=
"findPwd.html"
>
忘记密码
</a>
</div>
<div
id=
"loginBtn"
class=
"myBtn mar-t-30"
style=
""
>
...
...
src/main/webapp/WEB-INF/jsp/user/userResgiter.jsp
浏览文件 @
e427371e
...
...
@@ -27,7 +27,7 @@
<li><a
href=
"registration.html"
>
工商注册
</a></li>
<li
class=
"active"
><a
href=
"#"
>
个人中心
</a></li>
<li><a
href=
"enterprise.html"
>
企业中心
</a></li>
<li><a
href=
"
/contactUs/connection"
>
联系我们
</a></li>
<li><a
href=
"
#"
>
技术支持
</a></li>
</ul>
</div>
</div>
...
...
@@ -35,12 +35,13 @@
<div
class=
"enter-content"
>
<h3
class=
"tit"
>
用户注册信息
</h3>
<form
id=
"register"
name=
"register"
action=
"userLogin.jsp"
method=
"post"
>
<div
class=
"findPwd"
>
<div
class=
"contentInfo"
>
<ul
class=
"getInfo margin-t-49 margin-l-40"
>
<li
class=
"margin-b-19"
>
<label
class=
"infoName1 inputDes"
for=
"
tel"
>
登录手机号
:
</label>
<input
class=
"info write-n"
type=
"text"
name=
"
tel"
id=
"tel"
value=
"139****2345"
placeholder=
"请输入登录手机号码
"
/>
<label
class=
"infoName1 inputDes"
for=
"
email"
>
登录邮箱
:
</label>
<input
class=
"info write-n"
type=
"text"
name=
"
email"
id=
"email"
value=
""
placeholder=
"请输入登录邮箱
"
/>
</li>
<li
class=
"margin-b-19"
>
<label
class=
"infoName1 inputDes"
for=
"code"
>
验证码:
</label>
...
...
@@ -49,7 +50,7 @@
</li>
<li
class=
"margin-b-19"
>
<label
class=
"infoName1 inputDes"
for=
"newPwd"
>
设置登录密码:
</label>
<input
class=
"info write-n"
type=
"text"
name=
"
newPw
d"
id=
"newPwd"
value=
""
placeholder=
"请设置密码"
/>
<input
class=
"info write-n"
type=
"text"
name=
"
passwor
d"
id=
"newPwd"
value=
""
placeholder=
"请设置密码"
/>
</li>
<li
class=
"margin-b-19"
>
<label
class=
"infoName1 inputDes"
for=
"pwd-a"
>
再次输入密码:
</label>
...
...
@@ -61,6 +62,7 @@
</div>
</div>
</div>
</form>
</div>
<footer>
...
...
src/main/webapp/resource/script/userResgiter.js
浏览文件 @
e427371e
...
...
@@ -8,11 +8,11 @@ $(function(){
$this
.
next
().
remove
();
$this
.
removeClass
(
'
noPass
'
)
}
$this
.
after
(
'
<span class="passImg"><img src="img/pass.png"/></span>
'
)
$this
.
after
(
'
<span class="passImg"><img src="
/resource/
img/pass.png"/></span>
'
)
}
else
{
$this
.
next
().
remove
();
$this
.
addClass
(
'
noPass
'
)
$this
.
after
(
'
<span class="noPassImg-bounce"><img src="img/refuse.png"/>不能为空</span>
'
)
$this
.
after
(
'
<span class="noPassImg-bounce"><img src="
/resource/
img/refuse.png"/>不能为空</span>
'
)
}
})
$
(
"
#code
"
).
blur
(
function
(){
...
...
@@ -24,13 +24,13 @@ $(function(){
$this
.
next
().
remove
();
$this
.
removeClass
(
'
noPass
'
)
}
$this
.
after
(
'
<span class="passImg"><img src="img/pass.png"/></span>
'
)
$this
.
after
(
'
<span class="passImg"><img src="
/resource/
img/pass.png"/></span>
'
)
}
else
{
$
(
'
.noPassImg-bounce
'
).
remove
();
$
(
'
.passImg
'
).
remove
();
$
(
"
#getCode
"
).
css
({
'
margin-left
'
:
'
35px
'
})
$this
.
addClass
(
'
noPass
'
)
$this
.
after
(
'
<span class="noPassImg-bounce"><img src="img/refuse.png"/></span>
'
)
$this
.
after
(
'
<span class="noPassImg-bounce"><img src="
/resource/
img/refuse.png"/></span>
'
)
}
})
})
...
...
@@ -42,8 +42,25 @@ function addReceive(){
function
closeBounce
(){
$
(
"
.bounces
"
).
addClass
(
'
hide
'
);
}
// 获取验证码
function
settime
(
val
)
{
var
$val
=
$
(
val
);
if
(
countdown
==
60
){
//异步发送验证码
$
.
ajax
({
type
:
'
POST
'
,
data
:
$
(
'
#register
'
).
serialize
(),
dataType
:
"
json
"
,
url
:
'
/user/getEmailCode
'
,
success
:
function
(
data
)
{
if
(
data
.
success
)
{
}
else
{
}
}
});
}
if
(
countdown
==
0
)
{
$
(
'
#getCode
'
).
removeClass
(
'
countBtn
'
);
$
(
'
#getCode
'
).
addClass
(
'
bounceBtn
'
);
...
...
@@ -67,6 +84,22 @@ function sure(){
if
(
$pwda
!=
$newPwd
)
{
$
(
"
#pwd-a
"
).
next
().
remove
();
$
(
"
#pwd-a
"
).
addClass
(
'
noPass
'
)
$
(
"
#pwd-a
"
).
after
(
'
<span class="noPassImg-bounce"><img src="img/refuse.png"/>输入不一致</span>
'
)
$
(
"
#pwd-a
"
).
after
(
'
<span class="noPassImg-bounce"><img src="/resource/img/refuse.png"/>输入不一致</span>
'
)
return
;
}
$
.
ajax
({
type
:
'
POST
'
,
data
:
$
(
'
#register
'
).
serialize
(),
dataType
:
"
json
"
,
url
:
'
/user/register
'
,
success
:
function
(
data
)
{
if
(
data
.
success
)
{
}
else
{
}
}
});
}
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录