ÎļþÃû´Ó ruoyi-modules/ruoyi-system/src/main/java/org/ruoyi/system/controller/system/CaptchaController.java ÐÞ¸Ä |
| | |
| | | package org.ruoyi.system.controller.system; |
| | | package org.ruoyi.controller; |
| | | |
| | | import cn.dev33.satoken.annotation.SaIgnore; |
| | | import cn.hutool.captcha.AbstractCaptcha; |
| | | import cn.hutool.captcha.generator.CodeGenerator; |
| | | import cn.hutool.core.util.IdUtil; |
| | | import cn.hutool.core.util.RandomUtil; |
| | | import jakarta.validation.Valid; |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.ruoyi.common.core.constant.Constants; |
| | | import org.ruoyi.common.core.constant.GlobalConstants; |
| | | import org.ruoyi.common.core.domain.R; |
| | |
| | | import org.ruoyi.common.web.enums.CaptchaType; |
| | | import org.ruoyi.system.domain.request.EmailRequest; |
| | | import org.ruoyi.system.domain.vo.CaptchaVo; |
| | | import jakarta.validation.Valid; |
| | | import jakarta.validation.constraints.NotBlank; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.expression.Expression; |
| | | import org.springframework.expression.ExpressionParser; |
| | | import org.springframework.expression.spel.standard.SpelExpressionParser; |
| | |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import java.time.Duration; |
| | | import java.util.HashMap; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * éªè¯ç æä½å¤ç |
| | |
| | | String suffix = configService.getConfigValue("mail", "suffix"); |
| | | String prompt = configService.getConfigValue("mail", "prompt"); |
| | | if(StringUtils.isNotEmpty(suffix)){ |
| | | // 卿çååå表 |
| | | String[] invalidDomains = suffix.split(","); |
| | | for (String domain : invalidDomains) { |
| | | if (emailRequest.getUsername().endsWith(domain)) { |
| | |
| | | String mailTitle = configService.getConfigValue("mail", "mailTitle"); |
| | | String replacedModel = model.replace("{code}", code); |
| | | try { |
| | | MailUtils.sendHtml(emailRequest.getUsername(), mailTitle, replacedModel); |
| | | MailUtils.sendHtml(emailRequest.getUsername(), mailTitle, replacedModel); |
| | | } catch (Exception e) { |
| | | log.error("é®ç®±éªè¯ç åéå¼å¸¸ => {}", e.getMessage()); |
| | | return R.fail(e.getMessage()); |