| | |
| | | import org.apache.shiro.crypto.hash.SimpleHash; |
| | | import org.apache.shiro.util.ByteSource; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.web.bind.annotation.GetMapping; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestBody; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import java.util.HashMap; |
| | | |
| | | @RestController |
| | | |
| | | @Slf4j |
| | | @Api(tags = "登录和注册") |
| | | public class DefaultController { |
| | |
| | | } |
| | | |
| | | @ApiOperation(value = "登录") |
| | | @CrossOrigin(origins = "http://localhost:8080", allowCredentials = "true") |
| | | @PostMapping("/login") |
| | | public Result login(@RequestBody UserVo userVO) { |
| | | ValidatorUtil.validateEntity(userVO); |
| | |
| | | } catch (DisabledAccountException e) { |
| | | return Result.fail("帐号已被禁用"); |
| | | } catch (ExpiredCredentialsException e) { |
| | | return Result.fail("帐号已过期"); |
| | | return Result.fail("请重新登录"); |
| | | |
| | | } catch (UnknownAccountException e) { |
| | | return Result.fail("帐号不存在"); |
| | | } catch (UnauthorizedException e) { |