充值密码 & 去除土味情话 优化了斗图样式
This commit is contained in:
@@ -3,12 +3,16 @@ package com.quinn.common;
|
|||||||
public enum EmailType {
|
public enum EmailType {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 论坛
|
* 注册
|
||||||
*/
|
*/
|
||||||
REGISTER,
|
REGISTER,
|
||||||
/**
|
/**
|
||||||
* 资源
|
* 注册成功
|
||||||
*/
|
*/
|
||||||
SUCCESS
|
SUCCESS,
|
||||||
|
/**
|
||||||
|
* 充值密码
|
||||||
|
*/
|
||||||
|
RESET
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,8 @@ public interface QuinnConstant {
|
|||||||
|
|
||||||
String LINK_SUFFIX = ".";
|
String LINK_SUFFIX = ".";
|
||||||
|
|
||||||
|
String LINK_URL = "/";
|
||||||
|
|
||||||
String LINK_KEY_WORD = ",";
|
String LINK_KEY_WORD = ",";
|
||||||
|
|
||||||
String LINK_DATE_STR = "_";
|
String LINK_DATE_STR = "_";
|
||||||
@@ -39,4 +41,6 @@ public interface QuinnConstant {
|
|||||||
String DEFAULT_ATTR = "/images/avatar/a#.png";
|
String DEFAULT_ATTR = "/images/avatar/a#.png";
|
||||||
|
|
||||||
String EMAIL_REPLACE = "#!!#";
|
String EMAIL_REPLACE = "#!!#";
|
||||||
|
|
||||||
|
String EMAIL_REPLACE_ALL = "#!#";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -28,7 +28,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter {
|
|||||||
// 访问权限
|
// 访问权限
|
||||||
http.authorizeRequests()
|
http.authorizeRequests()
|
||||||
.antMatchers("/","/index","/favicon.ico").permitAll()
|
.antMatchers("/","/index","/favicon.ico").permitAll()
|
||||||
.antMatchers("/register","/login","/toLogin","/checkLogin","/checkRegister").permitAll()
|
.antMatchers("/register","/login","/forget","/resetPwd/*/*","/toLogin","/checkLogin","/checkRegister").permitAll()
|
||||||
.antMatchers("/source","/source/view/*").permitAll()
|
.antMatchers("/source","/source/view/*").permitAll()
|
||||||
.antMatchers("/blog","/blog/read/*").permitAll()
|
.antMatchers("/blog","/blog/read/*").permitAll()
|
||||||
.antMatchers("/guess","/favor","/firework").permitAll()
|
.antMatchers("/guess","/favor","/firework").permitAll()
|
||||||
|
|||||||
@@ -4,8 +4,6 @@ package com.quinn.controller;
|
|||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.quinn.common.ExpBucket;
|
import com.quinn.common.ExpBucket;
|
||||||
import com.quinn.intergration.BucketImage;
|
|
||||||
import com.quinn.intergration.TodayLove;
|
|
||||||
import com.quinn.pojo.About;
|
import com.quinn.pojo.About;
|
||||||
import com.quinn.service.AboutService;
|
import com.quinn.service.AboutService;
|
||||||
import com.quinn.utils.QuinnUtils;
|
import com.quinn.utils.QuinnUtils;
|
||||||
@@ -34,8 +32,6 @@ public class AboutController extends BaseModelController {
|
|||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
AboutService aboutService;
|
AboutService aboutService;
|
||||||
@Resource
|
|
||||||
TodayLove todayLove;
|
|
||||||
|
|
||||||
@GetMapping("/about")
|
@GetMapping("/about")
|
||||||
public String userIndexBlog(HttpServletRequest request,Model model){
|
public String userIndexBlog(HttpServletRequest request,Model model){
|
||||||
@@ -62,8 +58,6 @@ public class AboutController extends BaseModelController {
|
|||||||
// 列表展示
|
// 列表展示
|
||||||
@GetMapping("/favor")
|
@GetMapping("/favor")
|
||||||
public String sourceList(Model model) throws IOException {
|
public String sourceList(Model model) throws IOException {
|
||||||
// 每日情话
|
|
||||||
model.addAttribute("LoveList",todayLove.getTodayLoveStr());
|
|
||||||
MyPageParam pageParam = new MyPageParam(1,24);
|
MyPageParam pageParam = new MyPageParam(1,24);
|
||||||
List<ExpBucket> recordList = aboutService.listExp(null,pageParam);
|
List<ExpBucket> recordList = aboutService.listExp(null,pageParam);
|
||||||
model.addAttribute("recordList",recordList);
|
model.addAttribute("recordList",recordList);
|
||||||
@@ -73,8 +67,6 @@ public class AboutController extends BaseModelController {
|
|||||||
|
|
||||||
@PostMapping("/favor")
|
@PostMapping("/favor")
|
||||||
public String blogListPage(FindNavReq findNavReq, Model model) throws IOException {
|
public String blogListPage(FindNavReq findNavReq, Model model) throws IOException {
|
||||||
// 每日情话
|
|
||||||
model.addAttribute("LoveList",todayLove.getTodayLoveStr());
|
|
||||||
int page = findNavReq.getPageNum();
|
int page = findNavReq.getPageNum();
|
||||||
int limit = findNavReq.getLimit();
|
int limit = findNavReq.getLimit();
|
||||||
if (findNavReq.getPageNum() < 1){
|
if (findNavReq.getPageNum() < 1){
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
package com.quinn.controller;
|
package com.quinn.controller;
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.quinn.common.QuinnConstant;
|
||||||
import com.quinn.common.QuinnException;
|
import com.quinn.common.QuinnException;
|
||||||
import com.quinn.common.RoleType;
|
import com.quinn.common.RoleType;
|
||||||
import com.quinn.intergration.AttrIcon;
|
import com.quinn.intergration.AttrIcon;
|
||||||
import com.quinn.intergration.TodayLove;
|
|
||||||
import com.quinn.pojo.Invite;
|
import com.quinn.pojo.Invite;
|
||||||
import com.quinn.pojo.User;
|
import com.quinn.pojo.User;
|
||||||
import com.quinn.pojo.UserInfo;
|
import com.quinn.pojo.UserInfo;
|
||||||
@@ -12,18 +12,21 @@ import com.quinn.service.InviteService;
|
|||||||
import com.quinn.service.UserInfoService;
|
import com.quinn.service.UserInfoService;
|
||||||
import com.quinn.service.UserService;
|
import com.quinn.service.UserService;
|
||||||
import com.quinn.task.SendAsyncEmail;
|
import com.quinn.task.SendAsyncEmail;
|
||||||
|
import com.quinn.task.SendForgetEmail;
|
||||||
import com.quinn.utils.AsyncTaskUtil;
|
import com.quinn.utils.AsyncTaskUtil;
|
||||||
import com.quinn.utils.QuinnUtils;
|
import com.quinn.utils.QuinnUtils;
|
||||||
import com.quinn.vo.CheckLoginForm;
|
import com.quinn.vo.CheckLoginForm;
|
||||||
import com.quinn.vo.RegisterForm;
|
import com.quinn.vo.RegisterForm;
|
||||||
|
import com.quinn.vo.ResetForm;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.PostMapping;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.PrintWriter;
|
import java.io.PrintWriter;
|
||||||
@@ -73,6 +76,58 @@ public class LoginController {
|
|||||||
return "register";
|
return "register";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("/forget")
|
||||||
|
public String toForget(){
|
||||||
|
return "forget";
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/forget")
|
||||||
|
public void forgetPassword(HttpServletResponse response,String forgetUsername) throws IOException {
|
||||||
|
response.setCharacterEncoding("UTF-8");
|
||||||
|
PrintWriter writer = response.getWriter();
|
||||||
|
// 检查用户状态
|
||||||
|
User hasUser = userService.getOne(new QueryWrapper<User>().eq("username", forgetUsername));
|
||||||
|
if (hasUser == null){
|
||||||
|
toResult(writer,"用户不存在,请检查用户名!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!StringUtils.isEmpty(hasUser.getResetKey())){
|
||||||
|
toResult(writer,"用户正在重置密码,请留意您的邮箱");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
UserInfo userInfo = userInfoService.getById(hasUser.getUid());
|
||||||
|
String resetKey = QuinnUtils.getUuid();
|
||||||
|
String resetUrl = QuinnConstant.LINK_URL + hasUser.getUid() + QuinnConstant.LINK_URL + resetKey;
|
||||||
|
hasUser.setResetKey(resetKey);
|
||||||
|
// 发邮件
|
||||||
|
AsyncTaskUtil.INSTANCE.submit(new SendForgetEmail(hasUser.getUsername(),resetUrl,userInfo.getEmail()));
|
||||||
|
// 更新用户状态
|
||||||
|
userService.updateById(hasUser);
|
||||||
|
toResult(writer,"ok");
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping("/resetPwd/{uid}/{key}")
|
||||||
|
public String resetPwd(@PathVariable("uid") String uid,@PathVariable("key") String key){
|
||||||
|
User user = userService.getOne(new QueryWrapper<User>().eq("uid", uid));
|
||||||
|
if (user == null || !key.equals(user.getResetKey())){
|
||||||
|
throw new QuinnException("防爬虫,重置密码钥匙错误");
|
||||||
|
}
|
||||||
|
return "resetPwd";
|
||||||
|
}
|
||||||
|
|
||||||
|
@PostMapping("/resetPwd/{uid}/{key}")
|
||||||
|
public String resetPassword(ResetForm resetForm, @PathVariable("uid") String uid, @PathVariable("key") String key){
|
||||||
|
User hasUser = userService.getOne(new QueryWrapper<User>().eq("uid", uid));
|
||||||
|
if (hasUser == null || !key.equals(hasUser.getResetKey())){
|
||||||
|
throw new QuinnException("防爬虫,重置密码钥匙错误");
|
||||||
|
}
|
||||||
|
// 密码加密 TODO 此处还是应该先校验一下
|
||||||
|
String bCryptPassword = new BCryptPasswordEncoder().encode(resetForm.getPassword());
|
||||||
|
hasUser.setPassword(bCryptPassword);
|
||||||
|
userService.updateById(hasUser);
|
||||||
|
return "redirect:/toLogin";
|
||||||
|
}
|
||||||
|
|
||||||
// 注册业务
|
// 注册业务
|
||||||
@PostMapping("/checkRegister")
|
@PostMapping("/checkRegister")
|
||||||
public void checkRegister(HttpServletResponse response,RegisterForm registerForm) throws IOException {
|
public void checkRegister(HttpServletResponse response,RegisterForm registerForm) throws IOException {
|
||||||
@@ -106,7 +161,7 @@ public class LoginController {
|
|||||||
|
|
||||||
// 注册业务
|
// 注册业务
|
||||||
@PostMapping("/register")
|
@PostMapping("/register")
|
||||||
public String register(RegisterForm registerForm, Model model) throws IOException {
|
public String register(RegisterForm registerForm) {
|
||||||
// 表单密码重复判断
|
// 表单密码重复判断
|
||||||
if (!registerForm.getPassword().equals(registerForm.getRepassword())){
|
if (!registerForm.getPassword().equals(registerForm.getRepassword())){
|
||||||
throw new QuinnException("防爬虫,两次输入密码不一致!");
|
throw new QuinnException("防爬虫,两次输入密码不一致!");
|
||||||
@@ -145,7 +200,7 @@ public class LoginController {
|
|||||||
inviteService.updateById(invite);
|
inviteService.updateById(invite);
|
||||||
userInfoService.save(new UserInfo().setUid(user.getUid()).setEmail(registerForm.getEmail()));
|
userInfoService.save(new UserInfo().setUid(user.getUid()).setEmail(registerForm.getEmail()));
|
||||||
// 发送注册成功通知邮件
|
// 发送注册成功通知邮件
|
||||||
AsyncTaskUtil.INSTANCE.submit(new SendAsyncEmail(registerForm.getUsername(),registerForm.getEmail()));
|
AsyncTaskUtil.INSTANCE.submit(new SendAsyncEmail(registerForm.getPassword(),registerForm.getEmail()));
|
||||||
// 注册成功,重定向到登录页面
|
// 注册成功,重定向到登录页面
|
||||||
return "redirect:/toLogin";
|
return "redirect:/toLogin";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import com.quinn.utils.SpringUtils;
|
|||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
import org.springframework.stereotype.Component;
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.util.CollectionUtils;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.mail.Authenticator;
|
import javax.mail.Authenticator;
|
||||||
@@ -20,6 +21,7 @@ import javax.mail.internet.InternetAddress;
|
|||||||
import javax.mail.internet.MimeMessage;
|
import javax.mail.internet.MimeMessage;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Properties;
|
import java.util.Properties;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 使用@multiavatar生成头像
|
* 使用@multiavatar生成头像
|
||||||
@@ -48,7 +50,17 @@ public class SendBMail {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean sendParamsMail(EmailType emailType, String email, Map<String,String> map){
|
public boolean sendParamsMail(EmailType emailType, String email, Map<String,String> map){
|
||||||
return true;
|
// 可以设计枚举,使用同一个发送邮件的公共方法
|
||||||
|
Email emailMode = emailService.getOne(new QueryWrapper<Email>().eq("type",emailType.name()));
|
||||||
|
String content = emailMode.getContent();
|
||||||
|
if (!CollectionUtils.isEmpty(map)){
|
||||||
|
Set<String> keys = map.keySet();
|
||||||
|
for (String x : keys) {
|
||||||
|
content = content.replaceAll(QuinnConstant.EMAIL_REPLACE_ALL + x + QuinnConstant.EMAIL_REPLACE_ALL
|
||||||
|
,map.get(x));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return sendMail(emailMode.getTitle(), content,email);
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean sendMail(String subject,String content,String toEmail){
|
private boolean sendMail(String subject,String content,String toEmail){
|
||||||
|
|||||||
@@ -1,54 +0,0 @@
|
|||||||
package com.quinn.intergration;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.type.TypeReference;
|
|
||||||
import com.quinn.common.QuinnConstant;
|
|
||||||
import com.quinn.utils.JsonUtils;
|
|
||||||
import com.quinn.utils.QuinnUtils;
|
|
||||||
import org.springframework.beans.factory.InitializingBean;
|
|
||||||
import org.springframework.core.io.Resource;
|
|
||||||
import org.springframework.core.io.support.PathMatchingResourcePatternResolver;
|
|
||||||
import org.springframework.core.io.support.ResourcePatternResolver;
|
|
||||||
import org.springframework.stereotype.Component;
|
|
||||||
import org.springframework.util.CollectionUtils;
|
|
||||||
|
|
||||||
import java.io.*;
|
|
||||||
import java.util.*;
|
|
||||||
|
|
||||||
@Component
|
|
||||||
public class TodayLove implements InitializingBean {
|
|
||||||
|
|
||||||
private List<String> dictionary = new ArrayList<>();
|
|
||||||
|
|
||||||
public List<String> getTodayLoveStr() throws IOException {
|
|
||||||
if (CollectionUtils.isEmpty(dictionary)){
|
|
||||||
makeDictionary();
|
|
||||||
}
|
|
||||||
int days = QuinnUtils.differentDays(new Date(2022, 4, 1), new Date());
|
|
||||||
int i = days % dictionary.size();
|
|
||||||
String todayStr = dictionary.get(i);
|
|
||||||
String[] split = todayStr.split(QuinnConstant.LINK_LOVE_STR);
|
|
||||||
return Arrays.asList(split);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void afterPropertiesSet() throws Exception {
|
|
||||||
makeDictionary();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void makeDictionary() throws IOException {
|
|
||||||
ResourcePatternResolver resolver = new PathMatchingResourcePatternResolver();
|
|
||||||
Resource[] resources = resolver.getResources("bqb/love.json");
|
|
||||||
Resource resource = resources[0];
|
|
||||||
InputStream is = resource.getInputStream();
|
|
||||||
InputStreamReader insReader = new InputStreamReader(
|
|
||||||
is, "UTF-8");
|
|
||||||
BufferedReader bufReader = new BufferedReader(insReader);
|
|
||||||
String json = bufReader.readLine();
|
|
||||||
bufReader.close();
|
|
||||||
insReader.close();
|
|
||||||
List<String> decode = JsonUtils.decode(json, new TypeReference<List<String>>() {
|
|
||||||
});
|
|
||||||
dictionary = decode;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -47,6 +47,9 @@ public class User implements Serializable {
|
|||||||
@ApiModelProperty(value = "头像")
|
@ApiModelProperty(value = "头像")
|
||||||
private String avatar;
|
private String avatar;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "重置密码钥匙")
|
||||||
|
private String resetKey;
|
||||||
|
|
||||||
@ApiModelProperty(value = "登录时间")
|
@ApiModelProperty(value = "登录时间")
|
||||||
private Date loginDate;
|
private Date loginDate;
|
||||||
|
|
||||||
|
|||||||
34
src/main/java/com/quinn/task/SendForgetEmail.java
Normal file
34
src/main/java/com/quinn/task/SendForgetEmail.java
Normal file
@@ -0,0 +1,34 @@
|
|||||||
|
package com.quinn.task;
|
||||||
|
|
||||||
|
import com.quinn.common.EmailType;
|
||||||
|
import com.quinn.intergration.SendBMail;
|
||||||
|
import com.quinn.utils.SpringUtils;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class SendForgetEmail implements Runnable{
|
||||||
|
|
||||||
|
String username;
|
||||||
|
|
||||||
|
String email;
|
||||||
|
|
||||||
|
String resetUrl;
|
||||||
|
|
||||||
|
public SendForgetEmail(String username,String resetUrl, String email) {
|
||||||
|
this.username = username;
|
||||||
|
this.resetUrl = resetUrl;
|
||||||
|
this.email = email;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
SendBMail sendBMail = SpringUtils.getBean(SendBMail.class);
|
||||||
|
Map<String,String> map = new HashMap<>();
|
||||||
|
map.put("username",username);
|
||||||
|
map.put("resetUrl",resetUrl);
|
||||||
|
sendBMail.sendParamsMail(EmailType.RESET,email,map);
|
||||||
|
}
|
||||||
|
}
|
||||||
19
src/main/java/com/quinn/vo/ResetForm.java
Normal file
19
src/main/java/com/quinn/vo/ResetForm.java
Normal file
@@ -0,0 +1,19 @@
|
|||||||
|
package com.quinn.vo;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@EqualsAndHashCode(callSuper = false)
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class ResetForm {
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "密码")
|
||||||
|
private String password;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "确认密码")
|
||||||
|
private String repassword;
|
||||||
|
|
||||||
|
}
|
||||||
File diff suppressed because one or more lines are too long
67
src/main/resources/templates/forget.html
Normal file
67
src/main/resources/templates/forget.html
Normal file
@@ -0,0 +1,67 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en" xmlns:th="http://www.thymeleaf.org">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||||
|
<title>注册-Quinn</title>
|
||||||
|
<link rel="stylesheet" th:href="@{/bootstrap/css/bootstrap.min.css}">
|
||||||
|
<link rel="stylesheet" th:href="@{/css/backgroud.css}">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-4" >
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4 mt-5" id='login_box'>
|
||||||
|
<form id="forgetForm" class="form-horizontal" method="post" noValidate>
|
||||||
|
<div class="justify-content-center">
|
||||||
|
<h1>忘记密码<small style="font-size: small">Quinn</small></h1>
|
||||||
|
<p>无法重置,请关注公众号反馈</p>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="forgetUsername">需要重置的用户名</label>
|
||||||
|
<input id="forgetUsername" type="text" name="forgetUsername" class="form-control" placeholder="用户名" required>
|
||||||
|
</div>
|
||||||
|
<button class="btn btn-dark btn-block" type="button" onclick="forgetPassword();">重置密码</button>
|
||||||
|
<p class="mt-1 clearfix">
|
||||||
|
<a style="color: white" th:href="@{/toLogin}" class="float-right text-decoration-none">记得密码?去登录</a>
|
||||||
|
</p>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4" >
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script th:src="@{/js/jquery-3.5.1.min.js}"></script>
|
||||||
|
<script th:src="@{/bootstrap/js/bootstrap.bundle.min.js}"></script>
|
||||||
|
<script th:src="@{/js/jquery-ui.min.js}"></script>
|
||||||
|
<script th:src="@{/layer/mobile/layer.js}"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
function forgetPassword(){
|
||||||
|
let forgetUsername = $('#forgetUsername').val();
|
||||||
|
if (!forgetUsername){
|
||||||
|
layer.open({ content: '用户名不能为空', skin: 'msg', time: 2 });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.disabled = true;
|
||||||
|
$.ajax({
|
||||||
|
url: "/forget",
|
||||||
|
async: false,
|
||||||
|
type: "post",
|
||||||
|
data: {"forgetUsername":forgetUsername},
|
||||||
|
success: function (data) {
|
||||||
|
console.log(data);
|
||||||
|
if(data == 'ok'){
|
||||||
|
layer.open({ content: '邮件已发送至您的邮箱,请点击邮箱内链接重置密码!', skin: 'msg', time: 2 });
|
||||||
|
}else {
|
||||||
|
layer.open({ content: data, skin: 'msg', time: 2 });
|
||||||
|
}
|
||||||
|
},
|
||||||
|
fail: function (error){
|
||||||
|
layer.open({ content: error, skin: 'msg', time: 2 });
|
||||||
|
}
|
||||||
|
})
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
@@ -7,7 +7,7 @@
|
|||||||
<link rel="stylesheet" th:href="@{/bootstrap/css/bootstrap.min.css}">
|
<link rel="stylesheet" th:href="@{/bootstrap/css/bootstrap.min.css}">
|
||||||
<link rel="stylesheet" th:href="@{/css/backgroud.css}">
|
<link rel="stylesheet" th:href="@{/css/backgroud.css}">
|
||||||
</head>
|
</head>
|
||||||
<body class="text-center">
|
<body>
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-4" >
|
<div class="col-md-4" >
|
||||||
@@ -30,6 +30,11 @@
|
|||||||
<input type="checkbox" name="remember-me"> 7天免登录
|
<input type="checkbox" name="remember-me"> 7天免登录
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
<div class="float-right mb-3">
|
||||||
|
<label>
|
||||||
|
<a style="color: white" th:href="@{/forget}" class="float-right text-decoration-none">忘记密码?</a>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
<button class="btn btn-dark btn-block" type="button" onclick="loginSubmit()">登 录</button>
|
<button class="btn btn-dark btn-block" type="button" onclick="loginSubmit()">登 录</button>
|
||||||
<p class="mt-1 clearfix">
|
<p class="mt-1 clearfix">
|
||||||
<a style="color: white" th:href="@{/register}" class="float-right text-decoration-none">没有账号?去注册</a>
|
<a style="color: white" th:href="@{/register}" class="float-right text-decoration-none">没有账号?去注册</a>
|
||||||
|
|||||||
@@ -44,10 +44,6 @@
|
|||||||
style="font-family:'Microsoft YaHei';">
|
style="font-family:'Microsoft YaHei';">
|
||||||
<tbody>
|
<tbody>
|
||||||
<tr>
|
<tr>
|
||||||
<svg viewBox="0 0 20 6" fill="none" xmlns="http://www.w3.org/2000/svg">
|
|
||||||
<circle cx="3.5" cy="3" r="2.5" fill="currentColor" />
|
|
||||||
<circle cx="16.5" cy="3" r="2.5" fill="currentColor" />
|
|
||||||
</svg>
|
|
||||||
<div style="width:800px;margin:0 auto;text-align:left;">
|
<div style="width:800px;margin:0 auto;text-align:left;">
|
||||||
<table width="944px" style="margin: 0 auto">
|
<table width="944px" style="margin: 0 auto">
|
||||||
<tbody>
|
<tbody>
|
||||||
@@ -82,15 +78,15 @@
|
|||||||
style="width: 8px;height: 35px;display: table-cell;background: #00C6FF;position: absolute;left: 31px;"></span>
|
style="width: 8px;height: 35px;display: table-cell;background: #00C6FF;position: absolute;left: 31px;"></span>
|
||||||
<h3
|
<h3
|
||||||
style="display: table-cell;margin: 0;padding: 0;font-size: 22px;line-height: 35px;">
|
style="display: table-cell;margin: 0;padding: 0;font-size: 22px;line-height: 35px;">
|
||||||
注册成功
|
重置密码
|
||||||
</h3>
|
</h3>
|
||||||
<p style="margin: 0;padding: 0;font-size: 20px;margin-top: 20px;">
|
<p style="margin: 0;padding: 0;font-size: 20px;margin-top: 20px;">
|
||||||
尊敬的#!!#,您好!您已经注册成功,欢迎使用您的专属个人博客平台。
|
尊敬的#!#username#!#,点击下方链接重置密码
|
||||||
</p>
|
</p>
|
||||||
<a style="cursor: pointer;outline: none;text-decoration: none;width: 134px;height: 40px;margin-top: 36px;line-height: 40px;text-align:center;display: inline-block;background: #00C6FF;color: #fff;font-weight: 450;"
|
<a style="cursor: pointer;outline: none;text-decoration: none;width: 134px;height: 40px;margin-top: 36px;line-height: 40px;text-align:center;display: inline-block;background: #00C6FF;color: #fff;font-weight: 450;"
|
||||||
href="https://www.qnforever.top"
|
href="https://www.qnforever.top/resetPwd#!#resetUrl#!#"
|
||||||
target="_blank" rel="noopener">
|
target="_blank" rel="noopener">
|
||||||
访问
|
去重置
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
@@ -101,9 +97,6 @@
|
|||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
|
||||||
<div style="height: 400px;width:800px;margin:0 auto;background: url(https://www.qnforever.top/images/menu/register.png) no-repeat;background-size: 100% 100%;"></div>
|
|
||||||
</tr>
|
|
||||||
<tr>
|
<tr>
|
||||||
<p style="margin: 0 auto;text-align: center;">感谢! © Quinn</p>
|
<p style="margin: 0 auto;text-align: center;">感谢! © Quinn</p>
|
||||||
</tr>
|
</tr>
|
||||||
|
|||||||
@@ -9,27 +9,22 @@
|
|||||||
<body class="bg-dark">
|
<body class="bg-dark">
|
||||||
<main class="container">
|
<main class="container">
|
||||||
<div th:fragment="user_table_refresh" th:id="id_user_table_refresh">
|
<div th:fragment="user_table_refresh" th:id="id_user_table_refresh">
|
||||||
<div class="alert alert-danger" role="alert">
|
<div class="bg-dark">
|
||||||
<a href="/index" class="text-danger text-decoration-none">
|
<a href="/index" class="d-inline col-md-1 mt-2 text-light text-decoration-none">
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-house-fill" viewBox="0 0 16 16">
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-house-fill" viewBox="0 0 16 16">
|
||||||
<path fill-rule="evenodd" d="m8 3.293 6 6V13.5a1.5 1.5 0 0 1-1.5 1.5h-9A1.5 1.5 0 0 1 2 13.5V9.293l6-6zm5-.793V6l-2-2V2.5a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5z"/>
|
<path fill-rule="evenodd" d="m8 3.293 6 6V13.5a1.5 1.5 0 0 1-1.5 1.5h-9A1.5 1.5 0 0 1 2 13.5V9.293l6-6zm5-.793V6l-2-2V2.5a.5.5 0 0 1 .5-.5h1a.5.5 0 0 1 .5.5z"/>
|
||||||
<path fill-rule="evenodd" d="M7.293 1.5a1 1 0 0 1 1.414 0l6.647 6.646a.5.5 0 0 1-.708.708L8 2.207 1.354 8.854a.5.5 0 1 1-.708-.708L7.293 1.5z"/>
|
<path fill-rule="evenodd" d="M7.293 1.5a1 1 0 0 1 1.414 0l6.647 6.646a.5.5 0 0 1-.708.708L8 2.207 1.354 8.854a.5.5 0 1 1-.708-.708L7.293 1.5z"/>
|
||||||
</svg>
|
</svg>
|
||||||
</a>
|
</a>
|
||||||
<span th:each="love:${LoveList}">
|
<input id="findBucket" th:value="${findBucket}" class="d-inline mt-2" placeholder="请输入要查询的表情">
|
||||||
(*  ̄3)(ε ̄ *):
|
<button class="d-inline btn-light mt-2" onclick="navChange(-777)" >
|
||||||
[[${love}]]
|
|
||||||
</span>
|
|
||||||
<input id="findBucket" th:value="${findBucket}" class="mt-2 form-control" placeholder="请输入要查询的表情">
|
|
||||||
<button class="form-control mt-2" onclick="navChange(-777)" >
|
|
||||||
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-search-heart" viewBox="0 0 16 16">
|
<svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-search-heart" viewBox="0 0 16 16">
|
||||||
<path d="M6.5 4.482c1.664-1.673 5.825 1.254 0 5.018-5.825-3.764-1.664-6.69 0-5.018Z"/>
|
<path d="M6.5 4.482c1.664-1.673 5.825 1.254 0 5.018-5.825-3.764-1.664-6.69 0-5.018Z"/>
|
||||||
<path d="M13 6.5a6.471 6.471 0 0 1-1.258 3.844c.04.03.078.062.115.098l3.85 3.85a1 1 0 0 1-1.414 1.415l-3.85-3.85a1.007 1.007 0 0 1-.1-.115h.002A6.5 6.5 0 1 1 13 6.5ZM6.5 12a5.5 5.5 0 1 0 0-11 5.5 5.5 0 0 0 0 11Z"/>
|
<path d="M13 6.5a6.471 6.471 0 0 1-1.258 3.844c.04.03.078.062.115.098l3.85 3.85a1 1 0 0 1-1.414 1.415l-3.85-3.85a1.007 1.007 0 0 1-.1-.115h.002A6.5 6.5 0 1 1 13 6.5ZM6.5 12a5.5 5.5 0 1 0 0-11 5.5 5.5 0 0 0 0 11Z"/>
|
||||||
</svg>
|
</svg>
|
||||||
找一找
|
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="row ml-2">
|
<div class="row mt-3 ml-2">
|
||||||
<div class="col-md-3 pl-2 pt-2 pb-2" th:each="record:${recordList}">
|
<div class="col-md-3 pl-2 pt-2 pb-2" th:each="record:${recordList}">
|
||||||
<img width="250px" height="250px" th:src="${record.getUrl()}"/>
|
<img width="250px" height="250px" th:src="${record.getUrl()}"/>
|
||||||
</div>
|
</div>
|
||||||
@@ -64,8 +59,6 @@
|
|||||||
<script th:src="@{/js/jquery-3.5.1.min.js}"></script>
|
<script th:src="@{/js/jquery-3.5.1.min.js}"></script>
|
||||||
<script th:src="@{/bootstrap/js/bootstrap.bundle.min.js}"></script>
|
<script th:src="@{/bootstrap/js/bootstrap.bundle.min.js}"></script>
|
||||||
<script th:src="@{/js/toTop.js}"></script>
|
<script th:src="@{/js/toTop.js}"></script>
|
||||||
<script th:src="@{/js/jquery-ui.min.js}"></script>
|
|
||||||
<script th:src="@{/live/js/addlive2d.js}"></script>
|
|
||||||
<script type="text/javascript">
|
<script type="text/javascript">
|
||||||
function navChange(page){
|
function navChange(page){
|
||||||
var current = $('#current').text();
|
var current = $('#current').text();
|
||||||
|
|||||||
@@ -13,10 +13,9 @@
|
|||||||
<div class="col-md-4" >
|
<div class="col-md-4" >
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4 mt-5" id='login_box'>
|
<div class="col-md-4 mt-5" id='login_box'>
|
||||||
<form id="registerForm" class="form-horizontal was-validated" method="post" noValidate>
|
<form id="registerForm" class="form-horizontal" method="post" noValidate>
|
||||||
<div class="justify-content-center">
|
<div class="justify-content-center">
|
||||||
<h1>注册<small style="font-size: small">Quinn</small></h1>
|
<h1>注册<small style="font-size: small">Quinn</small></h1>
|
||||||
<p th:text="${registerMsg}" style="color: red"></p>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="form-group">
|
<div class="form-group">
|
||||||
<label for="username">用户名</label>
|
<label for="username">用户名</label>
|
||||||
@@ -85,7 +84,6 @@
|
|||||||
layer.open({ content: '注册码格式不正确', skin: 'msg', time: 2 });
|
layer.open({ content: '注册码格式不正确', skin: 'msg', time: 2 });
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
console.log(123);
|
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: "/checkRegister",
|
url: "/checkRegister",
|
||||||
async: false,
|
async: false,
|
||||||
|
|||||||
61
src/main/resources/templates/resetPwd.html
Normal file
61
src/main/resources/templates/resetPwd.html
Normal file
@@ -0,0 +1,61 @@
|
|||||||
|
<!doctype html>
|
||||||
|
<html lang="en" xmlns:th="http://www.thymeleaf.org">
|
||||||
|
<head>
|
||||||
|
<meta charset="UTF-8">
|
||||||
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||||||
|
<title>注册-Quinn</title>
|
||||||
|
<link rel="stylesheet" th:href="@{/bootstrap/css/bootstrap.min.css}">
|
||||||
|
<link rel="stylesheet" th:href="@{/css/backgroud.css}">
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
<div class="container">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-md-4" >
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4 mt-5" id='login_box'>
|
||||||
|
<form id="registerForm" class="form-horizontal" method="post" noValidate>
|
||||||
|
<div class="justify-content-center">
|
||||||
|
<h1>重置密码<small style="font-size: small">Quinn</small></h1>
|
||||||
|
<p>无法重置,请关注公众号反馈</p>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="password">密码</label>
|
||||||
|
<input id="password" type="password" name="password" class="form-control" placeholder="密码" required>
|
||||||
|
</div>
|
||||||
|
<div class="form-group">
|
||||||
|
<label for="password">确认密码</label>
|
||||||
|
<input id="repassword" type="password" name="repassword" class="form-control" placeholder="确认密码" required>
|
||||||
|
</div>
|
||||||
|
<button class="btn btn-dark btn-block" type="button" onclick="resetPwd();">重置密码</button>
|
||||||
|
<p class="mt-1 clearfix">
|
||||||
|
<a style="color: white" th:href="@{/toLogin}" class="float-right text-decoration-none">已有账号?去登录</a>
|
||||||
|
</p>
|
||||||
|
</form>
|
||||||
|
</div>
|
||||||
|
<div class="col-md-4" >
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
<script th:src="@{/js/jquery-3.5.1.min.js}"></script>
|
||||||
|
<script th:src="@{/bootstrap/js/bootstrap.bundle.min.js}"></script>
|
||||||
|
<script th:src="@{/js/jquery-ui.min.js}"></script>
|
||||||
|
<!--<script th:src="@{/live/js/addlive2d.js}"></script>-->
|
||||||
|
<script th:src="@{/layer/mobile/layer.js}"></script>
|
||||||
|
<script type="text/javascript">
|
||||||
|
function resetPwd(){
|
||||||
|
let password = $('#password').val();
|
||||||
|
let repassword = $('#repassword').val();
|
||||||
|
if (!password){
|
||||||
|
layer.open({ content: '密码不能为空', skin: 'msg', time: 2 });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (repassword != password){
|
||||||
|
layer.open({ content: '两次输入密码不一致', skin: 'msg', time: 2 });
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.disabled = true;
|
||||||
|
$('#registerForm').submit();
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user