Commit 3c9f700f authored by Quxl's avatar Quxl

修改国际化配置

parent 5c3dc2fd
...@@ -67,17 +67,17 @@ public class MemberOpenApiController { ...@@ -67,17 +67,17 @@ public class MemberOpenApiController {
} }
@ResponseBody @ResponseBody
@PostMapping("getPassword") @PostMapping("resetPassword")
@ApiOperation("找回密码") @ApiOperation("找回密码")
@ApiImplicitParams({@ApiImplicitParam(paramType = "query", dataType = "string", required = true, name = "email")}) @ApiImplicitParams({@ApiImplicitParam(paramType = "query", dataType = "string", required = true, name = "email")})
public Object getPassword(String email) { public Object resetPassword(String email) {
int code = (int) ((Math.random() * 9 + 1) * 10000000); int code = (int) ((Math.random() * 9 + 1) * 10000000);
String password = String.valueOf(code); String password = String.valueOf(code);
Fc_member member = memberService.getMemberByEmail(email); Fc_member member = memberService.getMemberByEmail(email);
String encodePwd = memberService.encodePassword(member.getSalt(), password); String encodePwd = memberService.encodePassword(member.getSalt(), password);
memberService.changePassword(member.getId(), encodePwd); memberService.changePassword(member.getId(), encodePwd);
String subject = messages.get("email.getPassword.subject"); String subject = messages.get("email.getPassword.subject");
String content = messages.get("email.getPassword.subject", member.getRealname(), password); String content = messages.get("email.getPassword.content", member.getRealname(), password);
emailService.send(subject, content, email); emailService.send(subject, content, email);
return Rjx.jsonOk(); return Rjx.jsonOk();
} }
......
package com.egolm.film.config;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.MessageSource;
import org.springframework.context.annotation.Bean;
import org.springframework.context.support.ResourceBundleMessageSource;
@ConfigurationProperties(prefix = "spring.messages")
public class LocaleConfig {
@Bean
public MessageSource messageSource() {
ResourceBundleMessageSource messageSource = new ResourceBundleMessageSource();
messageSource.setBasename("/i18n/messages");
messageSource.setDefaultEncoding("utf-8");
messageSource.setAlwaysUseMessageFormat(true);
messageSource.setCacheSeconds(-1);
return messageSource;
}
}
...@@ -13,9 +13,7 @@ spring.http.encoding.force=true ...@@ -13,9 +13,7 @@ spring.http.encoding.force=true
spring.http.encoding.enabled=true spring.http.encoding.enabled=true
spring.http.encoding.charset=utf-8 spring.http.encoding.charset=utf-8
spring.messages.basename=classpath:i18n/messages spring.messages.basename=classpath:i18n/messages
spring.messages.cache-seconds=3600
spring.messages.encoding=UTF-8
com.egolm.film.email.smtp.host=mail.egolm.com com.egolm.film.email.smtp.host=mail.egolm.com
com.egolm.film.email.smtp.port=25 com.egolm.film.email.smtp.port=25
......
email.getPassword.subject=\u4E2D\u56FD\u7535\u5F71\u8282[\u627E\u56DE\u5BC6\u7801]\u90AE\u4EF6
email.getPassword.content={0}, \u60A8\u597D, \u60A8\u7684\u65B0\u5BC6\u7801\u662F: [{1}]
sys.err=\u7CFB\u7EDF\u9519\u8BEF
sys.err.user_disabled=\u7528\u6237\u5DF2\u7ECF\u7981\u7528
sys.err.user_pwd_err=\u7528\u6237\u6216\u5BC6\u7801\u9519\u8BEF
sys.err.user_pwd_null=\u7528\u6237\u540D\u548C\u5BC6\u7801\u4E0D\u80FD\u4E3A\u7A7A
msg.hello=\u60A8\u597D
msg.your_pwd=\u60A8\u7684\u5BC6\u7801\u662F
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment