-
Notifications
You must be signed in to change notification settings - Fork 2.6k
极验移除文档
Exrick edited this page May 22, 2019
·
1 revision
因极验收费,推荐Vaptcha验证码或自己实现图形验证码,参考作者开发的XBoot前后端分离开发平台
找到相应登录注册控制器删除即可
xmall-front-web/src/main/java/cn/exrick/front/controller/MemberController.java
@RequestMapping(value = "/member/login",method = RequestMethod.POST)
@ApiOperation(value = "用户登录")
public Result<Member> login(@RequestBody MemberLoginRegist memberLoginRegist,
HttpServletRequest request){
Member member=loginService.userLogin(memberLoginRegist.getUserName(), memberLoginRegist.getUserPwd());
return new ResultUtil<Member>().setData(member);
}
@RequestMapping(value = "/member/register",method = RequestMethod.POST)
@ApiOperation(value = "用户注册")
public Result<Object> register(@RequestBody MemberLoginRegist memberLoginRegist,
HttpServletRequest request){
// 验证成功
int result=registerService.register(memberLoginRegist.getUserName(), memberLoginRegist.getUserPwd());
if(result==0){
return new ResultUtil<Object>().setErrorMsg("该用户名已被注册");
}else if(result==-1){
return new ResultUtil<Object>().setErrorMsg("用户名密码不能为空");
}
return new ResultUtil<Object>().setData(result);
}
xmall-manager-web/src/main/java/cn/exrick/manager/controller/UserController.java
@RequestMapping(value = "/user/login",method = RequestMethod.POST)
@ApiOperation(value = "用户登录")
@SystemControllerLog(description="登录系统")
public Result<Object> login(String username, String password,
HttpServletRequest request){
// 验证成功
Subject subject = SecurityUtils.getSubject() ;
//MD5加密
String md5Pass = DigestUtils.md5DigestAsHex(password.getBytes());
UsernamePasswordToken token = new UsernamePasswordToken(username,md5Pass);
try {
subject.login(token);
return new ResultUtil<Object>().setData(null);
}catch (Exception e){
return new ResultUtil<Object>().setErrorMsg("用户名或密码错误");
}
}
注释掉相应js即可 其他自行删除 以下仅为示例
src/page/Login/login.vue
...
<script>
login () {
this.logintxt = '登录中...'
this.rememberPass()
if (!this.ruleForm.userName || !this.ruleForm.userPwd) {
// this.ruleForm.errMsg = '账号或者密码不能为空!'
this.message('账号或者密码不能为空!')
return false
}
// var result = captcha.getValidate()
// if (!result) {
// this.message('请完成验证')
// this.logintxt = '登录'
// return false
// }
var params = {
userName: this.ruleForm.userName,
userPwd: this.ruleForm.userPwd,
challenge: result.geetest_challenge,
validate: result.geetest_validate,
seccode: result.geetest_seccode,
statusKey: this.statusKey
}
...
</script>
src/page/Login/register.vue
...
<script>
if (!this.agreement) {
this.message('您未勾选同意我们的相关注册协议!')
this.registxt = '注册'
return false
}
// var result = captcha.getValidate()
// if (!result) {
// this.message('请完成验证')
// this.registxt = '注册'
// return false
// }
...
</script>