Skip to content

Commit

Permalink
add resend button on sorry page
Browse files Browse the repository at this point in the history
  • Loading branch information
cmayeux05 committed May 3, 2024
1 parent 0cde9b3 commit 1990d75
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 6 deletions.
8 changes: 4 additions & 4 deletions client/src/views/TeacherLogin/CreateAccount.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ export default function AccountCreate() {
.then((response) => {

setUserSession(response.data.jwt, JSON.stringify(response.data.user));
console.log(getConfirmed());
//console.log(getConfirmed());
setLoading(false);
if (response.data.user.role.name === 'Content Creator') {

Expand All @@ -81,12 +81,12 @@ export default function AccountCreate() {
};

};
console.log('Super admins:', superEmails);
console.log(superEmails[1]);
//console.log('Super admins:', superEmails);
//console.log(superEmails[1]);
for (var i = 0; i < superEmails.length; i++){
sendEmailConfirmationEmail(email.value, superEmails[i])
.then(response => {
console.log('hihihi');
//console.log('hihihi');
})
};
})
Expand Down
34 changes: 33 additions & 1 deletion client/src/views/TeacherLogin/Sorry.jsx
Original file line number Diff line number Diff line change
@@ -1,14 +1,46 @@
import React from "react"
import {React, useEffect} from "react"
import NavBar from "../../components/NavBar/NavBar"
import "./Sorry.less"
import { getSupers } from "../../Utils/AuthRequests"
import { sendEmailConfirmationEmail } from "../../Utils/requests"


export default function Sorry(props) {
const superEmails = []
const myUser = JSON.parse(sessionStorage.user)

useEffect( () => {

console.log(myUser)
getSupers()
.then(response => {
//console.log(response.data)
for (var i = 0; i < response.data.length; i++){
if (response.data[i].isActive) {
superEmails.push(response.data[i].email);
};
//console.log(superEmails)
};
})

}, [])

const resendEmail = () => {
for (var i = 0; i < superEmails.length; i++){
sendEmailConfirmationEmail(myUser.email, superEmails[i])
.then(response => {
//console.log('hihihi');
})
}
}

return (
<div className="container nav-padding">
<NavBar />
<div id="about-content-container">
<h1 id="title">Hey! Looks like your account is not confirmed. Please ask a "STRAPI SUPER ADMIN" to
check their email for a confirmation code.</h1>
<h2>If you wish to resend a confirmation email, click <a href='#' onClick={resendEmail}>here</a></h2>

</div>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
"name": "Apache 2.0",
"url": "https://www.apache.org/licenses/LICENSE-2.0.html"
},
"x-generation-date": "04/28/2024 5:57:00 PM"
"x-generation-date": "05/03/2024 5:18:24 PM"
},
"x-strapi-config": {
"path": "/documentation",
Expand Down

0 comments on commit 1990d75

Please sign in to comment.