diff --git a/src/modules/tpm/TPMIndexHOC.js b/src/modules/tpm/TPMIndexHOC.js index 773c07ca..654ed8e5 100644 --- a/src/modules/tpm/TPMIndexHOC.js +++ b/src/modules/tpm/TPMIndexHOC.js @@ -24,7 +24,8 @@ export function TPMIndexHOC(WrappedComponent) { isloginCancel: undefined, mygetHelmetapi: null, giteaVisible:false, - email:undefined + email:undefined, + is_sync_pwd:undefined } } @@ -157,10 +158,11 @@ export function TPMIndexHOC(WrappedComponent) { this.props.history.push(`/users/${response.data.login}`); } if(response.data && response.data.login){ - if(response.data.need_edit_info){ + if(!response.data.has_gitea_user || (response.data.has_gitea_user && !response.data.is_sync_pwd)){ this.setState({ giteaVisible:true, - email:response.data.email + email:response.data.email, + is_sync_pwd:response.data.is_sync_pwd }) } } @@ -188,8 +190,11 @@ export function TPMIndexHOC(WrappedComponent) { } onOk =(values)=>{ - let url = `/users/sync_user_info.json`; - const { current_user } = this.state; + 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