mirror of
https://github.com/openziti/zrok.git
synced 2025-02-22 13:11:11 +01:00
rough and ugly verification check (#50)
This commit is contained in:
parent
6190ac0c60
commit
c5838a118d
@ -1,7 +1,57 @@
|
||||
import { useParams } from 'react-router-dom';
|
||||
import {useEffect, useState} from "react";
|
||||
import * as identity from "./api/identity";
|
||||
|
||||
const Proceed = (props) => {
|
||||
return (
|
||||
<div>
|
||||
<h1>Register a new zrok account!</h1>
|
||||
<h3>{props.email}</h3>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
const Failed = () => {
|
||||
return (
|
||||
<div>
|
||||
<h1>No such account request!</h1>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
const Register = () => {
|
||||
const { token } = useParams();
|
||||
const [email, setEmail] = useState();
|
||||
const [failed, setFailed] = useState(false);
|
||||
|
||||
useEffect(() => {
|
||||
let mounted = true
|
||||
identity.verify({body: {token: token}}).then(resp => {
|
||||
console.log("resp", resp)
|
||||
if(mounted) {
|
||||
if(resp.error) {
|
||||
setFailed(true);
|
||||
} else {
|
||||
setEmail(resp.data.email);
|
||||
}
|
||||
}
|
||||
}).catch(err => {
|
||||
console.log("err", err);
|
||||
if(mounted) {
|
||||
setFailed(true);
|
||||
}
|
||||
});
|
||||
return () => {
|
||||
mounted = false;
|
||||
}
|
||||
}, []);
|
||||
|
||||
let step;
|
||||
if(!failed) {
|
||||
step = <Proceed email={email}/>
|
||||
} else {
|
||||
step = <Failed />
|
||||
}
|
||||
|
||||
return (
|
||||
<div className={"zrok"}>
|
||||
@ -11,7 +61,7 @@ const Register = () => {
|
||||
<p className={"header-title"}>zrok</p>
|
||||
</div>
|
||||
<div className={"main"}>
|
||||
<h1>Register a new zrok account!</h1>
|
||||
{step}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
Loading…
Reference in New Issue
Block a user