@mblaney/holster-browser 1.1.0 → 2.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +48 -3
- package/package.json +1 -1
- package/src/components/Login.jsx +56 -80
- package/src/components/LoginCodes.jsx +1 -5
- package/src/components/Register.jsx +70 -89
- package/src/components/RequestCode.jsx +27 -41
- package/src/components/ResetPassword.jsx +34 -52
- package/src/components/SearchAppBar.jsx +30 -2
- package/src/components/Settings.jsx +5 -7
- package/src/components/Signup.jsx +141 -0
- package/src/components/UpdatePassword.jsx +83 -80
- package/src/components/ValidateEmail.jsx +10 -22
- package/src/components/__tests__/Signup.test.jsx +191 -0
- package/src/index.js +1 -1
- package/src/utils/serviceWorkerRegistration.js +0 -88
|
@@ -12,6 +12,7 @@ import Switch from "@mui/material/Switch"
|
|
|
12
12
|
import Toolbar from "@mui/material/Toolbar"
|
|
13
13
|
import Typography from "@mui/material/Typography"
|
|
14
14
|
import AccountCircleIcon from "@mui/icons-material/AccountCircle"
|
|
15
|
+
import ClearIcon from "@mui/icons-material/Clear"
|
|
15
16
|
import DarkModeIcon from "@mui/icons-material/DarkMode"
|
|
16
17
|
import LightModeIcon from "@mui/icons-material/LightMode"
|
|
17
18
|
import MoreIcon from "@mui/icons-material/MoreVert"
|
|
@@ -56,7 +57,7 @@ const StyledInputBase = styled(InputBase, {
|
|
|
56
57
|
})(({theme, collapsed}) => ({
|
|
57
58
|
color: "inherit",
|
|
58
59
|
"& .MuiInputBase-input": {
|
|
59
|
-
padding: theme.spacing(1,
|
|
60
|
+
padding: theme.spacing(1, 4, 1, 0),
|
|
60
61
|
paddingLeft: `calc(1em + ${theme.spacing(4)})`,
|
|
61
62
|
transition: theme.transitions.create("width"),
|
|
62
63
|
width: collapsed ? 0 : "100%",
|
|
@@ -93,6 +94,12 @@ const SearchAppBar = ({
|
|
|
93
94
|
const [anchorEl, setAnchorEl] = useState(null)
|
|
94
95
|
const [mobileMoreAnchorEl, setMobileMoreAnchorEl] = useState(null)
|
|
95
96
|
|
|
97
|
+
const handleClear = () => {
|
|
98
|
+
setSearchValue("")
|
|
99
|
+
onSearch?.("")
|
|
100
|
+
searchInputRef.current?.focus()
|
|
101
|
+
}
|
|
102
|
+
|
|
96
103
|
const isMenuOpen = Boolean(anchorEl)
|
|
97
104
|
const isMobileMenuOpen = Boolean(mobileMoreAnchorEl)
|
|
98
105
|
|
|
@@ -233,6 +240,10 @@ const SearchAppBar = ({
|
|
|
233
240
|
onKeyDown={e => {
|
|
234
241
|
if (e.key === "Enter") {
|
|
235
242
|
const trimmed = searchValue.trim()
|
|
243
|
+
if (trimmed === "") {
|
|
244
|
+
if (onSearch) onSearch("")
|
|
245
|
+
return
|
|
246
|
+
}
|
|
236
247
|
if (trimmed.length >= 3) {
|
|
237
248
|
setSearchValue(trimmed)
|
|
238
249
|
if (onSearch) {
|
|
@@ -240,7 +251,6 @@ const SearchAppBar = ({
|
|
|
240
251
|
} else {
|
|
241
252
|
window.location = `/?search=${encodeURIComponent(trimmed)}`
|
|
242
253
|
}
|
|
243
|
-
searchInputRef.current?.blur()
|
|
244
254
|
}
|
|
245
255
|
} else if (e.key === "Escape") {
|
|
246
256
|
setSearchValue("")
|
|
@@ -249,6 +259,24 @@ const SearchAppBar = ({
|
|
|
249
259
|
}
|
|
250
260
|
}}
|
|
251
261
|
/>
|
|
262
|
+
{searchValue && (
|
|
263
|
+
<IconButton
|
|
264
|
+
size="small"
|
|
265
|
+
aria-label="clear search"
|
|
266
|
+
onClick={event => {
|
|
267
|
+
event.stopPropagation()
|
|
268
|
+
handleClear()
|
|
269
|
+
}}
|
|
270
|
+
sx={{
|
|
271
|
+
position: "absolute",
|
|
272
|
+
right: 4,
|
|
273
|
+
top: "50%",
|
|
274
|
+
transform: "translateY(-50%)",
|
|
275
|
+
}}
|
|
276
|
+
>
|
|
277
|
+
<ClearIcon fontSize="small" />
|
|
278
|
+
</IconButton>
|
|
279
|
+
)}
|
|
252
280
|
</Search>
|
|
253
281
|
<Box sx={{display: {xs: "none", md: "flex"}}}>
|
|
254
282
|
<Switch checked={mode === "dark"} onChange={changeMode} />
|
|
@@ -51,9 +51,7 @@ const Settings = ({user, mode, setMode, appBar, buildDate, children}) => {
|
|
|
51
51
|
|
|
52
52
|
return (
|
|
53
53
|
<>
|
|
54
|
-
{user.is &&
|
|
55
|
-
<SearchAppBar mode={mode} setMode={setMode} {...appBar} />
|
|
56
|
-
)}
|
|
54
|
+
{user.is && <SearchAppBar mode={mode} setMode={setMode} {...appBar} />}
|
|
57
55
|
<Container maxWidth="sm">
|
|
58
56
|
<Grid container>
|
|
59
57
|
<Grid item xs={12}>
|
|
@@ -76,8 +74,6 @@ const Settings = ({user, mode, setMode, appBar, buildDate, children}) => {
|
|
|
76
74
|
variant="outlined"
|
|
77
75
|
fullWidth={true}
|
|
78
76
|
margin="normal"
|
|
79
|
-
value={password}
|
|
80
|
-
onChange={event => setPassword(event.target.value)}
|
|
81
77
|
>
|
|
82
78
|
<InputLabel htmlFor="settings-password">
|
|
83
79
|
Current Password
|
|
@@ -86,6 +82,8 @@ const Settings = ({user, mode, setMode, appBar, buildDate, children}) => {
|
|
|
86
82
|
id="settings-password"
|
|
87
83
|
autoComplete="password"
|
|
88
84
|
type={showPassword ? "text" : "password"}
|
|
85
|
+
value={password}
|
|
86
|
+
onChange={event => setPassword(event.target.value)}
|
|
89
87
|
endAdornment={
|
|
90
88
|
<InputAdornment position="end">
|
|
91
89
|
<IconButton
|
|
@@ -104,8 +102,6 @@ const Settings = ({user, mode, setMode, appBar, buildDate, children}) => {
|
|
|
104
102
|
variant="outlined"
|
|
105
103
|
fullWidth={true}
|
|
106
104
|
margin="normal"
|
|
107
|
-
value={newPassword}
|
|
108
|
-
onChange={event => setNewPassword(event.target.value)}
|
|
109
105
|
>
|
|
110
106
|
<InputLabel htmlFor="settings-new-password">
|
|
111
107
|
New Password
|
|
@@ -114,6 +110,8 @@ const Settings = ({user, mode, setMode, appBar, buildDate, children}) => {
|
|
|
114
110
|
id="settings-new-password"
|
|
115
111
|
autoComplete="new-password"
|
|
116
112
|
type={showNewPassword ? "text" : "password"}
|
|
113
|
+
value={newPassword}
|
|
114
|
+
onChange={event => setNewPassword(event.target.value)}
|
|
117
115
|
endAdornment={
|
|
118
116
|
<InputAdornment position="end">
|
|
119
117
|
<IconButton
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import {useState} from "react"
|
|
2
|
+
import Button from "@mui/material/Button"
|
|
3
|
+
import FormControl from "@mui/material/FormControl"
|
|
4
|
+
import IconButton from "@mui/material/IconButton"
|
|
5
|
+
import InputAdornment from "@mui/material/InputAdornment"
|
|
6
|
+
import InputLabel from "@mui/material/InputLabel"
|
|
7
|
+
import OutlinedInput from "@mui/material/OutlinedInput"
|
|
8
|
+
import TextField from "@mui/material/TextField"
|
|
9
|
+
import Typography from "@mui/material/Typography"
|
|
10
|
+
import Visibility from "@mui/icons-material/Visibility"
|
|
11
|
+
import VisibilityOff from "@mui/icons-material/VisibilityOff"
|
|
12
|
+
|
|
13
|
+
const Signup = ({user}) => {
|
|
14
|
+
const [username, setUsername] = useState("")
|
|
15
|
+
const [password, setPassword] = useState("")
|
|
16
|
+
const [showPassword, setShowPassword] = useState(false)
|
|
17
|
+
const [email, setEmail] = useState("")
|
|
18
|
+
const [message, setMessage] = useState(user.is ? "Already logged in" : "")
|
|
19
|
+
const [disabledButton, setDisabledButton] = useState(!!user.is)
|
|
20
|
+
|
|
21
|
+
const signup = () => {
|
|
22
|
+
if (!username) {
|
|
23
|
+
setMessage("Please choose a username")
|
|
24
|
+
return
|
|
25
|
+
}
|
|
26
|
+
if (!/^\w+$/.test(username)) {
|
|
27
|
+
setMessage("Username must contain only numbers, letters and underscore")
|
|
28
|
+
return
|
|
29
|
+
}
|
|
30
|
+
if (!email) {
|
|
31
|
+
setMessage("Please provide your email")
|
|
32
|
+
return
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
setDisabledButton(true)
|
|
36
|
+
setMessage("Creating account...")
|
|
37
|
+
|
|
38
|
+
user.create(username, password, err => {
|
|
39
|
+
if (err) {
|
|
40
|
+
setDisabledButton(false)
|
|
41
|
+
setMessage(err)
|
|
42
|
+
return
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
user.auth(username, password, async err => {
|
|
46
|
+
if (err) {
|
|
47
|
+
setDisabledButton(false)
|
|
48
|
+
setMessage(err)
|
|
49
|
+
return
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
const signed = await user.SEA.sign(
|
|
53
|
+
{username, email, timestamp: Date.now()},
|
|
54
|
+
user.is,
|
|
55
|
+
)
|
|
56
|
+
fetch(`${window.location.origin}/signup`, {
|
|
57
|
+
method: "POST",
|
|
58
|
+
headers: {"Content-Type": "application/json;charset=utf-8"},
|
|
59
|
+
body: JSON.stringify({
|
|
60
|
+
pub: user.is.pub,
|
|
61
|
+
epub: user.is.epub,
|
|
62
|
+
signed,
|
|
63
|
+
}),
|
|
64
|
+
})
|
|
65
|
+
.then(res => res.text().then(text => ({ok: res.ok, text: text})))
|
|
66
|
+
.then(res => {
|
|
67
|
+
setDisabledButton(false)
|
|
68
|
+
if (!res.ok) {
|
|
69
|
+
user.delete(username, password, console.log)
|
|
70
|
+
setMessage(res.text)
|
|
71
|
+
return
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
setMessage("Account created")
|
|
75
|
+
window.location = "/login"
|
|
76
|
+
})
|
|
77
|
+
})
|
|
78
|
+
})
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
return (
|
|
82
|
+
<>
|
|
83
|
+
<Typography variant="h5">Sign up</Typography>
|
|
84
|
+
<TextField
|
|
85
|
+
id="signup-username"
|
|
86
|
+
label="Username"
|
|
87
|
+
variant="outlined"
|
|
88
|
+
fullWidth={true}
|
|
89
|
+
margin="normal"
|
|
90
|
+
value={username}
|
|
91
|
+
onChange={event => setUsername(event.target.value)}
|
|
92
|
+
slotProps={{inputLabel: {shrink: true}}}
|
|
93
|
+
/>
|
|
94
|
+
<FormControl variant="outlined" fullWidth={true} margin="normal">
|
|
95
|
+
<InputLabel htmlFor="signup-password">Password</InputLabel>
|
|
96
|
+
<OutlinedInput
|
|
97
|
+
id="signup-password"
|
|
98
|
+
type={showPassword ? "text" : "password"}
|
|
99
|
+
value={password}
|
|
100
|
+
onChange={event => setPassword(event.target.value)}
|
|
101
|
+
endAdornment={
|
|
102
|
+
<InputAdornment position="end">
|
|
103
|
+
<IconButton
|
|
104
|
+
aria-label="toggle password visibility"
|
|
105
|
+
onClick={() => setShowPassword(show => !show)}
|
|
106
|
+
edge="end"
|
|
107
|
+
>
|
|
108
|
+
{showPassword ? <VisibilityOff /> : <Visibility />}
|
|
109
|
+
</IconButton>
|
|
110
|
+
</InputAdornment>
|
|
111
|
+
}
|
|
112
|
+
label="Password"
|
|
113
|
+
/>
|
|
114
|
+
</FormControl>
|
|
115
|
+
<TextField
|
|
116
|
+
id="signup-email"
|
|
117
|
+
label="Email"
|
|
118
|
+
variant="outlined"
|
|
119
|
+
fullWidth={true}
|
|
120
|
+
margin="normal"
|
|
121
|
+
value={email}
|
|
122
|
+
onChange={event => setEmail(event.target.value)}
|
|
123
|
+
/>
|
|
124
|
+
<Button
|
|
125
|
+
sx={{mt: 1}}
|
|
126
|
+
variant="contained"
|
|
127
|
+
disabled={disabledButton}
|
|
128
|
+
onClick={signup}
|
|
129
|
+
>
|
|
130
|
+
Submit
|
|
131
|
+
</Button>
|
|
132
|
+
{message && (
|
|
133
|
+
<Typography sx={{m: 1}} variant="string">
|
|
134
|
+
{message}
|
|
135
|
+
</Typography>
|
|
136
|
+
)}
|
|
137
|
+
</>
|
|
138
|
+
)
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
export default Signup
|
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import {useState} from "react"
|
|
2
2
|
import Button from "@mui/material/Button"
|
|
3
|
-
import Card from "@mui/material/Card"
|
|
4
|
-
import CardContent from "@mui/material/CardContent"
|
|
5
|
-
import Container from "@mui/material/Container"
|
|
6
3
|
import FormControl from "@mui/material/FormControl"
|
|
7
|
-
import Grid from "@mui/material/Grid"
|
|
8
4
|
import IconButton from "@mui/material/IconButton"
|
|
9
5
|
import InputAdornment from "@mui/material/InputAdornment"
|
|
10
6
|
import InputLabel from "@mui/material/InputLabel"
|
|
@@ -13,21 +9,13 @@ import TextField from "@mui/material/TextField"
|
|
|
13
9
|
import Typography from "@mui/material/Typography"
|
|
14
10
|
import Visibility from "@mui/icons-material/Visibility"
|
|
15
11
|
import VisibilityOff from "@mui/icons-material/VisibilityOff"
|
|
16
|
-
import SearchAppBar from "./SearchAppBar.jsx"
|
|
17
12
|
|
|
18
|
-
const UpdatePassword = ({
|
|
19
|
-
user,
|
|
20
|
-
loggedIn,
|
|
21
|
-
current,
|
|
22
|
-
code,
|
|
23
|
-
reset,
|
|
24
|
-
mode,
|
|
25
|
-
setMode,
|
|
26
|
-
appBar,
|
|
27
|
-
}) => {
|
|
13
|
+
const UpdatePassword = ({user, loggedIn, current, code, reset}) => {
|
|
28
14
|
const [name, setName] = useState(current ?? "")
|
|
29
|
-
const [
|
|
30
|
-
const [
|
|
15
|
+
const [newPassword, setNewPassword] = useState("")
|
|
16
|
+
const [showNewPassword, setShowNewPassword] = useState(false)
|
|
17
|
+
const [repeatPassword, setRepeatPassword] = useState("")
|
|
18
|
+
const [showRepeatPassword, setShowRepeatPassword] = useState(false)
|
|
31
19
|
const [message, setMessage] = useState(loggedIn ? "Already logged in" : "")
|
|
32
20
|
const [disabledButton, setDisabledButton] = useState(loggedIn)
|
|
33
21
|
|
|
@@ -40,7 +28,7 @@ const UpdatePassword = ({
|
|
|
40
28
|
setDisabledButton(true)
|
|
41
29
|
setMessage("Updating password...")
|
|
42
30
|
|
|
43
|
-
user.create(username,
|
|
31
|
+
user.create(username, newPassword, err => {
|
|
44
32
|
if (err) {
|
|
45
33
|
if (err === "Username already exists") {
|
|
46
34
|
let match = username.match(/^(\w+)\.(\d)$/)
|
|
@@ -62,9 +50,10 @@ const UpdatePassword = ({
|
|
|
62
50
|
return
|
|
63
51
|
}
|
|
64
52
|
|
|
65
|
-
user.auth(username,
|
|
53
|
+
user.auth(username, newPassword, err => {
|
|
66
54
|
if (err) {
|
|
67
55
|
setDisabledButton(false)
|
|
56
|
+
user.delete(username, newPassword)
|
|
68
57
|
setMessage(err)
|
|
69
58
|
return
|
|
70
59
|
}
|
|
@@ -85,7 +74,7 @@ const UpdatePassword = ({
|
|
|
85
74
|
.then(res => {
|
|
86
75
|
if (!res.ok) {
|
|
87
76
|
setDisabledButton(false)
|
|
88
|
-
user.delete(username,
|
|
77
|
+
user.delete(username, newPassword)
|
|
89
78
|
setMessage(res.text)
|
|
90
79
|
return
|
|
91
80
|
}
|
|
@@ -107,69 +96,83 @@ const UpdatePassword = ({
|
|
|
107
96
|
})
|
|
108
97
|
}
|
|
109
98
|
|
|
99
|
+
const submit = () => {
|
|
100
|
+
if (newPassword !== repeatPassword) {
|
|
101
|
+
setMessage("Passwords do not match")
|
|
102
|
+
return
|
|
103
|
+
}
|
|
104
|
+
update(name)
|
|
105
|
+
}
|
|
106
|
+
|
|
110
107
|
return (
|
|
111
108
|
<>
|
|
112
|
-
|
|
113
|
-
|
|
109
|
+
<Typography variant="h5">Update Password</Typography>
|
|
110
|
+
<TextField
|
|
111
|
+
id="update-username"
|
|
112
|
+
label="Username"
|
|
113
|
+
variant="outlined"
|
|
114
|
+
fullWidth={true}
|
|
115
|
+
margin="normal"
|
|
116
|
+
value={name}
|
|
117
|
+
onChange={event => setName(event.target.value)}
|
|
118
|
+
/>
|
|
119
|
+
<FormControl variant="outlined" fullWidth={true} margin="normal">
|
|
120
|
+
<InputLabel htmlFor="update-new-password">New Password</InputLabel>
|
|
121
|
+
<OutlinedInput
|
|
122
|
+
id="update-new-password"
|
|
123
|
+
type={showNewPassword ? "text" : "password"}
|
|
124
|
+
value={newPassword}
|
|
125
|
+
onChange={event => setNewPassword(event.target.value)}
|
|
126
|
+
endAdornment={
|
|
127
|
+
<InputAdornment position="end">
|
|
128
|
+
<IconButton
|
|
129
|
+
aria-label="toggle new password visibility"
|
|
130
|
+
onClick={() => setShowNewPassword(show => !show)}
|
|
131
|
+
edge="end"
|
|
132
|
+
>
|
|
133
|
+
{showNewPassword ? <VisibilityOff /> : <Visibility />}
|
|
134
|
+
</IconButton>
|
|
135
|
+
</InputAdornment>
|
|
136
|
+
}
|
|
137
|
+
label="New Password"
|
|
138
|
+
/>
|
|
139
|
+
</FormControl>
|
|
140
|
+
<FormControl variant="outlined" fullWidth={true} margin="normal">
|
|
141
|
+
<InputLabel htmlFor="update-repeat-password">
|
|
142
|
+
Repeat Password
|
|
143
|
+
</InputLabel>
|
|
144
|
+
<OutlinedInput
|
|
145
|
+
id="update-repeat-password"
|
|
146
|
+
type={showRepeatPassword ? "text" : "password"}
|
|
147
|
+
value={repeatPassword}
|
|
148
|
+
onChange={event => setRepeatPassword(event.target.value)}
|
|
149
|
+
endAdornment={
|
|
150
|
+
<InputAdornment position="end">
|
|
151
|
+
<IconButton
|
|
152
|
+
aria-label="toggle repeat password visibility"
|
|
153
|
+
onClick={() => setShowRepeatPassword(show => !show)}
|
|
154
|
+
edge="end"
|
|
155
|
+
>
|
|
156
|
+
{showRepeatPassword ? <VisibilityOff /> : <Visibility />}
|
|
157
|
+
</IconButton>
|
|
158
|
+
</InputAdornment>
|
|
159
|
+
}
|
|
160
|
+
label="Repeat Password"
|
|
161
|
+
/>
|
|
162
|
+
</FormControl>
|
|
163
|
+
<Button
|
|
164
|
+
sx={{mt: 1}}
|
|
165
|
+
variant="contained"
|
|
166
|
+
disabled={disabledButton}
|
|
167
|
+
onClick={submit}
|
|
168
|
+
>
|
|
169
|
+
Submit
|
|
170
|
+
</Button>
|
|
171
|
+
{message && (
|
|
172
|
+
<Typography sx={{m: 1}} variant="string">
|
|
173
|
+
{message}
|
|
174
|
+
</Typography>
|
|
114
175
|
)}
|
|
115
|
-
<Container maxWidth="sm">
|
|
116
|
-
<Grid container>
|
|
117
|
-
<Grid item xs={12}>
|
|
118
|
-
<Card sx={{mt: 2}}>
|
|
119
|
-
<CardContent>
|
|
120
|
-
<Typography variant="h5">Update Password</Typography>
|
|
121
|
-
<TextField
|
|
122
|
-
id="update-username"
|
|
123
|
-
label="Username"
|
|
124
|
-
variant="outlined"
|
|
125
|
-
fullWidth={true}
|
|
126
|
-
margin="normal"
|
|
127
|
-
value={name}
|
|
128
|
-
onChange={event => setName(event.target.value)}
|
|
129
|
-
/>
|
|
130
|
-
<FormControl
|
|
131
|
-
variant="outlined"
|
|
132
|
-
fullWidth={true}
|
|
133
|
-
margin="normal"
|
|
134
|
-
value={password}
|
|
135
|
-
onChange={event => setPassword(event.target.value)}
|
|
136
|
-
>
|
|
137
|
-
<InputLabel htmlFor="update-password">Password</InputLabel>
|
|
138
|
-
<OutlinedInput
|
|
139
|
-
id="update-password"
|
|
140
|
-
type={showPassword ? "text" : "password"}
|
|
141
|
-
endAdornment={
|
|
142
|
-
<InputAdornment position="end">
|
|
143
|
-
<IconButton
|
|
144
|
-
aria-label="toggle password visibility"
|
|
145
|
-
onClick={() => setShowPassword(show => !show)}
|
|
146
|
-
edge="end"
|
|
147
|
-
>
|
|
148
|
-
{showPassword ? <VisibilityOff /> : <Visibility />}
|
|
149
|
-
</IconButton>
|
|
150
|
-
</InputAdornment>
|
|
151
|
-
}
|
|
152
|
-
label="Password"
|
|
153
|
-
/>
|
|
154
|
-
</FormControl>
|
|
155
|
-
<Button
|
|
156
|
-
sx={{mt: 1}}
|
|
157
|
-
variant="contained"
|
|
158
|
-
disabled={disabledButton}
|
|
159
|
-
onClick={() => update(name)}
|
|
160
|
-
>
|
|
161
|
-
Submit
|
|
162
|
-
</Button>
|
|
163
|
-
{message && (
|
|
164
|
-
<Typography sx={{m: 1}} variant="string">
|
|
165
|
-
{message}
|
|
166
|
-
</Typography>
|
|
167
|
-
)}
|
|
168
|
-
</CardContent>
|
|
169
|
-
</Card>
|
|
170
|
-
</Grid>
|
|
171
|
-
</Grid>
|
|
172
|
-
</Container>
|
|
173
176
|
</>
|
|
174
177
|
)
|
|
175
178
|
}
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
import {useState} from "react"
|
|
2
2
|
import Button from "@mui/material/Button"
|
|
3
|
-
import Container from "@mui/material/Container"
|
|
4
|
-
import Grid from "@mui/material/Grid"
|
|
5
3
|
import Typography from "@mui/material/Typography"
|
|
6
|
-
import SearchAppBar from "./SearchAppBar.jsx"
|
|
7
4
|
|
|
8
|
-
const ValidateEmail = ({
|
|
5
|
+
const ValidateEmail = ({code, validate}) => {
|
|
9
6
|
const [message, setMessage] = useState("Validate your email address:")
|
|
10
7
|
const [disabledButton, setDisabledButton] = useState(false)
|
|
11
8
|
|
|
@@ -35,24 +32,15 @@ const ValidateEmail = ({loggedIn, mode, setMode, appBar, code, validate}) => {
|
|
|
35
32
|
|
|
36
33
|
return (
|
|
37
34
|
<>
|
|
38
|
-
{
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
variant="contained"
|
|
48
|
-
disabled={disabledButton}
|
|
49
|
-
onClick={validateEmail}
|
|
50
|
-
>
|
|
51
|
-
Validate
|
|
52
|
-
</Button>
|
|
53
|
-
</Grid>
|
|
54
|
-
</Grid>
|
|
55
|
-
</Container>
|
|
35
|
+
<Typography sx={{m: 1}}>{message}</Typography>
|
|
36
|
+
<Button
|
|
37
|
+
sx={{mt: 1}}
|
|
38
|
+
variant="contained"
|
|
39
|
+
disabled={disabledButton}
|
|
40
|
+
onClick={validateEmail}
|
|
41
|
+
>
|
|
42
|
+
Validate
|
|
43
|
+
</Button>
|
|
56
44
|
</>
|
|
57
45
|
)
|
|
58
46
|
}
|