-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* email input and submit button * fixed indentation errors * update Forgot password to match other requests * fixing lint errors --------- Co-authored-by: Kevin Monisit <[email protected]>
- Loading branch information
1 parent
254592c
commit 1952bcb
Showing
2 changed files
with
58 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,39 +1,40 @@ | ||
import React, { useState } from "react"; | ||
// import { Container, Grid, createMuiTheme, ThemeProvider} from "@material-ui/core"; | ||
import { Container, Grid } from "@material-ui/core"; | ||
import { Container, Grid, createMuiTheme, ThemeProvider} from "@material-ui/core"; | ||
//import { Container, Grid } from "@material-ui/core"; | ||
import Alert from "@material-ui/lab/Alert"; | ||
import { Link } from "react-router-dom"; | ||
import { Redirect } from "react-router-dom"; | ||
import AuthForm from "../library/AuthForm"; | ||
import ColorButton from "../library/ColorButton"; | ||
// import WhiteTextField from "../library/WhiteTextField"; | ||
import WhiteTextField from "../library/WhiteTextField"; | ||
import PropTypes from "prop-types"; | ||
// import { theme } from "../Defaults"; | ||
import { theme } from "../Defaults"; | ||
|
||
/** | ||
* Forgot my password application for "/forgot" | ||
*/ | ||
// const color_theme = createMuiTheme({ | ||
|
||
// overrides: { | ||
// palette: { | ||
// primary: { | ||
// main: theme.primary[1].trim(), | ||
// }, | ||
// secondary: { | ||
// main: theme.secondary[1].trim(), | ||
// }, | ||
// }, | ||
// MuiInputLabel: { | ||
// root: { | ||
// color: "white", | ||
// "&$focused": { | ||
// color: "white" | ||
// } | ||
// } | ||
// } | ||
// } | ||
// }); | ||
const color_theme = createMuiTheme({ | ||
|
||
overrides: { | ||
palette: { | ||
primary: { | ||
main: theme.primary[1].trim(), | ||
}, | ||
secondary: { | ||
main: theme.secondary[1].trim(), | ||
}, | ||
}, | ||
MuiInputLabel: { | ||
root: { | ||
color: "white", | ||
"&$focused": { | ||
color: "white" | ||
} | ||
} | ||
} | ||
} | ||
}); | ||
|
||
|
||
|
||
const ForgotPage = (props) => { | ||
|
@@ -42,23 +43,22 @@ const ForgotPage = (props) => { | |
const [done, setDone] = useState(false); | ||
const [errors, setErrors] = useState(""); | ||
|
||
const onSubmit = (e) => { | ||
const onSubmit = async (e) => { | ||
e.preventDefault(); | ||
if (!loading) { | ||
setLoading(true); | ||
setErrors(""); | ||
let email = document.getElementById("email").value; | ||
props.profile.Forgot(email) | ||
.then((msg) => { | ||
if (msg.error) { | ||
setLoading(false); | ||
setErrors(msg.error); | ||
} else { | ||
setLoading(false); | ||
setDone(true); | ||
setErrors(""); | ||
} | ||
}); | ||
let msg = await props.profile.Forgot(email); | ||
if (msg.error) { | ||
setLoading(false); | ||
setErrors(msg.error); | ||
} else { | ||
setLoading(false); | ||
setDone(true); | ||
setErrors(""); | ||
} | ||
|
||
} | ||
}; | ||
|
||
|
@@ -102,7 +102,7 @@ const ForgotPage = (props) => { | |
spacing={2}> | ||
<Grid item | ||
xs={12}> | ||
{/* <ThemeProvider theme={color_theme}> | ||
{<ThemeProvider theme={color_theme}> | ||
<WhiteTextField | ||
variant="outlined" | ||
autofocus | ||
|
@@ -114,14 +114,15 @@ const ForgotPage = (props) => { | |
autoComplete="email" | ||
size="small" | ||
/> | ||
</ThemeProvider> */} | ||
</ThemeProvider> } | ||
{/* | ||
<div> | ||
Please reach out to [email protected] to reset password | ||
</div> | ||
</div>*/} | ||
</Grid> | ||
<Grid item | ||
xs={12}> | ||
{/* <ThemeProvider theme={color_theme}> | ||
{<ThemeProvider theme={color_theme}> | ||
<ColorButton | ||
size = "small" | ||
type="submit" | ||
|
@@ -131,7 +132,8 @@ const ForgotPage = (props) => { | |
Submit | ||
</ColorButton> | ||
|
||
</ThemeProvider> */} | ||
</ThemeProvider> } | ||
{/* | ||
<a href="mailto:[email protected]?subject=[HackRU Password Reset]" | ||
target="_blank" | ||
rel="noopener noreferrer"> | ||
|
@@ -143,7 +145,8 @@ const ForgotPage = (props) => { | |
color="primary"> | ||
Email Us | ||
</ColorButton> | ||
</a> | ||
</a>*/} | ||
</Grid> | ||
<Grid item | ||
xs={12}> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters