diff options
author | Galen Guyer <galen@galenguyer.com> | 2022-12-20 10:27:09 -0500 |
---|---|---|
committer | Galen Guyer <galen@galenguyer.com> | 2022-12-20 10:27:09 -0500 |
commit | 30589fb07c946a65cf738145245ffe6a5311547d (patch) | |
tree | 41426f0d72328b58ad20e1d996e2bcc25730a330 | |
parent | e10d426ba760e44bf7f1dda26ce1a7b2aacbc40c (diff) |
Remove DisplayName, fix login page features crash
-rw-r--r-- | src/components/RecordTable.js | 3 | ||||
-rw-r--r-- | src/routes/Login.js | 6 | ||||
-rw-r--r-- | src/routes/Records.js | 1 | ||||
-rw-r--r-- | src/routes/SignUp.js | 8 |
4 files changed, 8 insertions, 10 deletions
diff --git a/src/components/RecordTable.js b/src/components/RecordTable.js index 1784f45..9a8bbb5 100644 --- a/src/components/RecordTable.js +++ b/src/components/RecordTable.js @@ -38,6 +38,7 @@ function sort(records, direction, smart, column) { } export default function RecordsTable({ + zoneName, records, setAndOpenRecord, deleteRecord, @@ -59,7 +60,7 @@ export default function RecordsTable({ <Button onClick={() => setAndOpenRecord({ - name: '', + name: zoneName, content: '', ttl: 300, type: 'A', diff --git a/src/routes/Login.js b/src/routes/Login.js index facfa5e..459c24e 100644 --- a/src/routes/Login.js +++ b/src/routes/Login.js @@ -50,7 +50,7 @@ function Login(props) { } const checkTotpRequired = debounce((e) => { - if (!features.totp) { + if (!features || !features.totp) { return } fetch('/api/v1/users/totp?email=' + e.target.value).then((res) => { @@ -78,7 +78,7 @@ function Login(props) { <Input id="email" type="email" onChange={checkTotpRequired}></Input> <StyledLabel htmlFor="password">Password</StyledLabel> <Input id="password" type="password" onKeyUp={onKeyPress}></Input> - {features.totp && ( + {features && features.totp && ( <> <StyledLabel htmlFor="totp">TOTP Code</StyledLabel> <Input @@ -99,7 +99,7 @@ function Login(props) { </Button> </AlignRight> <center> - {features.signup && ( + {(!features || features.signup) && ( <p> Don't have an account? <Link to="/signup">Sign up!</Link> </p> diff --git a/src/routes/Records.js b/src/routes/Records.js index 2a21fab..97fe2de 100644 --- a/src/routes/Records.js +++ b/src/routes/Records.js @@ -162,6 +162,7 @@ export function Records() { </h1> {zone && ( <RecordTable + zoneName={zoneName} records={zone} setAndOpenRecord={setAndOpenRecord} deleteRecord={deleteRecord} diff --git a/src/routes/SignUp.js b/src/routes/SignUp.js index 6cce214..869b8e6 100644 --- a/src/routes/SignUp.js +++ b/src/routes/SignUp.js @@ -111,9 +111,7 @@ export function SignUp() { body: JSON.stringify({ email: document.getElementById('email').value.trim(), password: document.getElementById('password').value.trim(), - display_name: - document.getElementById('displayName').value.trim() ?? null, - }), + }) }).then((res) => { if (res.status === 200) { res.json().then((data) => { @@ -161,8 +159,6 @@ export function SignUp() { )} </StyledLabel> <Input id="email" onChange={checkEmailValid} type="email"></Input> - <StyledLabel for="displayName">Display Name</StyledLabel> - <Input id="displayName"></Input> <StyledLabel for="password">Password</StyledLabel> <Input id="password" @@ -199,4 +195,4 @@ export function SignUp() { ) } -export default SignUp +export default SignUp; |