From 1f430c3b48103417953014543c2669f33b9d7a2f Mon Sep 17 00:00:00 2001 From: fanxb Date: Sun, 2 Feb 2020 00:30:54 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E5=8E=BB=E6=8E=89=E6=B3=A8=E5=86=8C?= =?UTF-8?q?=E6=97=B6=E7=9A=84=E9=AA=8C=E8=AF=81=E7=A0=81=E8=A6=81=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../business/user/service/UserService.java | 9 -- .../pages/public/RegisterOrReset/index.jsx | 99 ++++++++++++++----- 2 files changed, 75 insertions(+), 33 deletions(-) diff --git a/bookMarkService/business/user/src/main/java/com/fanxb/bookmark/business/user/service/UserService.java b/bookMarkService/business/user/src/main/java/com/fanxb/bookmark/business/user/service/UserService.java index 0686ffd..a78c8bb 100644 --- a/bookMarkService/business/user/src/main/java/com/fanxb/bookmark/business/user/service/UserService.java +++ b/bookMarkService/business/user/src/main/java/com/fanxb/bookmark/business/user/service/UserService.java @@ -81,15 +81,6 @@ public class UserService { * @date 2019/7/6 11:30 */ public void register(RegisterBody body) { - String codeKey = Constant.authCodeKey(body.getEmail()); - String realCode = RedisUtil.get(codeKey, String.class); - if (Constant.isDev) { - realCode = "123456"; - } - if (StringUtil.isEmpty(realCode) || (!realCode.equals(body.getAuthCode()))) { - throw new FormDataException("验证码错误"); - } - RedisUtil.delete(codeKey); User user = userDao.selectByUsernameOrEmail(body.getUsername(), body.getEmail()); if (user != null) { if (user.getUsername().equals(body.getUsername())) { diff --git a/front/src/pages/public/RegisterOrReset/index.jsx b/front/src/pages/public/RegisterOrReset/index.jsx index f107282..bacc205 100644 --- a/front/src/pages/public/RegisterOrReset/index.jsx +++ b/front/src/pages/public/RegisterOrReset/index.jsx @@ -1,7 +1,11 @@ import React from "react"; import IconFont from "../../../components/IconFont"; import { Button, Input, message } from "antd"; -import { LoginLayout, REGISTER_TYPE, RESET_PASSWORD_TYPE } from "../../../layout/LoginLayout"; +import { + LoginLayout, + REGISTER_TYPE, + RESET_PASSWORD_TYPE +} from "../../../layout/LoginLayout"; import styles from "./index.module.less"; import axios from "../../../util/httpUtil"; @@ -109,16 +113,28 @@ export default class Register extends React.Component { * 提交表单 */ submit = () => { - const { current, username, email, password, repassword, authCode } = this.state; + const { + current, + username, + email, + password, + repassword, + authCode + } = this.state; let form = { username, email, password, authCode }; if (current === REGISTER_TYPE && !this.checkParam("username", username)) { return; } + if ( + current === RESET_PASSWORD_TYPE && + !this.checkParam("authCode", authCode) + ) { + return; + } const isOk = this.checkParam("email", email) && this.checkParam("password", password) && - this.checkParam("repassword", repassword) && - this.checkParam("authCode", authCode); + this.checkParam("repassword", repassword); if (!isOk) { return; } @@ -146,7 +162,18 @@ export default class Register extends React.Component { }; render() { - const { current, username, email, password, repassword, authCode, authCodeText, isCountDown, errorText, isLoading } = this.state; + const { + current, + username, + email, + password, + repassword, + authCode, + authCodeText, + isCountDown, + errorText, + isLoading + } = this.state; return (
@@ -158,7 +185,9 @@ export default class Register extends React.Component { name="username" value={username} onChange={this.changeData} - addonBefore={} + addonBefore={ + + } placeholder="用户名" /> ) : null} @@ -168,7 +197,9 @@ export default class Register extends React.Component { name="email" value={email} onChange={this.changeData} - addonBefore={} + addonBefore={ + + } placeholder="邮箱" /> } + addonBefore={ + + } placeholder="密码" /> } + addonBefore={ + + } placeholder="重复密码" /> - } - addonAfter={ - - {authCodeText} - - } - placeholder="验证码" - /> -