From 29f37b97608622cef51ca7ab1a27e746fb10ebea Mon Sep 17 00:00:00 2001 From: caishi <1149225589@qq.com> Date: Fri, 26 Mar 2021 10:04:01 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BB=A3=E7=A0=81=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/modules/tpm/TPMIndexHOC.js | 37 +++++++++++++++++++++++++++++++++- 1 file changed, 36 insertions(+), 1 deletion(-) diff --git a/src/modules/tpm/TPMIndexHOC.js b/src/modules/tpm/TPMIndexHOC.js index 0a1d1c48b..1ca19cc78 100644 --- a/src/modules/tpm/TPMIndexHOC.js +++ b/src/modules/tpm/TPMIndexHOC.js @@ -8,6 +8,8 @@ import './TPMIndex.css'; import LoginDialog from '../login/LoginDialog'; import AccountProfile from '../user/AccountProfile'; import AccountPhoneemail from '../user/AccountPhoneemail'; +import EducoderAccount from '../../forge/Component/EducoderAccount'; + export function TPMIndexHOC(WrappedComponent) { return class II extends React.Component { @@ -28,6 +30,9 @@ export function TPMIndexHOC(WrappedComponent) { dataquerys: {}, isloginCancel: undefined, mygetHelmetapi: null, + giteaVisible:false, + email:undefined, + is_sync_pwd:undefined } } @@ -165,6 +170,15 @@ export function TPMIndexHOC(WrappedComponent) { if (this.props.match.path === "/" && response.data.login) { this.props.history.push(`/users/${response.data.login}`); } + if(response.data && response.data.login){ + if(!response.data.has_gitea_user || (response.data.has_gitea_user && !response.data.is_sync_pwd)){ + this.setState({ + giteaVisible:true, + email:response.data.email, + is_sync_pwd:response.data.is_sync_pwd + }) + } + } } }).catch((error) => { console.log(error) @@ -332,6 +346,26 @@ export function TPMIndexHOC(WrappedComponent) { } } } + onOk =(values)=>{ + let url = `/accounts/gitea_register.json`; + const { email , current_user , is_sync_pwd } = this.state; + if(email && !is_sync_pwd){ + url = `/users/change_password.json`; + } + axios.post(url,{ + login:current_user && current_user.login, + ...values + }).then(result=>{ + if(result && result.data && result.data.status === 0){ + this.setState({ + giteaVisible:false, + email:undefined + }) + window.location.reload(); + } + }).catch(error=>{}) + } + //跳转道描点的地方 scrollToAnchor = (anchorName) => { @@ -346,7 +380,7 @@ export function TPMIndexHOC(WrappedComponent) { } render() { - let { Footerdown, isRender, AccountProfiletype, AccountPhoneemailtype, current_user } = this.state; + let { email , giteaVisible , Footerdown, isRender, AccountProfiletype, AccountPhoneemailtype, current_user } = this.state; const common = { showLoginDialog: this.showLoginDialog, @@ -372,6 +406,7 @@ export function TPMIndexHOC(WrappedComponent) { }; return (