forked from Gitlink/forgeplus-react
代码冲突
This commit is contained in:
parent
f5fa45e1ce
commit
29f37b9760
|
@ -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 (
|
||||
<div className="indexHOC">
|
||||
<EducoderAccount visible={giteaVisible} email={email} onOk={this.onOk}/>
|
||||
{isRender === true ? <LoginDialog
|
||||
Modifyloginvalue={() => this.hideLoginDialog()}
|
||||
{...this.props}
|
||||
|
|
Loading…
Reference in New Issue