From 54dbb26b71f7d5df16a66d3d530cfc4fad26a0dd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 19 Jul 2019 22:04:41 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/user/FindPasswordComponent.js | 37 +++++++++++++++---- .../modules/user/LoginRegisterComponent.js | 3 ++ 2 files changed, 32 insertions(+), 8 deletions(-) diff --git a/public/react/src/modules/user/FindPasswordComponent.js b/public/react/src/modules/user/FindPasswordComponent.js index 8feabd068..14b95e1b7 100644 --- a/public/react/src/modules/user/FindPasswordComponent.js +++ b/public/react/src/modules/user/FindPasswordComponent.js @@ -153,14 +153,14 @@ class LoginRegisterComponent extends Component { if (this.state.Phonenumberisnotcobool === false) { if (this.state.login.length === 0) { this.setState({ - Phonenumberisnotco:"请输入正确的手机号或邮箱", + Phonenumberisnotco:"请输入正确的邮箱或手机号", }) return } } if (this.state.login === undefined|| this.state.login.length ===0 || this.state.login === "") { this.setState({ - Phonenumberisnotco:"请输入登录手机号码或邮箱", + Phonenumberisnotco:"请输入正确的邮箱或手机号", }) return } @@ -173,23 +173,23 @@ class LoginRegisterComponent extends Component { } if (this.state.password === undefined || this.state.password.length ===0 || this.state.password === "") { this.setState({ - Phonenumberisnotcosmmm:"请输入密码", + Phonenumberisnotcosmmm:"密码不能为空", }) return } if (this.state.passwords === undefined || this.state.passwords.length ===0 || this.state.passwords === "") { this.setState({ - Phonenumberisnotcosymmmm:"请输入二次密码" + Phonenumberisnotcosymmmm:"二次密码不能为空" }) return } if (this.state.password !== this.state.passwords==="") { - this.openNotification(`两次密码不相同`); + this.openNotification(`两次输入的密码不一致`); return } if (this.state.codes === undefined|| this.state.codes.length ===0 || this.state.codes === "") { this.setState({ - Phonenumberisnotcosyzm:"请输入验证码" + Phonenumberisnotcosyzm:"验证码不能为空" }) return } @@ -202,8 +202,29 @@ class LoginRegisterComponent extends Component { }).then((result) => { // console.log(result); //登录成功,会生成session - this.openNotification("找回密码成功,请重新登入。"); - window.location.href = "/login" + if(result){ + if(result.data.status===-2){ + if(result.data.message==="验证码不正确"){ + this.setState({ + Phonenumberisnotcosyzm:"验证码不正确", + }) + + return; + }else if(result.data.message==="验证码已失效"){ + this.setState({ + Phonenumberisnotcosyzm:"验证码不正确", + }) + + return; + }else { + this.openNotification(result.data.message); + return; + } + }else { + this.openNotification("找回密码成功,请重新登入。"); + window.location.href = "/login" + } + } }).catch((error) => { }) diff --git a/public/react/src/modules/user/LoginRegisterComponent.js b/public/react/src/modules/user/LoginRegisterComponent.js index 9bc49828f..2c485bda4 100644 --- a/public/react/src/modules/user/LoginRegisterComponent.js +++ b/public/react/src/modules/user/LoginRegisterComponent.js @@ -298,6 +298,9 @@ class LoginRegisterComponent extends Component { Phonenumberisnotcosyzm:"验证码不正确", }) + return; + }else { + this.openNotification(result.data.message); return; } }else {