邮箱绑定

This commit is contained in:
caishi 2021-03-19 09:33:22 +08:00 committed by caishi
parent 22ccc3c974
commit 146d4c9baa
3 changed files with 39 additions and 2 deletions

View File

@ -3,4 +3,9 @@
}
.ant-modal-wrap{
z-index: 1032;
}
.ant-modal-wrap{
.ant-form-explain{
position: absolute;
}
}

View File

@ -35,14 +35,19 @@ function EducoderAccount({form , visible , onOk , email}){
>
<div>
<p className="mb15 edu-txt-center" style={{maxWidth:"350px",margin:"0px auto"}}>
为确保您能正常使用平台功能请确认以下信息:
{
email ?
`平台已检测到您已绑定邮箱${email},请您确认如下操作`
:
"平台已检测到您未绑定邮箱,为不影响使用协同开发功能,请先绑定邮箱"
}
</p>
<Form {...layout}>
<Form.Item label="邮箱">
{getFieldDecorator("email",{
rules:[{required:true,message:"请输入邮箱账号"}]
})(
<Input placeholder="请输入您的邮箱账号" width="220px"/>
<Input placeholder="请输入您的邮箱账号" width="220px" disabled={email}/>
)}
</Form.Item>
<Form.Item label="密码">

View File

@ -7,6 +7,8 @@ import './TPMIndex.css';
import LoginDialog from '../login/LoginDialog';
import EducoderAccount from '../../forge/Component/EducoderAccount';
import ProfileModal from '../../forge/Component/ProfileModal/Index';
// import AccountProfile from '../user/AccountProfile';
// import AccountPhoneemail from '../user/AccountPhoneemail';
export function TPMIndexHOC(WrappedComponent) {
return class II extends React.Component {
@ -168,6 +170,12 @@ export function TPMIndexHOC(WrappedComponent) {
})
}
}
if(!response.data.has_gitea_user){
this.setState({
giteaVisible:true,
email:response.data.email
})
}
}
}).catch((error) => {
console.log(error)
@ -215,6 +223,25 @@ export function TPMIndexHOC(WrappedComponent) {
}
onOk =(values)=>{
let url = `/accounts/gitea_regsiter.json`;
const { email , current_user } = this.state;
if(email){
url = `/register.json`;
}
axios.post(url,{
login:current_user && current_user.login,
...values
}).then(result=>{
if(result && result.data && result.data.status === 1){
this.setState({
giteaVisible:false,
email:undefined
})
window.location.reload();
}
}).catch(error=>{})
}
render() {
let { isRender , current_user , giteaVisible , email , completeProfile , showCP } = this.state;
const common = {