Skip to content
项目
群组
代码片段
帮助
正在加载...
帮助
提交反馈
为 GitLab 提交贡献
登录
切换导航
I
ibzuaa
项目
项目
详情
动态
版本
周期分析
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
统计图
议题
0
议题
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
CI / CD
CI / CD
流水线
作业
计划
统计图
Wiki
Wiki
代码片段
代码片段
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
统计图
创建新议题
作业
提交
议题看板
打开侧边栏
ibiz4jteam
ibzuaa
提交
b6d92296
提交
b6d92296
编写于
6月 05, 2020
作者:
laizhilong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
登录注册改造
上级
00807395
变更
12
展开全部
隐藏空白字符变更
内嵌
并排
正在显示
12 个修改的文件
包含
823 行增加
和
182 行删除
+823
-182
QQ.svg
app_web/public/assets/img/QQ.svg
+1
-0
background.png
app_web/public/assets/img/background.png
+0
-0
weixin.svg
app_web/public/assets/img/weixin.svg
+1
-0
login.less
app_web/src/components/login/login.less
+105
-60
login.vue
app_web/src/components/login/login.vue
+233
-118
register.less
app_web/src/components/login/register.less
+110
-0
register.vue
app_web/src/components/login/register.vue
+258
-0
index.ts
app_web/src/router/index.ts
+4
-1
webSecurityConfig.java
...rc/main/java/cn/ibizlab/web/config/webSecurityConfig.java
+2
-3
DevBootSecurityConfig.java
...rc/main/java/cn/ibizlab/config/DevBootSecurityConfig.java
+1
-0
UserRegisterService.java
...zlab/core/uaa/extensions/service/UserRegisterService.java
+34
-0
UserRegisterResource.java
.../cn/ibizlab/api/rest/extensions/UserRegisterResource.java
+74
-0
未找到文件。
app_web/public/assets/img/QQ.svg
0 → 100644
浏览文件 @
b6d92296
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg
class=
"icon"
width=
"200px"
height=
"200.00px"
viewBox=
"0 0 1024 1024"
version=
"1.1"
xmlns=
"http://www.w3.org/2000/svg"
><path
d=
"M511.999 1024a512 512 0 1 0-512-512 512 512 0 0 0 512 512z"
fill=
"#23A0F0"
/><path
d=
"M735.765 604.422c-3.55-49.47-36.192-90.932-55.09-112.47a70.383 70.383 0 0 0-15.577-67.003v-1.718c0-97.235-68.028-167.254-153.35-167.55-85.333 0.342-153.35 70.315-153.35 167.55v1.718a70.383 70.383 0 0 0-15.576 67.003c-18.898 21.413-51.54 62.874-55.09 112.47a75.39 75.39 0 0 0 7.554 40.425c7.555 10.308 28.513-2.06 43.406-34.93a210.33 210.33 0 0 0 35.499 67.914c-36.307 8.477-46.729 44.897-34.475 64.853 8.59 14.086 28.445 25.657 62.419 25.657 60.473 0 87.267-16.611 99.18-28.057a16.259 16.259 0 0 1 20.844 0c11.913 11.57 38.684 28.057 99.18 28.057 34.02 0 53.715-11.57 62.419-25.657 12.253-19.922 1.831-56.342-34.475-64.853a211.627 211.627 0 0 0 35.499-67.914c14.893 32.87 35.85 45.124 43.406 34.93a76.493 76.493 0 0 0 7.577-40.425z"
fill=
"#FFFFFF"
/></svg>
\ No newline at end of file
app_web/public/assets/img/background.png
0 → 100644
浏览文件 @
b6d92296
145.0 KB
app_web/public/assets/img/weixin.svg
0 → 100644
浏览文件 @
b6d92296
<?xml version="1.0" standalone="no"?><!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg
class=
"icon"
width=
"200px"
height=
"200.00px"
viewBox=
"0 0 1024 1024"
version=
"1.1"
xmlns=
"http://www.w3.org/2000/svg"
><path
fill=
"#36ab60"
d=
"M352.814545 385.396364m-33.512727 0a33.512727 33.512727 0 1 0 67.025455 0 33.512727 33.512727 0 1 0-67.025455 0Z"
/><path
fill=
"#36ab60"
d=
"M502.690909 384.465455m-33.512727 0a33.512727 33.512727 0 1 0 67.025454 0 33.512727 33.512727 0 1 0-67.025454 0Z"
/><path
fill=
"#36ab60"
d=
"M576.232727 534.341818m-23.272727 0a23.272727 23.272727 0 1 0 46.545455 0 23.272727 23.272727 0 1 0-46.545455 0Z"
/><path
fill=
"#36ab60"
d=
"M694.458182 536.203636m-23.272727 0a23.272727 23.272727 0 1 0 46.545454 0 23.272727 23.272727 0 1 0-46.545454 0Z"
/><path
fill=
"#36ab60"
d=
"M512 0C229.003636 0 0 229.003636 0 512s229.003636 512 512 512 512-229.003636 512-512S794.996364 0 512 0z m-87.505455 630.225455c-26.996364 0-48.407273-5.585455-75.403636-11.17091l-75.403636 37.236364 21.410909-64.232727c-53.992727-37.236364-85.643636-85.643636-85.643637-145.221818 0-102.4 96.814545-182.458182 215.04-182.458182 105.192727 0 198.283636 64.232727 216.901819 150.807273-6.516364-0.930909-13.963636-0.930909-20.48-0.93091-102.4 0-182.458182 76.334545-182.458182 170.356364 0 15.825455 2.792727 30.72 6.516363 44.683636-7.447273 0-13.963636 0.930909-20.48 0.93091z m314.647273 75.403636l15.825455 53.992727-58.647273-32.581818c-21.410909 5.585455-42.821818 11.170909-64.232727 11.170909-102.4 0-182.458182-69.818182-182.458182-155.461818s80.058182-155.461818 182.458182-155.461818c96.814545 0 182.458182 69.818182 182.458182 155.461818 0 47.476364-31.650909 90.298182-75.403637 122.88z"
/></svg>
\ No newline at end of file
app_web/src/components/login/login.less
浏览文件 @
b6d92296
.login{
.login{
width: 100vh;
display: -webkit-box;
height: 100vh;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-ms-flex-direction: column;
flex-direction: column;
min-height: 100%;
background: #108cee;
> img{
> img{
width: 100vw;
width: 100vw;
height: 100vh;
height: 100vh;
}
}
.login-logo{
position: fixed;
left: 80px;
top: 80px;
}
.login-content{
position: fixed;
left: 10%;
top: 30%;
width: 60%;
>span{
color: #fff;
font-size: 84px;
}
}
&-con{
&-con{
position: fixed;
position: absolute;
right: 160px;
left: 0;
top: 50%;
right: 0;
transform: translateY(-60%);
top: 150px;
width: 300px;
margin: auto;
.ivu-card{
width: 400px;
border-radius: 15px;
.ivu-card-head {
.ivu-card-head {
padding: 14px 6px;
padding: 14px 6px;
>p{
>p{
line-height: 20px;
line-height: 20px;
font-size: 14px;
font-size: 20px;
color: #17233d;
color: #17233d;
font-weight: 700;
font-weight: 700;
text-align:center;
}
}
&-header{
font-size: 16px;
font-weight: 300;
text-align: center;
padding: 30px 0;
}
.form-con{
padding: 10px 0 0;
.ivu-form-item{
margin-bottom: 20px;
}
p{
font-size: 14px;
font-weight: bold;
height: 21px;
line-height: 21px;
}
button{
background-image: linear-gradient(to bottom,#8bbcf1 0%,#2d8cf0 100%);
border-color:#8bbcf1;
}
}
}
.login-tip{
}
font-size: 10px;
&-header{
text-align: center;
font-size: 16px;
color: #5f4949;
font-weight: 300;
text-align: center;
padding: 30px 0;
}
.form-con{
padding: 10px 0 0;
>i-button{
width: 170px;
height: 40px;
}
}
}
}
.login-tip{
font-size: 10px;
text-align: center;
color: red;
}
}
}
}
.login_btn{
width: 175px;
height: 32px;
font-size: 14px;
font-family: MicrosoftYaHei;
}
.login_register {
width: 175px;
height: 32px;
font-size: 14px;
font-family: MicrosoftYaHei;
float: right;
}
.form_tipinfo {
font-family: MicrosoftYaHei-Bold;
font-size: 14px;
font-weight: bold;
font-stretch: normal;
line-height: 24px;
letter-spacing: 0px;
color: #666666;
}
form_tipinfo_more {
font-family: MicrosoftYaHei;
font-size: 14px;
font-weight: normal;
letter-spacing: 0px;
color: #666666;
}
.log_footer {
display: block;
padding: 0 16px;
margin: 48px 0 24px;
text-align: center;
color: #212529;
}
.log_footer a {
color: white;
text-decoration: none;
}
.sign-btn {
display: inline-block;
cursor: pointer;
margin-left: 10px;
}
.wx-svg-container,
.qq-svg-container {
display: inline-block;
width: 40px;
height: 40px;
line-height: 40px;
text-align: center;
padding-top: 1px;
border-radius: 4px;
margin-bottom: -20px;
margin-top: 10px;
}
}
\ No newline at end of file
app_web/src/components/login/login.vue
浏览文件 @
b6d92296
此差异已折叠。
点击以展开。
app_web/src/components/login/register.less
0 → 100644
浏览文件 @
b6d92296
.login{
display: -webkit-box;
display: -ms-flexbox;
display: flex;
-webkit-box-orient: vertical;
-webkit-box-direction: normal;
-ms-flex-direction: column;
flex-direction: column;
min-height: 100%;
background: #108cee;
> img{
width: 100vw;
height: 100vh;
}
&-con{
position: absolute;
left: 0;
right: 0;
top: 150px;
margin: auto;
width: 400px;
.ivu-card-head {
padding: 14px 6px;
>p{
line-height: 20px;
font-size: 14px;
color: #17233d;
font-weight: 700;
}
}
&-header{
font-size: 16px;
font-weight: 300;
text-align: center;
padding: 30px 0;
}
.form-con{
padding: 10px 0 0;
>i-button{
width: 170px;
height: 40px;
}
}
.login-tip{
font-size: 10px;
text-align: center;
color: red;
}
}
}
.goLogin{
float: right;
font-size:12px;
margin-right: 14px;
text-decoration: underline;
}
.login_btn{
width: 175px;
height: 32px;
font-size: 14px;
font-family: MicrosoftYaHei;
}
.login_register {
width: 175px;
height: 32px;
font-size: 14px;
font-family: MicrosoftYaHei;
float: right;
}
.disabled{
background-color: #ddd;
border-color: #ddd;
color:#57a3f3;
cursor: not-allowed; // 鼠标变化
}
.form_tipinfo {
font-family: MicrosoftYaHei-Bold;
font-size: 14px;
font-weight: bold;
font-stretch: normal;
line-height: 24px;
letter-spacing: 0px;
color: #666666;
}
form_tipinfo_more {
font-family: MicrosoftYaHei;
font-size: 14px;
font-weight: normal;
letter-spacing: 0px;
color: #666666;
}
.log_footer {
display: block;
padding: 0 16px;
margin: 48px 0 24px;
text-align: center;
color: #212529;
}
.log_footer a {
color: white;
text-decoration: none;
}
\ No newline at end of file
app_web/src/components/login/register.vue
0 → 100644
浏览文件 @
b6d92296
<
template
>
<div
class=
'login'
>
<img
src=
"/assets/img/background.png"
/>
<div
class=
'login-con'
>
<card
:bordered=
"false"
>
<p
slot=
'title'
>
<a
@
click=
"goLogin"
class=
"goLogin"
>
返回登录
</a>
</p>
<div
class=
'form-con'
>
<i-form
ref=
'loginForm'
:rules=
"rules"
:model=
"form"
>
<form-item
prop=
'loginname'
>
<i-input
prefix=
'ios-contact'
v-model
.
trim=
"form.loginname"
@
keyup=
"toTrim"
placeholder=
"用户名"
>
</i-input>
</form-item>
<form-item
prop=
'personname'
>
<i-input
prefix=
'ios-person'
v-model
.
trim=
"form.personname"
placeholder=
"用户姓名"
>
</i-input>
</form-item>
<form-item
prop=
'password'
>
<i-input
prefix=
'ios-key'
v-model
.
trim=
"form.password"
type=
'password'
placeholder=
"密码"
>
</i-input>
</form-item>
<form-item
prop=
'confrimpassword'
>
<i-input
prefix=
'ios-checkbox'
v-model
.
trim=
"form.confrimpassword"
type=
'password'
placeholder=
"确认密码"
>
</i-input>
</form-item>
<form-item>
<i-button
@
click=
"handleRegister"
type=
'success'
:class=
"
{disabled: !this.canClick}"
long>
{{
this
.
confirmRegBtnContent
}}
</i-button>
</form-item>
</i-form>
</div>
</card>
<div
class=
"log_footer"
>
<div
class=
"copyright"
>
Copyright © 2018
<a
href=
"http://www.ibizsys.net/ibizsys/channelview?channelId=ibizsys.about"
target=
"_blank"
>
埃毕致(上海)云计算科技
</a>
版权所有
</div>
</div>
</div>
</div>
</
template
>
<
script
lang=
"ts"
>
import
{
Vue
,
Component
,
Watch
}
from
'vue-property-decorator'
;
import
{
Environment
}
from
'@/environments/environment'
;
@
Component
({})
export
default
class
Register
extends
Vue
{
/**
* 表单对象
*
* @type {*}
* @memberof Register
*/
public
form
:
any
=
{
loginname
:
''
,
personname
:
''
,
password
:
''
,
confrimpassword
:
''
};
/**
* 按钮可点击
*/
public
canClick
:
any
=
true
;
/**
* 确定注册按钮内容
*/
public
confirmRegBtnContent
:
any
=
"确定注册"
;
/**
* 应用名称
*
* @type {string}
* @memberof Register
*/
public
appTitle
:
string
=
Environment
.
AppTitle
;
/**
* 值规则
*
* @type {*}
* @memberof Register
*/
public
rules
=
{};
/**
* 设置值规则
*
* @memberof Register
*/
public
setRules
()
{
this
.
rules
=
{
loginname
:
[
{
required
:
true
,
message
:
this
.
$t
(
'components.login.loginname.message'
),
trigger
:
'change'
},
],
personname
:
[
{
required
:
true
,
message
:
'用户姓名不能为空'
,
trigger
:
'change'
},
],
password
:
[
{
required
:
true
,
message
:
this
.
$t
(
'components.login.password.message'
),
trigger
:
'change'
},
],
confrimpassword
:
[
{
validator
:
(
rule
:
any
,
value
:
any
,
callback
:
any
)
=>
{
if
(
value
===
''
&&
this
.
form
.
password
!==
''
)
{
callback
(
new
Error
(
'确认密码不能为空'
))
}
else
if
(
value
!==
this
.
form
.
password
)
{
callback
(
new
Error
(
'两次输入密码不一致'
))
}
else
{
callback
()
}
},
trigger
:
'change'
}
],
}
};
/**
* 生命周期Create
*
* @memberof Register
*/
public
created
()
{
this
.
setRules
();
}
/**
* 监听语言变化
*
* @memberof Login
*/
@
Watch
(
'$i18n.locale'
)
onLocaleChange
(
newval
:
any
,
val
:
any
)
{
this
.
setRules
();
}
/**
* 跳转登录页面
*
* @memberof Register
*/
public
goLogin
():
void
{
const
_this
=
this
;
_this
.
$router
.
push
(
'/login'
);
}
/**
* 去掉输入框中的空格
*
* @memberof Login
*/
public
toTrim
():
void
{
let
_this
=
this
;
_this
.
form
.
loginname
=
_this
.
form
.
loginname
.
replace
(
/
\s
+/g
,
" "
);
}
/**
* 注册处理
*/
public
handleRegister
():
void
{
const
form
:
any
=
this
.
$refs
.
loginForm
;
let
validatestate
:
boolean
=
true
;
form
.
validate
((
valid
:
boolean
)
=>
{
validatestate
=
valid
?
true
:
false
;
});
if
(
!
validatestate
)
{
return
;
}
this
.
form
.
registerType
=
"commom"
;
const
post
:
Promise
<
any
>
=
this
.
$http
.
post
(
'/uaa/register'
,
this
.
form
,
true
);
post
.
then
((
response
:
any
)
=>
{
if
(
response
&&
response
.
status
===
200
)
{
const
data
=
response
.
data
;
if
(
data
&&
data
.
ibzuser
)
{
this
.
$Message
.
success
({
content
:
"注册成功,用户名:"
+
data
.
ibzuser
.
loginname
+
",密码:"
+
data
.
ibzuser
.
password
,
duration
:
5
,
closable
:
true
});
}
else
{
this
.
$Message
.
success
({
content
:
"注册成功"
,
duration
:
5
,
closable
:
true
});
}
// 5s后跳转到登录页
this
.
countDown
(
5
);
}
}).
catch
((
e
:
any
)
=>
{
const
data
=
e
.
data
;
if
(
data
&&
data
.
message
)
{
this
.
$Message
.
error
({
content
:
"注册失败,"
+
data
.
message
,
duration
:
5
,
closable
:
true
});
}
else
{
this
.
$Message
.
error
({
content
:
"注册失败"
,
duration
:
5
,
closable
:
true
});
}
});
}
/**
* 跳转登录页倒计时
*/
public
countDown
(
totalTime
:
any
):
void
{
if
(
!
this
.
canClick
)
return
;
this
.
canClick
=
false
;
this
.
confirmRegBtnContent
=
totalTime
+
's后跳转到登录页'
;
// 设置定时器
let
clock
=
window
.
setInterval
(()
=>
{
// 秒数-1
totalTime
--
;
this
.
confirmRegBtnContent
=
totalTime
+
's后跳转到登录页'
;
if
(
totalTime
<
0
)
{
// 清除定时器
window
.
clearInterval
(
clock
);
// 跳转到登录页
this
.
$router
.
push
(
"/login"
);
}
},
1000
)
}
}
</
script
>
<
style
lang=
'less'
>
@import './register.less';
</
style
>
\ No newline at end of file
app_web/src/router/index.ts
浏览文件 @
b6d92296
//用户自定义全局路由
//用户自定义全局路由
export
const
globalRoutes
:
Array
<
any
>
=
[
export
const
globalRoutes
:
Array
<
any
>
=
[
{
path
:
'/register'
,
component
:
()
=>
import
(
'@components/login/register.vue'
)
}
];
];
//用户自定义首页路由
//用户自定义首页路由
export
const
indexRoutes
:
Array
<
any
>
=
[
export
const
indexRoutes
:
Array
<
any
>
=
[
...
...
ibzuaa-app/ibzuaa-app-web/src/main/java/cn/ibizlab/web/config/webSecurityConfig.java
浏览文件 @
b6d92296
...
@@ -7,10 +7,10 @@ import org.springframework.beans.factory.annotation.Autowired;
...
@@ -7,10 +7,10 @@ import org.springframework.beans.factory.annotation.Autowired;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.beans.factory.annotation.Value
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Bean
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Configuration
;
import
org.springframework.context.annotation.Profile
;
import
org.springframework.http.HttpMethod
;
import
org.springframework.http.HttpMethod
;
import
org.springframework.security.authentication.AuthenticationManager
;
import
org.springframework.security.authentication.AuthenticationManager
;
import
org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder
;
import
org.springframework.security.config.annotation.authentication.builders.AuthenticationManagerBuilder
;
import
org.springframework.security.config.annotation.method.configuration.EnableGlobalMethodSecurity
;
import
org.springframework.security.config.annotation.web.builders.HttpSecurity
;
import
org.springframework.security.config.annotation.web.builders.HttpSecurity
;
import
org.springframework.security.config.annotation.web.configuration.EnableWebSecurity
;
import
org.springframework.security.config.annotation.web.configuration.EnableWebSecurity
;
import
org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter
;
import
org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter
;
...
@@ -19,8 +19,6 @@ import org.springframework.security.config.http.SessionCreationPolicy;
...
@@ -19,8 +19,6 @@ import org.springframework.security.config.http.SessionCreationPolicy;
import
org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder
;
import
org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder
;
import
org.springframework.security.crypto.password.PasswordEncoder
;
import
org.springframework.security.crypto.password.PasswordEncoder
;
import
org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter
;
import
org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter
;
import
org.springframework.context.annotation.Profile
;
import
org.springframework.beans.factory.annotation.Qualifier
;
@Profile
(
"web-prod"
)
@Profile
(
"web-prod"
)
@Configuration
@Configuration
...
@@ -118,6 +116,7 @@ public class webSecurityConfig extends WebSecurityConfigurerAdapter {
...
@@ -118,6 +116,7 @@ public class webSecurityConfig extends WebSecurityConfigurerAdapter {
.
antMatchers
(
"/"
+
previewpath
+
"/**"
).
permitAll
()
.
antMatchers
(
"/"
+
previewpath
+
"/**"
).
permitAll
()
.
antMatchers
(
"/syspssystems/**/permissiondata"
).
permitAll
()
.
antMatchers
(
"/syspssystems/**/permissiondata"
).
permitAll
()
.
antMatchers
(
"/uaa/login"
).
permitAll
()
.
antMatchers
(
"/uaa/login"
).
permitAll
()
.
antMatchers
(
"/uaa/register"
).
permitAll
()
// 所有请求都需要认证
// 所有请求都需要认证
.
anyRequest
().
authenticated
()
.
anyRequest
().
authenticated
()
// 防止iframe 造成跨域
// 防止iframe 造成跨域
...
...
ibzuaa-boot/src/main/java/cn/ibizlab/config/DevBootSecurityConfig.java
浏览文件 @
b6d92296
...
@@ -105,6 +105,7 @@ public class DevBootSecurityConfig extends WebSecurityConfigurerAdapter {
...
@@ -105,6 +105,7 @@ public class DevBootSecurityConfig extends WebSecurityConfigurerAdapter {
//同步系统权限资源
//同步系统权限资源
.
antMatchers
(
"/syspssystems/save"
).
permitAll
()
.
antMatchers
(
"/syspssystems/save"
).
permitAll
()
.
antMatchers
(
"/uaa/login"
).
permitAll
()
.
antMatchers
(
"/uaa/login"
).
permitAll
()
.
antMatchers
(
"/uaa/register"
).
permitAll
()
.
anyRequest
().
authenticated
()
.
anyRequest
().
authenticated
()
// 防止iframe 造成跨域
// 防止iframe 造成跨域
.
and
().
headers
().
frameOptions
().
disable
();
.
and
().
headers
().
frameOptions
().
disable
();
...
...
ibzuaa-core/src/main/java/cn/ibizlab/core/uaa/extensions/service/UserRegisterService.java
0 → 100644
浏览文件 @
b6d92296
package
cn
.
ibizlab
.
core
.
uaa
.
extensions
.
service
;
import
cn.ibizlab.util.domain.IBZUSER
;
import
cn.ibizlab.util.service.IBZUSERService
;
import
lombok.extern.slf4j.Slf4j
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.stereotype.Service
;
/**
* 实体[IBZUSER] 用户注册接口实现
*/
@Service
@Slf4j
public
class
UserRegisterService
{
@Autowired
private
IBZUSERService
ibzuserService
;
/**
* 普通注册
* @param ibzuser
* @return
*/
public
IBZUSER
commomRegister
(
IBZUSER
ibzuser
)
{
// 创建ibzuser
boolean
flag
=
ibzuserService
.
save
(
ibzuser
);
if
(!
flag
)
{
return
null
;
}
return
ibzuser
;
}
}
\ No newline at end of file
ibzuaa-provider/ibzuaa-provider-api/src/main/java/cn/ibizlab/api/rest/extensions/UserRegisterResource.java
0 → 100644
浏览文件 @
b6d92296
package
cn
.
ibizlab
.
api
.
rest
.
extensions
;
import
cn.ibizlab.core.uaa.extensions.service.UserRegisterService
;
import
cn.ibizlab.core.uaa.service.ISysPSSystemService
;
import
cn.ibizlab.util.domain.IBZUSER
;
import
cn.ibizlab.util.errors.BadRequestAlertException
;
import
com.alibaba.fastjson.JSONObject
;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.http.ResponseEntity
;
import
org.springframework.util.StringUtils
;
import
org.springframework.web.bind.annotation.PostMapping
;
import
org.springframework.web.bind.annotation.RequestBody
;
import
org.springframework.web.bind.annotation.RestController
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
java.util.UUID
;
@RestController
public
class
UserRegisterResource
{
@Autowired
private
UserRegisterService
userRegisterService
;
@Autowired
private
ISysPSSystemService
iSysPSSystemService
;
@PostMapping
(
value
=
"/uaa/register"
)
public
ResponseEntity
<
JSONObject
>
register
(
@RequestBody
JSONObject
param
)
{
JSONObject
object
=
new
JSONObject
();
// 空校验
String
loginname
=
param
.
getString
(
"loginname"
);
if
(
StringUtils
.
isEmpty
(
loginname
))
throw
new
BadRequestAlertException
(
"用户名为空"
,
"register"
,
""
);
String
personname
=
param
.
getString
(
"personname"
);
if
(
StringUtils
.
isEmpty
(
personname
))
throw
new
BadRequestAlertException
(
"用户姓名为空"
,
"register"
,
""
);
String
password
=
param
.
getString
(
"password"
);
if
(
StringUtils
.
isEmpty
(
password
))
throw
new
BadRequestAlertException
(
"密码为空"
,
"register"
,
""
);
String
registerType
=
param
.
getString
(
"registerType"
);
if
(
StringUtils
.
isEmpty
(
registerType
))
throw
new
BadRequestAlertException
(
"注册方式为空"
,
"register"
,
""
);
// 检查用户名是否已被注册
String
sql
=
"select loginname from ibzuser where loginname=#{et.loginname}"
;
Map
<
String
,
Object
>
sqlParam
=
new
HashMap
<>();
sqlParam
.
put
(
"loginname"
,
loginname
);
List
<
JSONObject
>
select
=
iSysPSSystemService
.
select
(
sql
,
sqlParam
);
if
(
select
.
size
()
>
0
)
throw
new
BadRequestAlertException
(
"该用户名已被注册"
,
"register"
,
""
);
// 注册
IBZUSER
ibzuser
=
new
IBZUSER
();
String
uuid
=
UUID
.
randomUUID
().
toString
();
ibzuser
.
setPersonname
(
personname
);
ibzuser
.
setPassword
(
password
);
ibzuser
.
setLoginname
(
loginname
);
switch
(
registerType
)
{
case
"commom"
:
// 普通注册
ibzuser
.
setUserid
(
"commom-"
+
uuid
);
userRegisterService
.
commomRegister
(
ibzuser
);
break
;
default
:
ibzuser
.
setUserid
(
"commom-"
+
uuid
);
userRegisterService
.
commomRegister
(
ibzuser
);
break
;
}
object
.
put
(
"ibzuser"
,
ibzuser
);
return
ResponseEntity
.
ok
().
body
(
object
);
}
}
编辑
预览
Markdown
格式
0%
请重试
or
添加新附件
添加附件
取消
您添加了
0
人
到此讨论。请谨慎行事。
先完成此消息的编辑!
取消
想要评论请
注册
或
登录