Skip to content
This repository has been archived by the owner on Jan 2, 2023. It is now read-only.

Commit

Permalink
Merge pull request #242 from SCCapstone/152-Springbootmail-user-verif…
Browse files Browse the repository at this point in the history
…ication

verify.tsx didn't get pushed in last commit
  • Loading branch information
afrederiksen authored Apr 3, 2022
2 parents 17a2f5f + 9b1a587 commit 439171d
Show file tree
Hide file tree
Showing 2 changed files with 120 additions and 0 deletions.
28 changes: 28 additions & 0 deletions frontend/src/pages/Verify.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
.MP {
text-align: center;
}

.MP-logo {
height: 40vmin;
pointer-events: none;
}

.MP-header {
background-color: #282c34;
min-height: 100vh;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
font-size: calc(10px + 2vmin);
color: white;
}

@keyframes MP-logo-spin {
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
}
92 changes: 92 additions & 0 deletions frontend/src/pages/Verify.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
import './Verify.css';

import {
IonApp,
IonButton,
IonCard,
IonCardContent,
IonCardHeader,
IonCardSubtitle,
IonCardTitle,
IonCol,
IonContent,
IonGrid,
IonLabel,
IonPage,
IonRouterLink,
IonRow,
IonText,
} from '@ionic/react';

import { Link, Router, Switch } from "react-router-dom";
import history from '../History';
import SideBar from '../components/SideBar';
import Header from '../components/Header';

import { useContext, useEffect, useState } from 'react';
import Context from '../components/Context';
import React from 'react';
import { verify } from 'crypto';
import axios from 'axios';

// const DOMAIN = "https://api.fridger.recipes"
const DOMAIN = "http://localhost:8080/"

//This is the page the email verifiction will send you to
function Verify() {
const context = useContext(Context);

const queryParam = new URLSearchParams(window.location.search);
const code = queryParam.get("code");

let runIt = 0;
console.log(code);

let hasChanged = false;

interface retString {
success: boolean
}

//D7dsErtnwX2OhXKPSCNtKquf57WLGL53ILolnoEFRCgPIfVaY34UqFjyjbswsvsQ

function reDirect(ms: number) {
return new Promise( resolve => setTimeout(resolve, ms) );
}

const [stringBody, setStringBody] = React.useState<retString>({
success: false
});
// useEffect(() => {
// The link you are emailed will send you here
const getVerified = () => {
fetch(DOMAIN+`v1/auth/verify?code=${code}`)
.then(data => data.json())
.then(yo => setStringBody(yo));
console.log(stringBody)

}
useEffect(() => {
getVerified();
}, [hasChanged])

//this means verifiation is successful!
return (
<Router history={history}>
<Switch>
<IonApp>
<SideBar/>
<IonPage className="ion-page" id="main-content">
<Header/>
<IonContent className="ion-padding">
<h1>Thank you for verifiying your account! Your account has now been activated!</h1>
</IonContent>
</IonPage>
</IonApp>
</Switch>
</Router>
)

}

export default Verify;

0 comments on commit 439171d

Please sign in to comment.