| 123456789101112131415161718192021222324252627282930 |
- package com.izouma.awesomeAdmin.web;
- import com.izouma.awesomeAdmin.dto.Captcha;
- import com.izouma.awesomeAdmin.service.CaptchaService;
- import lombok.AllArgsConstructor;
- import org.springframework.web.bind.annotation.GetMapping;
- import org.springframework.web.bind.annotation.RequestMapping;
- import org.springframework.web.bind.annotation.RequestParam;
- import org.springframework.web.bind.annotation.RestController;
- import java.awt.*;
- import java.io.IOException;
- @RestController
- @RequestMapping("/captcha")
- @AllArgsConstructor
- public class CaptchaController {
- private final CaptchaService captchaService;
- @GetMapping("/get")
- public Captcha get() throws IOException, FontFormatException {
- return captchaService.gen();
- }
- @GetMapping("/verify")
- public boolean verify(@RequestParam String key, @RequestParam String code) {
- return captchaService.verify(key, code);
- }
- }
|