Commit 68a10ac9 authored by tyn's avatar tyn

Merge branch 'master' of http://47.105.106.177:66/root/sup-server

parents 9f4ff485 bc3be17e
...@@ -17,33 +17,34 @@ ...@@ -17,33 +17,34 @@
<div class="title" :class="{'on': type=='yzm'}" @click="type='yzm'">验证码登录</div> <div class="title" :class="{'on': type=='yzm'}" @click="type='yzm'">验证码登录</div>
<div class="title" :class="{'on': type=='mima'}" @click="type='mima'">密码登录</div> <div class="title" :class="{'on': type=='mima'}" @click="type='mima'">密码登录</div>
</div> </div>
<!--密码登录 -->
<div class="logoncont" v-if="type=='mima'"> <div class="logoncont" v-if="type=='mima'">
<div class="inputs"> <div class="inputs">
<el-input placeholder="请输入企业名称"></el-input> <el-input placeholder="请输入账号" v-model="mimaparam.username"></el-input>
</div> </div>
<div class="inputs"> <div class="inputs">
<el-input placeholder="请输入登录密码"></el-input> <el-input placeholder="请输入登录密码" v-model="mimaparam.password"></el-input>
</div> </div>
<div class="inputs"> <div class="inputs">
<el-input width="191px" class="small" placeholder="请输入验证码"></el-input> <el-input width="191px" class="small" placeholder="请输入验证码" v-model="mimaparam.code" ></el-input>
<div class="login-code"> <div class="login-code">
<img :src="codeUrl" @click="getCode" class="login-code-img"/> <img :src="codeUrl" @click="getCode" class="login-code-img"/>
</div> </div>
</div> </div>
<div class="loginin" @click="login">登录</div> <div class="loginin" @click="login">登录</div>
<div class="loginzc"> <div class="loginzc">
<p @click="type='wjmm'">忘记密码</p> <p @click="wjmm">忘记密码</p>
<p>没加入我们?现在就 <span @click="dialogVisible = true">注册</span></p> <p>没加入我们?现在就 <span @click="dialogVisible = true">注册</span></p>
</div> </div>
</div> </div>
<!-- 验证码登录-->
<div class="logoncont" v-if="type=='yzm'"> <div class="logoncont" v-if="type=='yzm'">
<div class="inputs"> <div class="inputs">
<el-input placeholder="请输入手机号" oninput="value=value.replace(/[^0-9]/g,'')"></el-input> <el-input placeholder="请输入手机号" v-model="yzmparam.phone" oninput="value=value.replace(/[^0-9]/g,'')"></el-input>
</div> </div>
<div class="inputs"> <div class="inputs">
<el-input placeholder="短信验证码" class="hqyzm"> <el-input placeholder="短信验证码" v-model="yzmparam.smsCode" class="hqyzm">
<template slot="append">获取验证码 <template slot="append"><span @click="getSmsCode(1)">{{ timer }}</span></template>
</template>
</el-input> </el-input>
</div> </div>
<div class="loginin" @click="yzmlogin">登录</div> <div class="loginin" @click="yzmlogin">登录</div>
...@@ -51,32 +52,34 @@ ...@@ -51,32 +52,34 @@
<p>没加入我们?现在就 <span @click="dialogVisible = true">注册</span></p> <p>没加入我们?现在就 <span @click="dialogVisible = true">注册</span></p>
</div> </div>
</div> </div>
<!-- 忘记密码-->
<div class="logoncont" v-if="type=='wjmm'"> <div class="logoncont" v-if="type=='wjmm'">
<div class="inputs"> <div class="inputs">
<el-input placeholder="请输入手机号" oninput="value=value.replace(/[^0-9]/g,'')"></el-input> <el-input placeholder="请输入手机号" v-model="resetparam.phone" oninput="value=value.replace(/[^0-9]/g,'')"></el-input>
</div> </div>
<div class="inputs"> <div class="inputs">
<el-input placeholder="短信验证码" class="hqyzm"> <el-input placeholder="短信验证码" v-model="resetparam.smsCode" class="hqyzm">
<template slot="append">获取验证码</template> <template slot="append"><span @click="getSmsCode(1)">{{ timer }}</span></template>
</el-input> </el-input>
</div> </div>
<div class="inputs"> <div class="inputs">
<el-input class="small" placeholder="请输入验证码"></el-input> <el-input class="small" v-model="resetparam.code" placeholder="请输入验证码"></el-input>
<div class="login-code"> <div class="login-code">
<img :src="codeUrl" @click="getCode" class="login-code-img"/> <img :src="codeUrl" @click="getCode" class="login-code-img"/>
</div> </div>
</div> </div>
<div class="loginin" @click="type='tjmm'">下一步</div> <div class="loginin" @click="yzSmscode">下一步</div>
<div class="loginzc" style="justify-content: center"> <div class="loginzc" style="justify-content: center">
<p><span @click="type='mima'">返回登录</span></p> <p><span @click="type='mima'">返回登录</span></p>
</div> </div>
</div> </div>
<!-- 提交重置的密码-->
<div class="logoncont" v-if="type=='tjmm'"> <div class="logoncont" v-if="type=='tjmm'">
<div class="inputs"> <div class="inputs">
<el-input placeholder="请输入密码"></el-input> <el-input v-model="resetparam.passWord" placeholder="请输入密码"></el-input>
</div> </div>
<div class="inputs"> <div class="inputs">
<el-input placeholder="请再次输入密码"></el-input> <el-input v-model="resetparam.passWord1" placeholder="请再次输入密码"></el-input>
</div> </div>
<div class="loginin" @click="resetpwd">提交</div> <div class="loginin" @click="resetpwd">提交</div>
<div class="loginzc" style="justify-content: center"> <div class="loginzc" style="justify-content: center">
...@@ -327,13 +330,14 @@ ...@@ -327,13 +330,14 @@
</template> </template>
<script> <script>
import footers from '@/components/foots' import footers from '@/components/foots'
export default { export default {
components: {footers}, components: {footers},
data() { data() {
return { return {
codeUrl:'',//图形验证码 codeUrl:'',//图形验证码
uuid:'',//图形验证码唯一凭证
dialogVisible: false, dialogVisible: false,
agreeRegister: false, agreeRegister: false,
registerType: 2, registerType: 2,
...@@ -383,31 +387,31 @@ ...@@ -383,31 +387,31 @@
{ required: true, message: '请输入企业简介', trigger: 'change' } { required: true, message: '请输入企业简介', trigger: 'change' }
], ],
}, },
type:"yzm",//登录方式 密码:mima 验证码:yzm 忘记密码:wjmm 提交密码:tjmm type:"tjmm",//登录方式 密码:mima 验证码:yzm 忘记密码:wjmm 提交密码:tjmm
yzmparam:{ yzmparam:{
phone:'', phone:'',
code:'' smsCode:''
} , } ,
mimaparam:{ mimaparam:{
name:'', username:'',
pwd:'', password:'',
code:''
},
wjparam:{
name:'',
pwd:'',
code:'', code:'',
code1:'' uuid:''
}, },
resetparam:{ resetparam:{
pwd:'', phone:'',
} passWord:'',
passWord1:'',
code:'',
smsCode:''
},
timer:'获取验证码',//倒计时
}; };
}, },
computed: { computed: {
}, },
mounted() { mounted() {
// this.getCode() this.getCode()
}, },
watch:{ watch:{
type(val){ type(val){
...@@ -419,17 +423,135 @@ ...@@ -419,17 +423,135 @@
cleardata(){ cleardata(){
}, },
//登录 //登录 /login
login(){}, login(){
//验证码登录 this.mimaparam.uuid = this.uuid
yzmlogin(){}, if(!(this.mimaparam.username || this.mimaparam.code || this.mimaparam.code)){
this.$message.error('账号、密码、验证码不能为空!');
return false;
}
login(this.mimaparam).then(res=>{
if(res.code == 200){
this.toList()
}else{
this.$message.error(res.msg);
}
})
},
//验证码登录 /smsLogin
yzmlogin(){
if(!(this.yzmparam.phone || this.yzmparam.smsCode)){
this.$message.error('账号、验证码不能为空!');
return false;
}
smsLogin(this.yzmparam).then(res=>{
if(res.code == 200){
this.toList()
}else{
this.$message.error(res.msg);
}
})
},
//验证短信验证码、图形验证码
yzSmscode(){
let param = {
phone:this.resetparam.phone,
code:this.resetparam.smsCode
}
//校验短信验证码 /sms/validateSmsCode
validateSmsCode(param).then(res=>{
if (res.code == 200){
let params = {
uuid:this.uuid,
code:this.resetparam.code
}
//校验图形验证码 /validateCaptcha
validateCaptcha(params).then(res=>{
if(res.code == 200){
this.type='tjmm'
}else{
this.$message.error(res.msg);
}
})
}else{
this.$message.error(res.msg);
}
})
},
//重置密码 //重置密码
resetpwd(){}, resetpwd(){
//获取验证码 let pwd = this.resetparam.passWord
let pwd1 = this.resetparam.passWord1
if(pwd!=pwd1){
this.$message.error('两次输入密码不一致');
}else{
//重置 /forgotPassword
let param = {phone:this.resetparam.phone,passWord:this.resetparam.passWord}
forgotPassword(param).then(res=>{
if(res.code == 200){
this.type = 'mima'
this.getCode()
}else{
this.$message.error(res.msg);
}
})
}
},
//获取验图形证码
getCode(){ getCode(){
this.getYZMimage().then(res=>{ this.getYZMimage().then(res=>{
this.codeUrl = res.data.imag this.codeUrl = res.data.imag
this.uuid = res.data.uuid
}) })
},
//获取手机验证码
getSmsCode(type){
if(type == 1){//短信登录
if(this.yzmparam.phone)
this.yzPohne(this.yzmparam.phone)
else
this.$message({
message: '请输入手机号!',
type: 'warning'
});
}
},
// 验证手机号发送验证码 /sms/sendRegisterCode
yzPohne(phone){
var param = {
phone:phone,
type:1 //0:注册,1:短信登录/忘记密码
}
//验证账户发送短信 /checkUser
checkUser(param).then(res=>{
if(res.code == 200){
this.getTimer()
}else{
this.$message.error(res.msg);
}
})
},
getTimer(){//倒计时
let num = 60
var timers = setInterval(()=>{
if(num>0){
num--;
this.timer = num+'s重新发送'
}else{
clearInterval(timers)
this.timer = '发送验证码'
timers = null
}
},1000)
},
wjmm(){
this.type='wjmm'
this.getCode()
},
//登录成功跳转
toList(){
}, },
handleAvatarSuccess(res, file) { handleAvatarSuccess(res, file) {
console.log("上传成功") console.log("上传成功")
...@@ -457,11 +579,11 @@ ...@@ -457,11 +579,11 @@
return isJPG && isLt2M; return isJPG && isLt2M;
} }
} }
} }
</script> </script>
<style scoped lang="scss"> <style scoped lang="scss">
.main { .main {
position: relative; position: relative;
height: 100%; height: 100%;
width: 100%; width: 100%;
...@@ -651,9 +773,9 @@ ...@@ -651,9 +773,9 @@
left: 169px; left: 169px;
} }
} }
} }
/*注册样式*/ /*注册样式*/
::v-deep .el-dialog.registration { ::v-deep .el-dialog.registration {
height: calc(100% - 132px); height: calc(100% - 132px);
overflow-y: auto; overflow-y: auto;
overflow-x: hidden; overflow-x: hidden;
...@@ -922,8 +1044,8 @@ ...@@ -922,8 +1044,8 @@
} }
} }
} }
} }
::v-deep .el-dialog.registration-policy { ::v-deep .el-dialog.registration-policy {
.el-dialog__body { .el-dialog__body {
height: 567px; height: 567px;
overflow-y: auto; overflow-y: auto;
...@@ -939,5 +1061,5 @@ ...@@ -939,5 +1061,5 @@
padding: 9px 20px; padding: 9px 20px;
} }
} }
} }
</style> </style>
...@@ -12,11 +12,13 @@ import com.supServer.framework.web.domain.AjaxResult; ...@@ -12,11 +12,13 @@ import com.supServer.framework.web.domain.AjaxResult;
import com.supServer.project.entity.UserInfo; import com.supServer.project.entity.UserInfo;
import com.supServer.project.entity.vo.ForgotPasswordVo; import com.supServer.project.entity.vo.ForgotPasswordVo;
import com.supServer.project.entity.vo.UserResetPwdVo; import com.supServer.project.entity.vo.UserResetPwdVo;
import com.supServer.project.mapper.UserInfoMapper;
import com.supServer.project.service.SmsService; import com.supServer.project.service.SmsService;
import com.supServer.project.service.UserInfoService; import com.supServer.project.service.UserInfoService;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.crypto.bcrypt.BCrypt;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
...@@ -63,6 +65,10 @@ public class UserController { ...@@ -63,6 +65,10 @@ public class UserController {
if(userInfo.getAccountStatus().equals("3")){ if(userInfo.getAccountStatus().equals("3")){
return AjaxResult.error("当前账号已注销"); return AjaxResult.error("当前账号已注销");
} }
String oldPassword = BCrypt.hashpw(loginBody.getPassword(), userInfo.getPassword());
if (!oldPassword.equals(userInfo.getPassword())) {
return AjaxResult.error("密码错误");
}
//AesUtil.decode(loginBody.getUserName()),AesUtil.decode(loginBody.getPassword()),loginBody.getCode(),loginBody.getUuid(),loginBody.getType() //AesUtil.decode(loginBody.getUserName()),AesUtil.decode(loginBody.getPassword()),loginBody.getCode(),loginBody.getUuid(),loginBody.getType()
String token = userLoginService.login(loginBody.getUserName(),loginBody.getPassword(),loginBody.getCode(),loginBody.getUuid()); String token = userLoginService.login(loginBody.getUserName(),loginBody.getPassword(),loginBody.getCode(),loginBody.getUuid());
AjaxResult ajax = AjaxResult.success(); AjaxResult ajax = AjaxResult.success();
......
...@@ -112,7 +112,7 @@ public class UserInfoServiceImpl implements UserInfoService { ...@@ -112,7 +112,7 @@ public class UserInfoServiceImpl implements UserInfoService {
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest()); LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
UserInfo userInfoToken = loginUser.getUser(); UserInfo userInfoToken = loginUser.getUser();
// 查询最新的数据 // 查询最新的数据
UserInfo userInfo = userInfoMapper.selectUserByUserName(userInfoToken.getUserName()); UserInfo userInfo = userInfoMapper.selectUserByUserName(userInfoToken.getPhone());
// 原密码 // 原密码
String oldPassword = BCrypt.hashpw(userInfoVo.getOldPassword(), userInfo.getPassword()); String oldPassword = BCrypt.hashpw(userInfoVo.getOldPassword(), userInfo.getPassword());
if (!oldPassword.equals(userInfo.getPassword())) { if (!oldPassword.equals(userInfo.getPassword())) {
......
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