wzy
2020-05-20 8118b1f532510dd1c1dfb00f62ad851c9dc9d440
src/main/java/com/xcong/excoin/common/system/controller/LoginController.java
@@ -1,5 +1,6 @@
package com.xcong.excoin.common.system.controller;
import cn.hutool.core.codec.Base64;
import cn.hutool.core.util.IdUtil;
import cn.hutool.crypto.SecureUtil;
import cn.hutool.crypto.asymmetric.KeyType;
@@ -60,12 +61,8 @@
    @ApiOperation(value = "登陆接口", notes = "登陆接口")
    @PostMapping("/login")
    public Result login(@RequestBody @Validated LoginDto loginDto) {
        // 使用md5加密前端传来的密码
        Sign sign = SecureUtil.sign(SignAlgorithm.MD5withRSA);
        byte[] pwdByte = sign.sign(loginDto.getPassword().getBytes());
        // 将账号密码交给spring security验证,并调用userServiceDetails
        UsernamePasswordAuthenticationToken authToken = new UsernamePasswordAuthenticationToken(loginDto.getUsername(), loginDto.getPassword());
        UsernamePasswordAuthenticationToken authToken = new UsernamePasswordAuthenticationToken(loginDto.getUsername(), SecureUtil.md5(loginDto.getPassword()));
        Authentication authentication = authenticationManagerBuilder.getObject().authenticate(authToken);
        // 获取当前验证过后的用户
@@ -95,7 +92,7 @@
    @ApiOperation(value = "app注册接口", notes = "app注册接口,验证码必须输入可默认为123456")
    @PostMapping(value = "/register")
    public Result register(@RequestBody @Validated RegisterDto registerDto) {
        return null;
        return memberservice.register(registerDto);
    }
}