diff --git a/hoj-springboot/DataBackup/pom.xml b/hoj-springboot/DataBackup/pom.xml index a132e6b8..0f746df1 100644 --- a/hoj-springboot/DataBackup/pom.xml +++ b/hoj-springboot/DataBackup/pom.xml @@ -128,6 +128,17 @@ org.springframework.boot spring-boot-devtools + + + org.springframework.boot + spring-boot-starter-thymeleaf + + + + com.github.whvcse + easy-captcha + 1.6.2 + org.springframework.boot diff --git a/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/controller/oj/AccountController.java b/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/controller/oj/AccountController.java index 08dd2e82..a6308223 100644 --- a/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/controller/oj/AccountController.java +++ b/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/controller/oj/AccountController.java @@ -95,7 +95,7 @@ public class AccountController { return CommonResult.errorResponse("对不起!该邮箱已被注册,请更换新的邮箱!"); } String numbers = RandomUtil.randomNumbers(6); // 随机生成6位数字的组合 - redisUtils.set(email, numbers, 5 * 60);//默认验证码有效5分钟 + redisUtils.set(Constants.Email.REGISTER_KEY_PREFIX.getValue()+email, numbers, 5 * 60);//默认验证码有效5分钟 emailService.sendCode(email, numbers); return CommonResult.successResponse(MapUtil.builder() .put("email", email) @@ -153,20 +153,26 @@ public class AccountController { * @Since 2020/11/6 */ @PostMapping("/apply-reset-password") - public CommonResult applyResetPassword(@RequestBody Map data) throws MessagingException { + public CommonResult applyResetPassword(@RequestBody Map data) { + String captcha = (String) data.get("captcha"); + String captchaKey = (String) data.get("captchaKey"); String email = (String) data.get("email"); - String username = (String) data.get("username"); - if (StringUtils.isEmpty(email) || StringUtils.isEmpty(username)) { - return CommonResult.errorResponse("用户名或邮箱不能为空"); + if (StringUtils.isEmpty(captcha) || StringUtils.isEmpty(email) || StringUtils.isEmpty(captchaKey)) { + return CommonResult.errorResponse("邮箱或验证码不能为空"); } - QueryWrapper wrapper = new QueryWrapper().eq("email", email).eq("username", username); - UserInfo user = userInfoDao.getOne(wrapper); - if (user == null) { - return CommonResult.errorResponse("用户名和该邮箱不匹配"); + // 获取redis中的验证码 + String redisCode = (String) redisUtils.get(captchaKey); + // 判断验证码 + if (!redisCode.equals(captcha.trim().toLowerCase())) { + return CommonResult.errorResponse("验证码不正确"); } + QueryWrapper userInfoQueryWrapper = new QueryWrapper<>(); + userInfoQueryWrapper.eq("email", email.trim()); + UserInfo userInfo = userInfoDao.getOne(userInfoQueryWrapper); String code = IdUtil.simpleUUID().substring(0, 21); // 随机生成20位数字与字母的组合 - redisUtils.set(username, code, 10 * 60);//默认链接有效10分钟 - emailService.sendResetPassword(username, code, email); + redisUtils.set(Constants.Email.RESET_PASSWORD_KEY_PREFIX.getValue()+userInfo.getUsername(), code, 10 * 60);//默认链接有效10分钟 + // 发送邮件 + emailService.sendResetPassword(userInfo.getUsername(), code, email.trim()); return CommonResult.successResponse(null, "重置密码邮件已发送至指定邮箱,请稍稍等待一会。"); } @@ -187,10 +193,12 @@ public class AccountController { if (StringUtils.isEmpty(password) || StringUtils.isEmpty(username) || StringUtils.isEmpty(code)) { return CommonResult.errorResponse("用户名,新密码或验证码不能为空"); } - if (!redisUtils.hasKey(username)) { + String codeKey = Constants.Email.RESET_PASSWORD_KEY_PREFIX.getValue()+username; + + if (!redisUtils.hasKey(codeKey)) { return CommonResult.errorResponse("重置密码链接不存在或已过期,请重新发送重置邮件"); } - if (!redisUtils.get(username).equals(code)) { //验证码判断 + if (!redisUtils.get(codeKey).equals(code)) { //验证码判断 return CommonResult.errorResponse("重置密码的链接验证码不正确,请重新发送重置邮件"); } @@ -218,11 +226,11 @@ public class AccountController { if (!configVo.getRegister()) { // 需要判断一下网站是否开启注册 return CommonResult.errorResponse("对不起!本站暂未开启注册功能!", CommonResult.STATUS_ACCESS_DENIED); } - - if (!redisUtils.hasKey(registerDto.getEmail())) { + String codeKey = Constants.Email.REGISTER_KEY_PREFIX.getValue()+registerDto.getEmail(); + if (!redisUtils.hasKey(codeKey)) { return CommonResult.errorResponse("验证码不存在或已过期"); } - if (!redisUtils.get(registerDto.getEmail()).equals(registerDto.getCode())) { //验证码判断 + if (!redisUtils.get(codeKey).equals(registerDto.getCode())) { //验证码判断 return CommonResult.errorResponse("验证码不正确"); } String uuid = IdUtil.simpleUUID(); diff --git a/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/controller/oj/CommonController.java b/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/controller/oj/CommonController.java index 29bd8224..5379f83b 100644 --- a/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/controller/oj/CommonController.java +++ b/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/controller/oj/CommonController.java @@ -1,6 +1,10 @@ package top.hcode.hoj.controller.oj; +import cn.hutool.core.map.MapUtil; +import cn.hutool.core.util.IdUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.wf.captcha.SpecCaptcha; +import com.wf.captcha.base.Captcha; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; @@ -9,6 +13,7 @@ import org.springframework.web.bind.annotation.RestController; import top.hcode.hoj.common.result.CommonResult; import top.hcode.hoj.pojo.entity.*; import top.hcode.hoj.service.impl.*; +import top.hcode.hoj.utils.RedisUtils; import javax.validation.Valid; import java.util.HashMap; @@ -19,7 +24,7 @@ import java.util.stream.Collectors; /** * @Author: Himit_ZH * @Date: 2020/12/12 23:25 - * @Description: + * @Description: 通用的请求控制处理类 */ @RestController @RequestMapping("/api") @@ -37,52 +42,69 @@ public class CommonController { @Autowired private ProblemLanguageServiceImpl problemLanguageService; + @Autowired + private RedisUtils redisUtil; + + + + @GetMapping("/captcha") + public CommonResult getCaptcha() { + SpecCaptcha specCaptcha = new SpecCaptcha(90, 30, 4); + specCaptcha.setCharType(Captcha.TYPE_DEFAULT); + String verCode = specCaptcha.text().toLowerCase(); + String key = IdUtil.simpleUUID(); + // 存入redis并设置过期时间为30分钟 + redisUtil.set(key, verCode, 1800); + // 将key和base64返回给前端 + return CommonResult.successResponse(MapUtil.builder().put("img", specCaptcha.toBase64()) + .put("captchaKey", key).map(), "获取成功"); + } + @GetMapping("/get-all-problem-tags") - public CommonResult getAllProblemTagsList(){ + public CommonResult getAllProblemTagsList() { List list = tagService.list(); - if (list!=null){ - return CommonResult.successResponse(list,"获取题目标签列表成功!"); - }else{ + if (list != null) { + return CommonResult.successResponse(list, "获取题目标签列表成功!"); + } else { return CommonResult.errorResponse("获取题目标签列表失败!"); } } @GetMapping("/get-problem-tags") - public CommonResult getProblemTags(@Valid @RequestParam("pid") Long pid){ + public CommonResult getProblemTags(@Valid @RequestParam("pid") Long pid) { Map map = new HashMap<>(); map.put("pid", pid); List tidList = problemTagService.listByMap(map).stream().map(ProblemTag::getTid).collect(Collectors.toList()); List tags = (List) tagService.listByIds(tidList); - if (tags!=null){ - return CommonResult.successResponse(tags,"获取该题目的标签列表成功!"); - }else{ + if (tags != null) { + return CommonResult.successResponse(tags, "获取该题目的标签列表成功!"); + } else { return CommonResult.errorResponse("获取该题目的标签列表失败!"); } } - @GetMapping("/languages") - public CommonResult getLanguages(){ + public CommonResult getLanguages() { List list = languageService.list(); - if (list!=null){ - return CommonResult.successResponse(list,"获取编程语言列表成功!"); - }else{ + if (list != null) { + return CommonResult.successResponse(list, "获取编程语言列表成功!"); + } else { return CommonResult.errorResponse("获取编程语言列表失败!"); } } @GetMapping("/get-Problem-languages") - public CommonResult getProblemLanguages(@Valid @RequestParam("pid") Long pid){ + public CommonResult getProblemLanguages(@Valid @RequestParam("pid") Long pid) { QueryWrapper queryWrapper = new QueryWrapper<>(); queryWrapper.eq("pid", pid).select("lid"); List idList = problemLanguageService.list(queryWrapper) .stream().map(ProblemLanguage::getLid).collect(Collectors.toList()); List languages = (List) languageService.listByIds(idList); - if (languages!=null){ - return CommonResult.successResponse(languages,"获取该题目的编程语言列表成功!"); - }else{ + if (languages != null) { + return CommonResult.successResponse(languages, "获取该题目的编程语言列表成功!"); + } else { return CommonResult.errorResponse("获取该题目的编程语言列表失败!"); } } diff --git a/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/service/EmailService.java b/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/service/EmailService.java index de0dfdb2..94faf03f 100644 --- a/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/service/EmailService.java +++ b/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/service/EmailService.java @@ -1,9 +1,8 @@ package top.hcode.hoj.service; -import javax.mail.MessagingException; public interface EmailService { - public void sendCode(String email,String code) throws MessagingException; - public void sendResetPassword(String username,String code,String email) throws MessagingException; - public void testEmail(String email) throws MessagingException; + public void sendCode(String email,String code); + public void sendResetPassword(String username,String code,String email); + public void testEmail(String email) ; } diff --git a/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/service/impl/EmailServiceImpl.java b/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/service/impl/EmailServiceImpl.java index 771826fd..7333fa3f 100644 --- a/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/service/impl/EmailServiceImpl.java +++ b/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/service/impl/EmailServiceImpl.java @@ -2,13 +2,17 @@ package top.hcode.hoj.service.impl; import cn.hutool.core.date.DateTime; import cn.hutool.core.date.DateUtil; +import lombok.extern.slf4j.Slf4j; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.context.annotation.EnableAspectJAutoProxy; import org.springframework.mail.javamail.JavaMailSender; import org.springframework.mail.javamail.MimeMessageHelper; import org.springframework.scheduling.annotation.Async; import org.springframework.stereotype.Service; +import org.thymeleaf.TemplateEngine; +import org.thymeleaf.context.Context; import top.hcode.hoj.service.EmailService; +import top.hcode.hoj.utils.Constants; import javax.mail.MessagingException; import javax.mail.internet.MimeMessage; @@ -18,234 +22,135 @@ import java.util.Date; /** * @Author: Himit_ZH * @Date: 2020/10/24 13:21 - * @Description: + * @Description: 异步发送邮件的任务 */ @Service @Async +@Slf4j public class EmailServiceImpl implements EmailService { @Autowired - JavaMailSender mailSender; + private JavaMailSender mailSender; + @Autowired + private TemplateEngine templateEngine; + + /** + * @param email 用户邮箱 + * @param code 生成的六位随机数字验证码 + * @MethodName sendCode + * @Description 为正在注册的用户发送一份注册验证码。 + * @Return + * @Since 2021/1/14 + */ @Override - public void sendCode(String email, String code) throws MessagingException { - DateTime dateTime = DateUtil.offsetMinute(new Date(), 5); + public void sendCode(String email, String code) { + DateTime expireTime = DateUtil.offsetMinute(new Date(), 10); MimeMessage mimeMessage = mailSender.createMimeMessage(); - MimeMessageHelper mimeMessageHelper = new MimeMessageHelper(mimeMessage, - true); - mimeMessageHelper.setSubject("HOJ的注册邮件"); - mimeMessageHelper.setText("
\n" + - "\t\t\t\t
\n" + - "\t\t\t\t\t
\n" + - "\t\t\t\t\t\t\n" + - "\t\t\t\t\t
\n" + - "\t\t\t\t
\n" + - "\t\t\t\t
\n" + - "\t\t\t\t\t

\n" + - "\t\t\t\t\t\tDear New HOJer\n" + - "\t\t\t\t\t

\n" + - "\t\t\t\t\t
\n" + - "\t\t\t\t\t
\n" + - "\t\t\t\t\t\t

\n" + - "\t\t\t\t\t\t\t来自 HOJ 邮件提醒\n" + - "\t\t\t\t\t\t

\n" + - "\t\t\t\t\t

\n" + - "\t\t\t\t\t\t您收到这封电子邮件是因为您 (也可能是某人冒充您的名义) 在 HOJ 上进行注册。假如这不是您本人所申请, 请不用理会这封电子邮件, 但是如果您持续收到这类的信件骚扰, 请您尽快联络管理员。\n" + - "\t\t\t\t\t

\n" + - "\t\t\t\t\t
\n" + - "\t\t\t\t\t\t请使用以下验证码完成后续注册流程:
\n" + - "\t\t\t\t\t\t "+code+"
\n" + - "\t\t\t\t\t\t 注意:请您在收到邮件5分钟内("+dateTime.toString()+"前)使用,否则该验证码将会失效。\n" + - "\t\t\t\t\t\t
\n" + - "\t\t\t\t\t   \n" + - "\n" + - "\t\t\t\t\t
\n" + - "\t\t\t\t\t
\n" + - "\t\t\t\t\t\tHOJ|传送门\uD83D\uDEAA\n" + - "\t\t\t\t\t
\n" + - "\t\t\t\t\t

\n" + - "\t\t\t\t\t\t欢迎常来访问!
\n" + - "\t\t\t\t\t\t© 2020 \n" + - "\t\t\t\t\t\t\tHODE-OJ \n" + - "\t\t\t\t\t

\n" + - "\t\t\t\t\t

\n" + - "\t\t\t\t
\n" + - "\t\t\t
",true); + try { + MimeMessageHelper mimeMessageHelper = new MimeMessageHelper(mimeMessage, + true); + // 设置渲染到html页面对应的值 + Context context = new Context(); + context.setVariable(Constants.Email.OJ_NAME.name(), Constants.Email.OJ_NAME.getValue()); + context.setVariable(Constants.Email.OJ_SHORT_NAME.name(), Constants.Email.OJ_SHORT_NAME.getValue()); + context.setVariable(Constants.Email.OJ_URL.name(), Constants.Email.OJ_URL.getValue()); + context.setVariable(Constants.Email.EMAIL_BACKGROUND_IMG.name(), Constants.Email.EMAIL_BACKGROUND_IMG.getValue()); + context.setVariable("CODE", code); + context.setVariable("EXPIRE_TIME", expireTime.toString()); - - mimeMessageHelper.setTo(email); - mimeMessageHelper.setFrom("oj.hcode@qq.com"); - mailSender.send(mimeMessage); + //利用模板引擎加载html文件进行渲染并生成对应的字符串 + String emailContent = templateEngine.process("emailTemplate_registerCode", context); + // 设置邮件标题 + mimeMessageHelper.setSubject("HOJ的注册邮件"); + mimeMessageHelper.setText(emailContent, true); + // 收件人 + mimeMessageHelper.setTo(email); + // 发送人 + mimeMessageHelper.setFrom(Constants.Email.EMAIL_FROM.getValue()); + mailSender.send(mimeMessage); + } catch (MessagingException e) { + log.error("用户注册的邮件任务发生异常------------>{}", e.getMessage()); + } } + + /** + * @param username 需要重置密码的用户名 + * @param email 用户邮箱 + * @param code 随机生成20位数字与字母的组合 + * @MethodName sendResetPassword + * @Description 给指定的邮箱的用户发送重置密码链接的邮件。 + * @Return + * @Since 2021/1/14 + */ @Override - public void sendResetPassword(String username, String code, String email) throws MessagingException { - DateTime dateTime = DateUtil.offsetMinute(new Date(), 10); + public void sendResetPassword(String username, String code, String email) { + DateTime expireTime = DateUtil.offsetMinute(new Date(), 10); MimeMessage mimeMessage = mailSender.createMimeMessage(); - MimeMessageHelper mimeMessageHelper = new MimeMessageHelper(mimeMessage, - true); - mimeMessageHelper.setSubject("HOJ的重置密码邮件"); - mimeMessageHelper.setText("
\n" + - "\t\t\t\t
\n" + - "\t\t\t\t\t
\n" + - "\t\t\t\t\t\t\n" + - "\t\t\t\t\t
\n" + - "\t\t\t\t
\n" + - "\t\t\t\t
\n" + - "\t\t\t\t\t

\n" + - "\t\t\t\t\t\tDear "+username+"\n" + - "\t\t\t\t\t

\n" + - "\t\t\t\t\t
\n" + - "\t\t\t\t\t
\n" + - "\t\t\t\t\t\t

\n" + - "\t\t\t\t\t\t\t来自 HOJ 邮件提醒\n" + - "\t\t\t\t\t\t

\n" + - "\t\t\t\t\t

\n" + - "\t\t\t\t\t\t您收到这封电子邮件是因为您 (也可能是某人冒充您的名义) 在 HOJ 上进行密码重置操作。假如这不是您本人所申请, 请不用理会这封电子邮件, 但是如果您持续收到这类的信件骚扰, 请您尽快联络管理员。\n" + - "\t\t\t\t\t

\n" + - "\t\t\t\t\t
\n" + - "\t\t\t\t\t\t请点击下面的链接完成后续重置密码的流程:
\n" + - "\t\t\t\t\t\t CLICK HERE
\n" + - "\t\t\t\t\t\t 注意:请您在收到邮件10分钟内("+dateTime.toString()+"前)使用,否则该链接将会失效。\n" + - "\t\t\t\t\t\t
\n" + - "\t\t\t\t\t   \n" + - "\n" + - "\t\t\t\t\t
\n" + - "\t\t\t\t\t
\n" + - "\t\t\t\t\t\tHOJ|传送门\uD83D\uDEAA\n" + - "\t\t\t\t\t
\n" + - "\t\t\t\t\t

\n" + - "\t\t\t\t\t\t欢迎常来访问!
\n" + - "\t\t\t\t\t\t© 2020 \n" + - "\t\t\t\t\t\t\tHODE-OJ \n" + - "\t\t\t\t\t

\n" + - "\t\t\t\t\t

\n" + - "\t\t\t\t
\n" + - "\t\t\t
",true); + try { + MimeMessageHelper mimeMessageHelper = new MimeMessageHelper(mimeMessage, + true); + // 设置渲染到html页面对应的值 + Context context = new Context(); + context.setVariable(Constants.Email.OJ_NAME.name(), Constants.Email.OJ_NAME.getValue()); + context.setVariable(Constants.Email.OJ_SHORT_NAME.name(), Constants.Email.OJ_SHORT_NAME.getValue()); + context.setVariable(Constants.Email.OJ_URL.name(), Constants.Email.OJ_URL.getValue()); + context.setVariable(Constants.Email.EMAIL_BACKGROUND_IMG.name(), Constants.Email.EMAIL_BACKGROUND_IMG.getValue()); + context.setVariable("RESET_URL", Constants.Email.OJ_URL.getValue() + "/reset-password?username=" + username + "&code=" + code); + context.setVariable("EXPIRE_TIME", expireTime.toString()); + context.setVariable("USERNAME", username); + //利用模板引擎加载html文件进行渲染并生成对应的字符串 + String emailContent = templateEngine.process("emailTemplate_resetPassword", context); - mimeMessageHelper.setTo(email); - mimeMessageHelper.setFrom("oj.hcode@qq.com"); - mailSender.send(mimeMessage); + mimeMessageHelper.setSubject("HOJ的重置密码邮件"); + + mimeMessageHelper.setText(emailContent, true); + // 收件人 + mimeMessageHelper.setTo(email); + // 发送人 + mimeMessageHelper.setFrom(Constants.Email.EMAIL_FROM.getValue()); + mailSender.send(mimeMessage); + } catch (MessagingException e) { + log.error("用户重置密码的邮件任务发生异常------------>{}", e.getMessage()); + } } - @Override - public void testEmail(String email) throws MessagingException { - MimeMessage mimeMessage = mailSender.createMimeMessage(); - MimeMessageHelper mimeMessageHelper = new MimeMessageHelper(mimeMessage, - true); - mimeMessageHelper.setSubject("HOJ的测试邮件"); - mimeMessageHelper.setText("
\n" + - "\t\t\t\t
\n" + - "\t\t\t\t\t
\n" + - "\t\t\t\t\t\t\n" + - "\t\t\t\t\t
\n" + - "\t\t\t\t
\n" + - "\t\t\t\t
\n" + - "\t\t\t\t\t

\n" + - "\t\t\t\t\t\tDear 超级管理员\n" + - "\t\t\t\t\t

\n" + - "\t\t\t\t\t
\n" + - "\t\t\t\t\t
\n" + - "\t\t\t\t\t\t

\n" + - "\t\t\t\t\t\t\t来自 HOJ 邮件提醒\n" + - "\t\t\t\t\t\t

\n" + - "\t\t\t\t\t

\n" + - "\t\t\t\t\t\t您收到这封电子邮件是因为您在 HOJ 上进行邮箱配置更新,然后进行邮箱可行性的测试。\n" + - "\t\t\t\t\t

\n" + - "\t\t\t\t\t
\n" + - "\t\t\t\t\t\t经过本邮件的接收,可证实:
\n" + - "\t\t\t\t\t\t 测试成功
\n" + - "\t\t\t\t\t\t
\n" + - "\t\t\t\t\t   \n" + - "\n" + - "\t\t\t\t\t
\n" + - "\t\t\t\t\t
\n" + - "\t\t\t\t\t\tHOJ|传送门\uD83D\uDEAA\n" + - "\t\t\t\t\t
\n" + - "\t\t\t\t\t

\n" + - "\t\t\t\t\t\t欢迎常来访问!
\n" + - "\t\t\t\t\t\t© 2020 \n" + - "\t\t\t\t\t\t\tHODE-OJ \n" + - "\t\t\t\t\t

\n" + - "\t\t\t\t\t

\n" + - "\t\t\t\t
\n" + - "\t\t\t
",true); - mimeMessageHelper.setTo(email); - mimeMessageHelper.setFrom("oj.hcode@qq.com"); - mailSender.send(mimeMessage); + /** + * @param email 用户邮箱 + * @MethodName testEmail + * @Description 超级管理员后台修改邮件系统配置后发送的测试邮箱可用性的测试邮件。 + * @Return + * @Since 2021/1/14 + */ + @Override + public void testEmail(String email) { + MimeMessage mimeMessage = mailSender.createMimeMessage(); + try { + MimeMessageHelper mimeMessageHelper = new MimeMessageHelper(mimeMessage, + true); + // 设置渲染到html页面对应的值 + Context context = new Context(); + context.setVariable(Constants.Email.OJ_NAME.name(), Constants.Email.OJ_NAME.getValue()); + context.setVariable(Constants.Email.OJ_SHORT_NAME.name(), Constants.Email.OJ_SHORT_NAME.getValue()); + context.setVariable(Constants.Email.OJ_URL.name(), Constants.Email.OJ_URL.getValue()); + context.setVariable(Constants.Email.EMAIL_BACKGROUND_IMG.name(), Constants.Email.EMAIL_BACKGROUND_IMG.getValue()); + + //利用模板引擎加载html文件进行渲染并生成对应的字符串 + String emailContent = templateEngine.process("emailTemplate_testEmail", context); + + mimeMessageHelper.setSubject("HOJ的测试邮件"); + + mimeMessageHelper.setText(emailContent, true); + // 收件人 + mimeMessageHelper.setTo(email); + // 发送人 + mimeMessageHelper.setFrom(Constants.Email.EMAIL_FROM.getValue()); + mailSender.send(mimeMessage); + } catch (MessagingException e) { + log.error("超级管理员重置邮件系统配置的测试邮箱可用性的任务发生异常------------>{}", e.getMessage()); + } } } \ No newline at end of file diff --git a/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/service/impl/ScheduleServiceImpl.java b/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/service/impl/ScheduleServiceImpl.java index 134cf2b8..0b96bd6c 100644 --- a/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/service/impl/ScheduleServiceImpl.java +++ b/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/service/impl/ScheduleServiceImpl.java @@ -21,7 +21,8 @@ public class ScheduleServiceImpl implements ScheduleService { @Autowired private FileServiceImpl fileService; - @Scheduled(cron = "0/5 * * * * *") + // 每天3:00执行一次 + @Scheduled(cron = "0 0 3 * * *") @Override public void deleteAvatar() { List files = fileService.queryDeleteAvatarList(); diff --git a/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/utils/Constants.java b/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/utils/Constants.java index b6b4ba7d..d97c1ad6 100644 --- a/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/utils/Constants.java +++ b/hoj-springboot/DataBackup/src/main/java/top/hcode/hoj/utils/Constants.java @@ -127,4 +127,28 @@ public class Constants { return path; } } + + /** + * @Description 邮件任务的一些常量 + * @Since 2021/1/14 + */ + + public enum Email{ + OJ_URL("http://localhost:8080"), + OJ_NAME("Hcode Online Judge"), + OJ_SHORT_NAME("HOJ"), + EMAIL_FROM("oj.hcode@qq.com"), + EMAIL_BACKGROUND_IMG("https://cdn.jsdelivr.net/gh/HimitZH/CDN/images/HCODE.png"), + REGISTER_KEY_PREFIX("register-user:"), + RESET_PASSWORD_KEY_PREFIX("reset-password:"); + private String value; + + Email(String value){ + this.value = value; + } + + public String getValue() { + return value; + } + } } \ No newline at end of file diff --git a/hoj-springboot/DataBackup/src/main/resources/templates/emailTemplate_registerCode.html b/hoj-springboot/DataBackup/src/main/resources/templates/emailTemplate_registerCode.html new file mode 100644 index 00000000..28de3f85 --- /dev/null +++ b/hoj-springboot/DataBackup/src/main/resources/templates/emailTemplate_registerCode.html @@ -0,0 +1,74 @@ + + + + + 用户注册验证码 + + +
+
+
+ +
+
+
+

+ Dear New HOJer +

+
+
+

+ 来自 邮件提醒 +

+

+ 您收到这封电子邮件是因为您 (也可能是某人冒充您的名义) 在 HOJ 上进行注册。假如这不是您本人所申请, + 请不用理会这封电子邮件, 但是如果您持续收到这类的信件骚扰, 请您尽快联络管理员。 +

+
+ 请使用以下验证码完成后续注册流程:
+
+ 注意:请您在收到邮件10分钟内([[${EXPIRE_TIME}]]前)使用,否则该验证码将会失效。 +
+     + +
+
+ +
+

+ 欢迎常来访问!
+ © 2021 +

+

+
+
+
+ + \ No newline at end of file diff --git a/hoj-springboot/DataBackup/src/main/resources/templates/emailTemplate_resetPassword.html b/hoj-springboot/DataBackup/src/main/resources/templates/emailTemplate_resetPassword.html new file mode 100644 index 00000000..0692380c --- /dev/null +++ b/hoj-springboot/DataBackup/src/main/resources/templates/emailTemplate_resetPassword.html @@ -0,0 +1,72 @@ + + + + + HOJ的重置密码邮件 + + +
+
+
+ +
+
+
+

+

+
+
+

+ 来自 邮件提醒 +

+

+ 您收到这封电子邮件是因为您 (也可能是某人冒充您的名义) 在 HOJ 上进行密码重置操作。假如这不是您本人所申请, 请不用理会这封电子邮件, 但是如果您持续收到这类的信件骚扰, 请您尽快联络管理员。 +

+
+ 请点击下面的链接完成后续重置密码的流程:
+ CLICK HERE
+ 注意:请您在收到邮件10分钟内([[${EXPIRE_TIME}]]前)使用,否则该重置密码链接将会失效。 +
+     + +
+
+ +
+

+ 欢迎常来访问!
+ © 2021 +

+

+
+
+
+ + \ No newline at end of file diff --git a/hoj-springboot/DataBackup/src/main/resources/templates/emailTemplate_testEmail.html b/hoj-springboot/DataBackup/src/main/resources/templates/emailTemplate_testEmail.html new file mode 100644 index 00000000..d10c6d76 --- /dev/null +++ b/hoj-springboot/DataBackup/src/main/resources/templates/emailTemplate_testEmail.html @@ -0,0 +1,72 @@ + + + + + 超级管理员测试邮箱可用性邮件 + + +
+
+
+ +
+
+
+

+ Dear Super Admin +

+
+
+

+ 来自 邮件提醒 +

+

+ 您收到这封电子邮件是因为您在 HOJ 上进行邮箱配置更新,然后进行邮箱可行性的测试。 +

+
+ 经过本邮件的接收,可证实:
+ Test Success
+
+     + +
+
+ +
+

+ 欢迎常来访问!
+ © 2021 +

+

+
+
+
+ + \ No newline at end of file diff --git a/hoj-springboot/DataBackup/target/classes/templates/emailTemplate_registerCode.html b/hoj-springboot/DataBackup/target/classes/templates/emailTemplate_registerCode.html new file mode 100644 index 00000000..28de3f85 --- /dev/null +++ b/hoj-springboot/DataBackup/target/classes/templates/emailTemplate_registerCode.html @@ -0,0 +1,74 @@ + + + + + 用户注册验证码 + + +
+
+
+ +
+
+
+

+ Dear New HOJer +

+
+
+

+ 来自 邮件提醒 +

+

+ 您收到这封电子邮件是因为您 (也可能是某人冒充您的名义) 在 HOJ 上进行注册。假如这不是您本人所申请, + 请不用理会这封电子邮件, 但是如果您持续收到这类的信件骚扰, 请您尽快联络管理员。 +

+
+ 请使用以下验证码完成后续注册流程:
+
+ 注意:请您在收到邮件10分钟内([[${EXPIRE_TIME}]]前)使用,否则该验证码将会失效。 +
+     + +
+
+ +
+

+ 欢迎常来访问!
+ © 2021 +

+

+
+
+
+ + \ No newline at end of file diff --git a/hoj-springboot/DataBackup/target/classes/templates/emailTemplate_resetPassword.html b/hoj-springboot/DataBackup/target/classes/templates/emailTemplate_resetPassword.html new file mode 100644 index 00000000..0692380c --- /dev/null +++ b/hoj-springboot/DataBackup/target/classes/templates/emailTemplate_resetPassword.html @@ -0,0 +1,72 @@ + + + + + HOJ的重置密码邮件 + + +
+
+
+ +
+
+
+

+

+
+
+

+ 来自 邮件提醒 +

+

+ 您收到这封电子邮件是因为您 (也可能是某人冒充您的名义) 在 HOJ 上进行密码重置操作。假如这不是您本人所申请, 请不用理会这封电子邮件, 但是如果您持续收到这类的信件骚扰, 请您尽快联络管理员。 +

+
+ 请点击下面的链接完成后续重置密码的流程:
+ CLICK HERE
+ 注意:请您在收到邮件10分钟内([[${EXPIRE_TIME}]]前)使用,否则该重置密码链接将会失效。 +
+     + +
+
+ +
+

+ 欢迎常来访问!
+ © 2021 +

+

+
+
+
+ + \ No newline at end of file diff --git a/hoj-springboot/DataBackup/target/classes/templates/emailTemplate_testEmail.html b/hoj-springboot/DataBackup/target/classes/templates/emailTemplate_testEmail.html new file mode 100644 index 00000000..d10c6d76 --- /dev/null +++ b/hoj-springboot/DataBackup/target/classes/templates/emailTemplate_testEmail.html @@ -0,0 +1,72 @@ + + + + + 超级管理员测试邮箱可用性邮件 + + +
+
+
+ +
+
+
+

+ Dear Super Admin +

+
+
+

+ 来自 邮件提醒 +

+

+ 您收到这封电子邮件是因为您在 HOJ 上进行邮箱配置更新,然后进行邮箱可行性的测试。 +

+
+ 经过本邮件的接收,可证实:
+ Test Success
+
+     + +
+
+ +
+

+ 欢迎常来访问!
+ © 2021 +

+

+
+
+
+ + \ No newline at end of file diff --git a/hoj-springboot/DataBackup/target/classes/top/hcode/hoj/controller/oj/AccountController.class b/hoj-springboot/DataBackup/target/classes/top/hcode/hoj/controller/oj/AccountController.class index a9475d4c..f90cf3e4 100644 Binary files a/hoj-springboot/DataBackup/target/classes/top/hcode/hoj/controller/oj/AccountController.class and b/hoj-springboot/DataBackup/target/classes/top/hcode/hoj/controller/oj/AccountController.class differ diff --git a/hoj-springboot/DataBackup/target/classes/top/hcode/hoj/controller/oj/CommonController.class b/hoj-springboot/DataBackup/target/classes/top/hcode/hoj/controller/oj/CommonController.class index e242a94b..64a29eb7 100644 Binary files a/hoj-springboot/DataBackup/target/classes/top/hcode/hoj/controller/oj/CommonController.class and b/hoj-springboot/DataBackup/target/classes/top/hcode/hoj/controller/oj/CommonController.class differ diff --git a/hoj-springboot/DataBackup/target/classes/top/hcode/hoj/service/EmailService.class b/hoj-springboot/DataBackup/target/classes/top/hcode/hoj/service/EmailService.class index 03935f8b..dac7a64e 100644 Binary files a/hoj-springboot/DataBackup/target/classes/top/hcode/hoj/service/EmailService.class and b/hoj-springboot/DataBackup/target/classes/top/hcode/hoj/service/EmailService.class differ diff --git a/hoj-springboot/DataBackup/target/classes/top/hcode/hoj/service/impl/EmailServiceImpl.class b/hoj-springboot/DataBackup/target/classes/top/hcode/hoj/service/impl/EmailServiceImpl.class index 9a8d7da1..2915575b 100644 Binary files a/hoj-springboot/DataBackup/target/classes/top/hcode/hoj/service/impl/EmailServiceImpl.class and b/hoj-springboot/DataBackup/target/classes/top/hcode/hoj/service/impl/EmailServiceImpl.class differ diff --git a/hoj-springboot/DataBackup/target/classes/top/hcode/hoj/service/impl/ScheduleServiceImpl.class b/hoj-springboot/DataBackup/target/classes/top/hcode/hoj/service/impl/ScheduleServiceImpl.class index 639551e7..80427f96 100644 Binary files a/hoj-springboot/DataBackup/target/classes/top/hcode/hoj/service/impl/ScheduleServiceImpl.class and b/hoj-springboot/DataBackup/target/classes/top/hcode/hoj/service/impl/ScheduleServiceImpl.class differ diff --git a/hoj-springboot/DataBackup/target/classes/top/hcode/hoj/utils/Constants$Email.class b/hoj-springboot/DataBackup/target/classes/top/hcode/hoj/utils/Constants$Email.class new file mode 100644 index 00000000..042b6c22 Binary files /dev/null and b/hoj-springboot/DataBackup/target/classes/top/hcode/hoj/utils/Constants$Email.class differ diff --git a/hoj-springboot/DataBackup/target/classes/top/hcode/hoj/utils/Constants.class b/hoj-springboot/DataBackup/target/classes/top/hcode/hoj/utils/Constants.class index 76e854b2..fa781c11 100644 Binary files a/hoj-springboot/DataBackup/target/classes/top/hcode/hoj/utils/Constants.class and b/hoj-springboot/DataBackup/target/classes/top/hcode/hoj/utils/Constants.class differ diff --git a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/JudgeServerApplication.class b/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/JudgeServerApplication.class deleted file mode 100644 index cb09f961..00000000 Binary files a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/JudgeServerApplication.class and /dev/null differ diff --git a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/common/CommonResult.class b/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/common/CommonResult.class deleted file mode 100644 index e56485fb..00000000 Binary files a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/common/CommonResult.class and /dev/null differ diff --git a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/config/AsyncTaskConfig.class b/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/config/AsyncTaskConfig.class deleted file mode 100644 index f043ba5a..00000000 Binary files a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/config/AsyncTaskConfig.class and /dev/null differ diff --git a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/config/MyMetaObjectConfig.class b/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/config/MyMetaObjectConfig.class deleted file mode 100644 index 4e4d66c4..00000000 Binary files a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/config/MyMetaObjectConfig.class and /dev/null differ diff --git a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/config/MybatisPlusConfig.class b/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/config/MybatisPlusConfig.class deleted file mode 100644 index f4f55a2b..00000000 Binary files a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/config/MybatisPlusConfig.class and /dev/null differ diff --git a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/controller/JudgeController.class b/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/controller/JudgeController.class deleted file mode 100644 index 12da6d7a..00000000 Binary files a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/controller/JudgeController.class and /dev/null differ diff --git a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/controller/SystemConfigController.class b/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/controller/SystemConfigController.class deleted file mode 100644 index 2f5a3d45..00000000 Binary files a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/controller/SystemConfigController.class and /dev/null differ diff --git a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/dao/JudgeCaseMapper.class b/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/dao/JudgeCaseMapper.class deleted file mode 100644 index fd0b4f62..00000000 Binary files a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/dao/JudgeCaseMapper.class and /dev/null differ diff --git a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/dao/JudgeMapper.class b/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/dao/JudgeMapper.class deleted file mode 100644 index 8925157b..00000000 Binary files a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/dao/JudgeMapper.class and /dev/null differ diff --git a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/dao/ProblemCaseMapper.class b/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/dao/ProblemCaseMapper.class deleted file mode 100644 index 596b1bff..00000000 Binary files a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/dao/ProblemCaseMapper.class and /dev/null differ diff --git a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/dao/ProblemCountMapper.class b/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/dao/ProblemCountMapper.class deleted file mode 100644 index eacb219d..00000000 Binary files a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/dao/ProblemCountMapper.class and /dev/null differ diff --git a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/dao/UserAcproblemMapper.class b/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/dao/UserAcproblemMapper.class deleted file mode 100644 index da756db8..00000000 Binary files a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/dao/UserAcproblemMapper.class and /dev/null differ diff --git a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/dao/UserRecordMapper.class b/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/dao/UserRecordMapper.class deleted file mode 100644 index a22b2647..00000000 Binary files a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/dao/UserRecordMapper.class and /dev/null differ diff --git a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/service/JudgeCaseService.class b/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/service/JudgeCaseService.class deleted file mode 100644 index 0d840752..00000000 Binary files a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/service/JudgeCaseService.class and /dev/null differ diff --git a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/service/JudgeService.class b/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/service/JudgeService.class deleted file mode 100644 index b487213c..00000000 Binary files a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/service/JudgeService.class and /dev/null differ diff --git a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/service/ProblemCaseService.class b/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/service/ProblemCaseService.class deleted file mode 100644 index a93cbbe9..00000000 Binary files a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/service/ProblemCaseService.class and /dev/null differ diff --git a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/service/ProblemCountService.class b/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/service/ProblemCountService.class deleted file mode 100644 index 37f3e6ca..00000000 Binary files a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/service/ProblemCountService.class and /dev/null differ diff --git a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/service/SystemConfigService.class b/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/service/SystemConfigService.class deleted file mode 100644 index 3d4835bf..00000000 Binary files a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/service/SystemConfigService.class and /dev/null differ diff --git a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/service/UserAcproblemService.class b/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/service/UserAcproblemService.class deleted file mode 100644 index d31b7897..00000000 Binary files a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/service/UserAcproblemService.class and /dev/null differ diff --git a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/service/UserRecordService.class b/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/service/UserRecordService.class deleted file mode 100644 index 594579f2..00000000 Binary files a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/service/UserRecordService.class and /dev/null differ diff --git a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/service/impl/JudgeCaseServiceImpl.class b/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/service/impl/JudgeCaseServiceImpl.class deleted file mode 100644 index 6ddba596..00000000 Binary files a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/service/impl/JudgeCaseServiceImpl.class and /dev/null differ diff --git a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/service/impl/JudgeServiceImpl.class b/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/service/impl/JudgeServiceImpl.class deleted file mode 100644 index 0c9ffcfd..00000000 Binary files a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/service/impl/JudgeServiceImpl.class and /dev/null differ diff --git a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/service/impl/ProblemCaseServiceImpl.class b/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/service/impl/ProblemCaseServiceImpl.class deleted file mode 100644 index e70aaf4f..00000000 Binary files a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/service/impl/ProblemCaseServiceImpl.class and /dev/null differ diff --git a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/service/impl/ProblemCountServiceImpl$1.class b/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/service/impl/ProblemCountServiceImpl$1.class deleted file mode 100644 index f96815f4..00000000 Binary files a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/service/impl/ProblemCountServiceImpl$1.class and /dev/null differ diff --git a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/service/impl/ProblemCountServiceImpl.class b/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/service/impl/ProblemCountServiceImpl.class deleted file mode 100644 index 21ded897..00000000 Binary files a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/service/impl/ProblemCountServiceImpl.class and /dev/null differ diff --git a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/service/impl/SystemConfigServiceImpl.class b/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/service/impl/SystemConfigServiceImpl.class deleted file mode 100644 index 1a7af48d..00000000 Binary files a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/service/impl/SystemConfigServiceImpl.class and /dev/null differ diff --git a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/service/impl/UserAcproblemServiceImpl.class b/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/service/impl/UserAcproblemServiceImpl.class deleted file mode 100644 index 855e8e96..00000000 Binary files a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/service/impl/UserAcproblemServiceImpl.class and /dev/null differ diff --git a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/service/impl/UserRecordServiceImpl.class b/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/service/impl/UserRecordServiceImpl.class deleted file mode 100644 index 2400f014..00000000 Binary files a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/service/impl/UserRecordServiceImpl.class and /dev/null differ diff --git a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/util/Constants$Judge.class b/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/util/Constants$Judge.class deleted file mode 100644 index 282306ae..00000000 Binary files a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/util/Constants$Judge.class and /dev/null differ diff --git a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/util/Constants.class b/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/util/Constants.class deleted file mode 100644 index fee43206..00000000 Binary files a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/util/Constants.class and /dev/null differ diff --git a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/util/IpUtils.class b/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/util/IpUtils.class deleted file mode 100644 index b6f046d5..00000000 Binary files a/hoj-springboot/JudgeServer/target/classes/top/hcode/hoj/util/IpUtils.class and /dev/null differ diff --git a/hoj-vue/src/common/api.js b/hoj-vue/src/common/api.js index b37851e0..1387b34d 100644 --- a/hoj-vue/src/common/api.js +++ b/hoj-vue/src/common/api.js @@ -153,6 +153,10 @@ const ojApi = { } }) }, + // 获取验证码 + getCaptcha(){ + return ajax('/api/captcha', 'get') + }, // 注册 register(data) { return ajax('/api/register', 'post', { diff --git a/hoj-vue/src/components/oj/common/ResetPassword.vue b/hoj-vue/src/components/oj/common/ResetPassword.vue index 4d7d29a5..df606f11 100644 --- a/hoj-vue/src/components/oj/common/ResetPassword.vue +++ b/hoj-vue/src/components/oj/common/ResetPassword.vue @@ -1,28 +1,37 @@