diff --git a/dev-common/src/main/java/com/dev/common/constant/ConfigKeyConstants.java b/dev-common/src/main/java/com/dev/common/constant/ConfigKeyConstants.java new file mode 100644 index 0000000000000000000000000000000000000000..642e3fd8e616773a2a08353ec87ca064bc026213 --- /dev/null +++ b/dev-common/src/main/java/com/dev/common/constant/ConfigKeyConstants.java @@ -0,0 +1,11 @@ +package com.dev.common.constant; + +/** + * @Classname ConfigKeyConstants + * @Description 配置常量 + * @Date 2019/9/30 11:34 + * @Created by SSL + */ +public interface ConfigKeyConstants { + public static final String FORGOT_MAIL = "bbs.mail.forgot"; +} diff --git a/dev-common/src/main/java/com/dev/common/utils/SendMailUtils.java b/dev-common/src/main/java/com/dev/common/utils/SendMailUtils.java index 89735f30edcfecc472a3eac2c3f52048531c2d4b..dc302b8307eed1587d610acbc0b6edb21c539d08 100644 --- a/dev-common/src/main/java/com/dev/common/utils/SendMailUtils.java +++ b/dev-common/src/main/java/com/dev/common/utils/SendMailUtils.java @@ -1,5 +1,7 @@ package com.dev.common.utils; +import com.alibaba.fastjson.JSONObject; +import com.dev.common.constant.ConfigKeyConstants; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Component; @@ -18,85 +20,54 @@ import java.util.Properties; */ @Component public class SendMailUtils { - private static String FORGOT_URL = "http://localhost:8083"; - private static String GOOGLE_SMTP_HOST; - private static String GOOGLE_SMTP_PORT; - private static String GOOGLE_MAIL_USER; - private static String GOOGLE_MAIL_PASSWORD; - - @Value("${mail.google.host}") - public void setGoogleSmtpHost(String data) { - SendMailUtils.GOOGLE_SMTP_HOST = data; - } - - @Value("${mail.google.port}") - public void setGoogleSmtpPort(String data) { - SendMailUtils.GOOGLE_SMTP_PORT = data; - } - - @Value("${mail.google.user}") - public void setGoogleMailUser(String data) { - SendMailUtils.GOOGLE_MAIL_USER = data; - } - - @Value("${mail.google.pwd}") - public void setGoogleMailPassword(String data) { - SendMailUtils.GOOGLE_MAIL_PASSWORD = data; - } + private static String SMTP_HOST = "host"; + private static String SMTP_PORT = "port"; + private static String MAIL_USER = "user"; + private static String MAIL_PASSWORD = "pwd"; + private static String TITLE = "title"; + private static String CONTENT = "content"; public static boolean sendForgotPwd(String toMail, String code) { - String title = "[dev开发社区] 找回密码验证"; - String content = "找回密码验证\n" + - "\n" + - "尊敬的"+toMail + ":\n" + - "这封信是由 dev开发社区 发送的。\n" + - "\n" + - "您收到这封邮件,是由于在 dev开发社区 进行了找回密码。如果您并没有访问过 dev开发社区,或没有进行上述操作,请忽 略这封邮件。您不需要退订或进行其他进一步的操作。\n" + - "\n" + - "\n" + - "----------------------------------------------------------------------\n" + - "找回密码说明\n" + - "----------------------------------------------------------------------\n" + - "\n" + - "您只需点击下面的链接即可激活您的帐号:\n" + - FORGOT_URL + code + "\n" + - "(如果上面不是链接形式,请将该地址手工粘贴到浏览器地址栏再访问)\n" + - "\n" + - "感谢您的访问,祝您使用愉快!\n" + - "\n" + - "此致\n" + - "dev开发社区。\n" + - "http://bbs.52codes.net/"; - return sendGoogleMail(toMail, title, content); + JSONObject configData = JSONObject.parseObject(RedisUtils.get(ConfigKeyConstants.FORGOT_MAIL).toString()); + JSONObject data= configData.getJSONObject("configValue"); + String title = data.getString(TITLE); + String content = data.getString(CONTENT).replace("TO_MAIL",toMail).replace("FORGOT_CODE",code); + //格式化 + return sendGoogleMail(toMail, title, content,data); } - //发送谷歌邮件 - public static boolean sendGoogleMail(String toMail, String title, String content) { + //发送邮件 + public static boolean sendGoogleMail(String toMail, String title, String content,JSONObject configData) { //配置ssl Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider()); final String SSL_FACTORY = "javax.net.ssl.SSLSocketFactory"; // 配置发送邮件的环境属性 Properties props = System.getProperties(); props.put("mail.debug", "true"); - props.put("mail.smtp.host", GOOGLE_SMTP_HOST); + props.put("mail.smtp.host", configData.getString(SMTP_HOST)); props.put("mail.smtp.socketFactory.class", SSL_FACTORY); props.put("mail.smtp.ssl.enable", "true"); - props.put("mail.smtp.port", GOOGLE_SMTP_PORT); - props.put("mail.smtp.socketFactory.port", GOOGLE_SMTP_PORT); + props.put("mail.smtp.port", configData.getString(SMTP_PORT)); + props.put("mail.smtp.socketFactory.port", configData.getString(SMTP_PORT)); props.put("mail.smtp.auth", "true"); + + String user = configData.getString(MAIL_USER); + String pwd = configData.getString(MAIL_PASSWORD); + props.put("mail.user", user); + props.put("mail.password", pwd); // 构建授权信息,用于进行SMTP进行身份验证 Session session = Session.getDefaultInstance(props, new Authenticator() { protected PasswordAuthentication getPasswordAuthentication() { // 用户名、密码 - return new PasswordAuthentication(GOOGLE_MAIL_USER, GOOGLE_MAIL_PASSWORD); + return new PasswordAuthentication(user, pwd); } }); try { // 创建邮件消息 Message msg = new MimeMessage(session); // 设置发件人邮件地址和名称。填写控制台配置的发信地址,比如xxx@xxx.com。和上面的mail.user保持一致。名称用户可以自定义填写。 - msg.setFrom(new InternetAddress(GOOGLE_MAIL_USER)); + msg.setFrom(new InternetAddress(configData.getString(MAIL_USER))); // 设置收件人邮件地址,比如yyy@yyy.com msg.setRecipients(Message.RecipientType.TO, InternetAddress.parse(toMail, false)); diff --git a/dev-common/src/main/java/com/dev/common/utils/StringUtils.java b/dev-common/src/main/java/com/dev/common/utils/StringUtils.java index a02f6b97de99fcc9958a61994ed03b50728c4cc7..d088816f5c7e2a27fa350f67af762fea8d00dac8 100644 --- a/dev-common/src/main/java/com/dev/common/utils/StringUtils.java +++ b/dev-common/src/main/java/com/dev/common/utils/StringUtils.java @@ -2,6 +2,10 @@ package com.dev.common.utils; import java.util.Collection; import java.util.Map; +import java.util.regex.Matcher; +import java.util.regex.Pattern; + +import com.dev.common.constant.UserConstants; import com.dev.common.core.text.StrFormatter; /** @@ -395,4 +399,23 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils } return sb.toString(); } + + /** + * 校验邮箱是否正常 + * @param email + * @return + */ + public static boolean isEmail(String email){ + if (null==email || "".equals(email)){ + return false; + } + String regEx1 = UserConstants.EMAIL_PATTERN; + Pattern p = Pattern.compile(regEx1); + Matcher m = p.matcher(email); + if(m.matches()){ + return true; + }else{ + return false; + } + } } \ No newline at end of file diff --git a/dev-core/dev-core-bbs/src/main/java/com/dev/bbs/domain/BbsConfig.java b/dev-core/dev-core-bbs/src/main/java/com/dev/bbs/domain/BbsConfig.java new file mode 100644 index 0000000000000000000000000000000000000000..495b2b9508e4a247319a020803e0d6fd7c2afec3 --- /dev/null +++ b/dev-core/dev-core-bbs/src/main/java/com/dev/bbs/domain/BbsConfig.java @@ -0,0 +1,45 @@ +package com.dev.bbs.domain; + +import javax.persistence.Id; + +import com.dev.common.annotation.Excel; +import com.dev.common.core.domain.BaseEntity; + +import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.experimental.Accessors; +import tk.mybatis.mapper.annotation.KeySql; + +/** + * bbs参数配置对象 bbs_config + * + * @author dev + * @date 2019-09-30 + */ +@Data +@Accessors(chain = true) +@EqualsAndHashCode(callSuper = true) +public class BbsConfig extends BaseEntity +{ + /** 参数主键 */ + @Id + @KeySql(useGeneratedKeys = true) + private Integer configId; + + /** 参数名称 */ + @Excel(name = "参数名称") + private String configName; + + /** 参数键名 */ + @Excel(name = "参数键名") + private String configKey; + + /** 参数键值 */ + @Excel(name = "参数键值") + private String configValue; + + /** 系统内置(Y是 N否) */ + @Excel(name = "系统内置", readConverterExp = "Y=是,N=否") + private String configType; + +} diff --git a/dev-core/dev-core-bbs/src/main/java/com/dev/bbs/mapper/BbsConfigMapper.java b/dev-core/dev-core-bbs/src/main/java/com/dev/bbs/mapper/BbsConfigMapper.java new file mode 100644 index 0000000000000000000000000000000000000000..e8000731cf446d66e377ffc20ee135011937494f --- /dev/null +++ b/dev-core/dev-core-bbs/src/main/java/com/dev/bbs/mapper/BbsConfigMapper.java @@ -0,0 +1,14 @@ +package com.dev.bbs.mapper; + +import com.dev.bbs.domain.BbsConfig; +import com.dev.common.core.dao.BaseMapper; + + +/** + * bbs参数配置Mapper接口 + * + * @author dev + * @date 2019-09-30 + */ +public interface BbsConfigMapper extends BaseMapper{ +} diff --git a/dev-core/dev-core-bbs/src/main/java/com/dev/bbs/service/IBbsConfigService.java b/dev-core/dev-core-bbs/src/main/java/com/dev/bbs/service/IBbsConfigService.java new file mode 100644 index 0000000000000000000000000000000000000000..fbfd9aba9238036e856db3ccc2b9ef4c2f4ca12a --- /dev/null +++ b/dev-core/dev-core-bbs/src/main/java/com/dev/bbs/service/IBbsConfigService.java @@ -0,0 +1,21 @@ +package com.dev.bbs.service; + +import com.dev.bbs.domain.BbsConfig; +import java.util.List; + +/** + * bbs参数配置Service接口 + * + * @author dev + * @date 2019-09-30 + */ +public interface IBbsConfigService +{ + /** + * 查询bbs参数配置 + * + * @param configId bbs参数配置ID + * @return bbs参数配置 + */ + public BbsConfig selectBbsConfigByKey(String key); +} diff --git a/dev-core/dev-core-bbs/src/main/java/com/dev/bbs/service/IBbsUserService.java b/dev-core/dev-core-bbs/src/main/java/com/dev/bbs/service/IBbsUserService.java index 5ba5c65e27a2554679bb973abe7624d9275d2c74..66658d39c34ffbd1b71c92c979c0c6ecd443e2b3 100644 --- a/dev-core/dev-core-bbs/src/main/java/com/dev/bbs/service/IBbsUserService.java +++ b/dev-core/dev-core-bbs/src/main/java/com/dev/bbs/service/IBbsUserService.java @@ -107,5 +107,11 @@ public interface IBbsUserService */ public int resetUserPwd(BbsUser bbsUser); + + /** + * 忘记密码---发送邮件 + * @param username + */ + public void forgotPwdSendMail(String username); } diff --git a/dev-core/dev-core-bbs/src/main/java/com/dev/bbs/service/impl/BbsConfigServiceImpl.java b/dev-core/dev-core-bbs/src/main/java/com/dev/bbs/service/impl/BbsConfigServiceImpl.java new file mode 100644 index 0000000000000000000000000000000000000000..214c31d8412470a46d8688b9dd8f6a41f9cd0d62 --- /dev/null +++ b/dev-core/dev-core-bbs/src/main/java/com/dev/bbs/service/impl/BbsConfigServiceImpl.java @@ -0,0 +1,49 @@ +package com.dev.bbs.service.impl; + +import java.util.List; + +import com.alibaba.fastjson.JSONObject; +import com.dev.common.constant.ConfigKeyConstants; +import com.dev.common.exception.BusinessException; +import com.dev.common.utils.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import com.dev.bbs.mapper.BbsConfigMapper; +import com.dev.bbs.domain.BbsConfig; +import com.dev.bbs.service.IBbsConfigService; + +/** + * bbs参数配置Service业务层处理 + * + * @author dev + * @date 2019-09-30 + */ +@Service +public class BbsConfigServiceImpl implements IBbsConfigService +{ + @Autowired + private BbsConfigMapper bbsConfigMapper; + + /** + * 查询bbs参数配置 + * + * @param key bbs参数配置key + * @return bbs参数配置 + */ + public BbsConfig selectBbsConfigByKey(String key) + { + BbsConfig bbsConfig = new BbsConfig(); + Object object = RedisUtils.get(ConfigKeyConstants.FORGOT_MAIL); + if(object == null){ + bbsConfig = bbsConfigMapper.selectOne(new BbsConfig().setConfigKey(ConfigKeyConstants.FORGOT_MAIL)); + if(bbsConfig == null){ + throw new BusinessException("配置为空"); + } + RedisUtils.set(ConfigKeyConstants.FORGOT_MAIL,bbsConfig); + }else { + bbsConfig = JSONObject.parseObject(String.valueOf(object),BbsConfig.class); + } + return bbsConfig; + } + +} diff --git a/dev-core/dev-core-bbs/src/main/java/com/dev/bbs/service/impl/BbsUserServiceImpl.java b/dev-core/dev-core-bbs/src/main/java/com/dev/bbs/service/impl/BbsUserServiceImpl.java index 2fbd3d7edf0b31702ac5690c300c707d08292c0e..07a45952098d07213fd820ff787a9ca8f4f479db 100644 --- a/dev-core/dev-core-bbs/src/main/java/com/dev/bbs/service/impl/BbsUserServiceImpl.java +++ b/dev-core/dev-core-bbs/src/main/java/com/dev/bbs/service/impl/BbsUserServiceImpl.java @@ -1,7 +1,15 @@ package com.dev.bbs.service.impl; +import java.util.Date; import java.util.List; +import com.dev.bbs.service.IBbsConfigService; +import com.dev.common.constant.ConfigKeyConstants; +import com.dev.common.exception.BusinessException; +import com.dev.common.utils.RandomUtil; +import com.dev.common.utils.RedisUtils; +import com.dev.common.utils.SendMailUtils; +import com.dev.common.utils.StringUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -28,6 +36,9 @@ public class BbsUserServiceImpl implements IBbsUserService @Autowired private IBbsUserInfoService bbsUserInfoService; + @Autowired + private IBbsConfigService bbsConfigService; + /** * 查询社区用户 * @@ -167,4 +178,40 @@ public class BbsUserServiceImpl implements IBbsUserService { return bbsUserMapper.resetUserPwd(bbsUser); } + + /** + * 忘记密码---发送邮件 + * @param username + */ + public void forgotPwdSendMail(String username){ + //校验是否一天发送三次了 + Object object = RedisUtils.get(username); + Integer sendNum =object == null ? 0 : Integer.valueOf(object.toString()); + if(sendNum >= 3){ + throw new BusinessException("一天只能发送3次找回密码邮箱,请明天再来"); + } + //校验该用户是否已注册 + BbsUser bbsUser = bbsUserMapper.selectOne(new BbsUser().setUsername(username)); + if(bbsUser == null){ + throw new BusinessException("该用户未注册!"); + } + //校验用户邮箱是否正确 + String mail = bbsUser.getEmail(); + if(StringUtils.isEmpty(mail)){ + throw new BusinessException("该用户预留邮箱不正确,如需要继续找回密码,请联系社区管理员!"); + } + if(!StringUtils.isEmail(mail)){ + throw new BusinessException("该用户预留邮箱不正确,如需要继续找回密码,请联系社区管理员!"); + } + //生成找回密码---验证码---存储redis(15分钟) + String code = RandomUtil.randomStr(64); + RedisUtils.set(code,bbsUser.getUserId(),900); + //发送邮箱----读取配置 + bbsConfigService.selectBbsConfigByKey(ConfigKeyConstants.FORGOT_MAIL); + if(!SendMailUtils.sendForgotPwd(mail,code)){ + throw new BusinessException("发送失败"); + } + //一天只能发送3次邮箱 + RedisUtils.set(username,sendNum + 1); + } } diff --git a/dev-core/dev-core-bbs/src/main/resources/mapper/bbs/BbsConfigMapper.xml b/dev-core/dev-core-bbs/src/main/resources/mapper/bbs/BbsConfigMapper.xml new file mode 100644 index 0000000000000000000000000000000000000000..8b61b4e6af21ad81db158913b17d74e78953e30d --- /dev/null +++ b/dev-core/dev-core-bbs/src/main/resources/mapper/bbs/BbsConfigMapper.xml @@ -0,0 +1,24 @@ + + + + + + + + + + + + + + + + + + + select config_id, config_name, config_key, config_value, config_type, create_by, create_time, update_by, update_time, remark from bbs_config + + + \ No newline at end of file diff --git a/dev-web/dev-web-admin/src/main/resources/application-dev.yml b/dev-web/dev-web-admin/src/main/resources/application-dev.yml index 9ed9d9039f9c491e2b9e6e0a1967e6a18a932950..0883efe172fa9b51f72fec2d37309090650b25c5 100644 --- a/dev-web/dev-web-admin/src/main/resources/application-dev.yml +++ b/dev-web/dev-web-admin/src/main/resources/application-dev.yml @@ -86,11 +86,3 @@ spring: multipart: max-file-size: 100MB max-request-size: 100MB - -#==================== 自定义参数 ============================ -mail: - google: - host: smtp.gmail.com - port: 465 - user: ruoyidev@gmail.com - pwd: Hello.123 \ No newline at end of file diff --git a/dev-web/dev-web-admin/src/main/resources/application-prod.yml b/dev-web/dev-web-admin/src/main/resources/application-prod.yml index f1494cb9c9910394a892ac3755bb377b3ada2c69..48aa5bf9a460cd61fd854982c8e6cff1f39c9c65 100644 --- a/dev-web/dev-web-admin/src/main/resources/application-prod.yml +++ b/dev-web/dev-web-admin/src/main/resources/application-prod.yml @@ -99,12 +99,4 @@ spring: servlet: multipart: max-file-size: 100MB - max-request-size: 100MB - -#==================== 自定义参数 ============================ -mail: - google: - host: smtp.gmail.com - port: 465 - user: ruoyidev@gmail.com - pwd: Hello.123 \ No newline at end of file + max-request-size: 100MB \ No newline at end of file diff --git a/dev-web/dev-web-bbs/src/main/java/com/dev/web/controller/BbsUserController.java b/dev-web/dev-web-bbs/src/main/java/com/dev/web/controller/BbsUserController.java index 7e964036e854c46f19f0f04c3fd1ed4cbfb7b454..895011d0ae66c204c95754eef4d5caffea3f5d1a 100644 --- a/dev-web/dev-web-bbs/src/main/java/com/dev/web/controller/BbsUserController.java +++ b/dev-web/dev-web-bbs/src/main/java/com/dev/web/controller/BbsUserController.java @@ -3,11 +3,17 @@ package com.dev.web.controller; import com.dev.bbs.domain.BbsUser; import com.dev.bbs.service.IBbsUserService; import com.dev.common.annotation.Log; +import com.dev.common.constant.ConfigKeyConstants; import com.dev.common.core.controller.BaseController; import com.dev.common.core.domain.AjaxResult; import com.dev.common.core.page.TableDataInfo; import com.dev.common.enums.BusinessType; +import com.dev.common.exception.BusinessException; +import com.dev.common.utils.RedisUtils; +import com.dev.common.utils.StringUtils; import com.dev.common.utils.poi.ExcelUtil; +import com.dev.framework.shiro.service.BbsPasswordService; +import com.dev.framework.util.ShiroUtils; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -37,6 +43,9 @@ public class BbsUserController extends BaseController @Autowired private IBbsUserService bbsUserService; + + @Autowired + private BbsPasswordService passwordService; @GetMapping() @@ -136,4 +145,78 @@ public class BbsUserController extends BaseController } + /** + * 找回密码 + */ + @GetMapping("/forgot") + public String forgot() + { + return prefix + "/forgot"; + } + + /** + * 忘记密码--发送邮件 + */ + @PostMapping("/forgot/send") + @ResponseBody + public AjaxResult forgotSend(String username) + { + if(StringUtils.isEmpty(username)){ + throw new BusinessException("用户未注册!"); + } + bbsUserService.forgotPwdSendMail(username); + return success(); + } + + /** + * 找回密码---重置 + */ + @GetMapping("/forgot/rest/page/{code}") + public String forgotRestPage(@PathVariable("code") String code,ModelMap mmap) + { + RedisUtils.del(ConfigKeyConstants.FORGOT_MAIL); + Object object = RedisUtils.get(code); + if(object == null){ + mmap.addAttribute("status",1); + }else { + Long userId = Long.valueOf(String.valueOf(object)); + BbsUser bbsUser = bbsUserService.selectBbsUserById(userId); + mmap.addAttribute("status",0); + mmap.addAttribute("bbsUser",bbsUser); + } + return prefix + "/forgotMail"; + } + + /** + * 找回密码---重置 + */ + @PostMapping("/forgot/rest") + @ResponseBody + public AjaxResult forgotRest(String code,String password) + { + if(StringUtils.isEmpty(code)){ + throw new BusinessException("请打开正确链接"); + } + if(StringUtils.isEmpty(password)){ + throw new BusinessException("请打开正确链接"); + } + String data = RedisUtils.get(code).toString(); + if(StringUtils.isEmpty(data)){ + throw new BusinessException("该链接已失效"); + } + BbsUser bbsUser = bbsUserService.selectBbsUserById(Long.valueOf(data)); + if(bbsUser == null){ + throw new BusinessException("未知异常,请联系管理员"); + } + bbsUser.setSalt(ShiroUtils.randomSalt()); + bbsUser.setPassword( + passwordService.encryptPassword(bbsUser.getUsername(), password, bbsUser.getSalt())); + bbsUserService.resetUserPwd(bbsUser); + //删除Key + RedisUtils.del(code); + return AjaxResult.success(); + } + + + } diff --git a/dev-web/dev-web-bbs/src/main/resources/application-dev.yml b/dev-web/dev-web-bbs/src/main/resources/application-dev.yml index 92a9dfee44f7f7c00e537692f1c4efcb993fa79a..a326cdcbfb027a2452c63175c2c271485f19272d 100644 --- a/dev-web/dev-web-bbs/src/main/resources/application-dev.yml +++ b/dev-web/dev-web-bbs/src/main/resources/application-dev.yml @@ -8,14 +8,14 @@ spring: master: url: jdbc:mysql://localhost:3306/dev?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 username: root - password: root + password: 123456 # 从库数据源 slave: # 从数据源开关/默认关闭 enabled: false url: jdbc:mysql://localhost:3306/dev?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8 username: root - password: root + password: 123456 # 初始连接数 initialSize: 5 # 最小连接池数量 @@ -64,9 +64,9 @@ spring: redis: #数据库索引 database: 0 - host: 192.168.0.185 - port: 6380 - password: + host: 192.168.5.58 + port: 6379 + password: yibayi_181~jishubu*007 lettuce: pool: #最大连接数 @@ -85,11 +85,3 @@ spring: multipart: max-file-size: 100MB max-request-size: 100MB - -#==================== 自定义参数 ============================ -mail: - google: - host: smtp.gmail.com - port: 465 - user: ruoyidev@gmail.com - pwd: Hello.123 diff --git a/dev-web/dev-web-bbs/src/main/resources/application-prod.yml b/dev-web/dev-web-bbs/src/main/resources/application-prod.yml index 1af968e7aee6052142dfd5d436e373de6e91562f..71f3ec7c61d9913320c346865dab918b29188e4d 100644 --- a/dev-web/dev-web-bbs/src/main/resources/application-prod.yml +++ b/dev-web/dev-web-bbs/src/main/resources/application-prod.yml @@ -66,13 +66,21 @@ spring: wall: config: multi-statement-allow: true + + #==================== es ============================ + data: + elasticsearch: + cluster-name: my-application + cluster-nodes: 192.168.84.129:9300 + repositories: + enabled: true #==================== redis ============================ redis: #数据库索引 database: 0 - host: 127.0.0.1 + host: 192.168.5.58 port: 6379 - password: + password: yibayi_181~jishubu*007 lettuce: pool: #最大连接数 @@ -91,18 +99,3 @@ spring: multipart: max-file-size: 100MB max-request-size: 100MB - - data: - elasticsearch: - cluster-name: my-application - cluster-nodes: 127.0.0.1:9300 - repositories: - enabled: true - -#==================== 自定义参数 ============================ -mail: - google: - host: smtp.gmail.com - port: 465 - user: ruoyidev@gmail.com - pwd: Hello.123 \ No newline at end of file diff --git a/dev-web/dev-web-bbs/src/main/resources/templates/common/login.html b/dev-web/dev-web-bbs/src/main/resources/templates/common/login.html index 145b690a2f79abc55f1c3477db24d3f4cea16e9c..5fcb9c3a622b33443dfd4071d2bc1795dc9105cd 100644 --- a/dev-web/dev-web-bbs/src/main/resources/templates/common/login.html +++ b/dev-web/dev-web-bbs/src/main/resources/templates/common/login.html @@ -42,7 +42,7 @@ - 忘记密码? + 忘记密码? + +
+
+
+
+ +
+ +
+
+
+ +
+ +
+
+ + + +
+
+
+ +
+
+
+
+ + + + + + + + + + \ No newline at end of file diff --git a/dev-web/dev-web-bbs/src/main/resources/templates/user/forgotMail.html b/dev-web/dev-web-bbs/src/main/resources/templates/user/forgotMail.html new file mode 100644 index 0000000000000000000000000000000000000000..7b1c4682d00ed8624cd700f385aed73e4450774c --- /dev/null +++ b/dev-web/dev-web-bbs/src/main/resources/templates/user/forgotMail.html @@ -0,0 +1,90 @@ + + + + +
+
+
+
+
+
+
+
+ +
,请重置您的密码
+
+
+ +
+ +
+
6到16个字符
+
+
+ +
+ +
+
+
+ +
+ +
+
+ + + +
+
+
+ +
+
+
+
+
该重置密码链接已失效,请重新校验您的信息
+
+
+
+
+
+
+
+ + + + + + \ No newline at end of file diff --git a/sql/dev.sql b/sql/dev.sql index ee7010e07cfb25e39062059876ab9e1e0e4ac24d..0ee383ee5d9fa28c3efecd85bae8241e05922d67 100644 --- a/sql/dev.sql +++ b/sql/dev.sql @@ -1459,3 +1459,21 @@ INSERT INTO `sys_user_role` VALUES (1, 1); INSERT INTO `sys_user_role` VALUES (2, 2); SET FOREIGN_KEY_CHECKS = 1; + +CREATE TABLE `bbs_config` ( + `config_id` int(5) NOT NULL AUTO_INCREMENT COMMENT '参数主键', + `config_name` varchar(100) DEFAULT '' COMMENT '参数名称', + `config_key` varchar(100) DEFAULT '' COMMENT '参数键名', + `config_value` varchar(1024) DEFAULT '' COMMENT '参数键值', + `config_type` char(1) DEFAULT 'N' COMMENT '系统内置(Y是 N否)', + `create_by` varchar(64) DEFAULT '' COMMENT '创建者', + `create_time` datetime DEFAULT NULL COMMENT '创建时间', + `update_by` varchar(64) DEFAULT '' COMMENT '更新者', + `update_time` datetime DEFAULT NULL COMMENT '更新时间', + `remark` varchar(500) DEFAULT NULL COMMENT '备注', + PRIMARY KEY (`config_id`) +) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8mb4 ROW_FORMAT=DYNAMIC COMMENT='bbs参数配置表'; + +/*Data for the table `bbs_config` */ + +insert into `bbs_config`(`config_id`,`config_name`,`config_key`,`config_value`,`config_type`,`create_by`,`create_time`,`update_by`,`update_time`,`remark`) values (1,'找回密码-邮箱配置','bbs.mail.forgot','{\r\n \"title\": \"[dev开发社区] 找回密码验证\",\r\n \"content\": \"找回密码验证\\n\\nTO_MAIL,\\n这封信是由 dev开发社区 发送的。\\n\\n您收到这封邮件,是由于在 dev开发社区 进行了找回密码。如果您并没有访问过 dev开发社区,或没有进行上述操作,请忽 略这封邮件。您不需要退订或进行其他进一步的操作。\\n\\n\\n----------------------------------------------------------------------\\n找回密码说明\\n----------------------------------------------------------------------\\n\\n您只需点击下面的链接即可激活您的帐号:\\nhttp://localhost:8083/user/forgot/rest/page/FORGOT_CODE\\n(如果上面不是链接形式,请将该地址手工粘贴到浏览器地址栏再访问)\\n\\n感谢您的访问,祝您使用愉快!\\n\\n此致\\ndev开发社区。\\nhttp://dev.zmrit.com/\",\r\n \"host\": \"74.125.204.109\",\r\n \"port\": \"465\",\r\n \"user\": \"ruoyidev@gmail.com\",\r\n \"pwd\": \"Hello.123\"\r\n}','Y','admin','2019-09-30 11:38:25','admin','2019-09-30 11:38:30','找回密码-邮箱配置');