aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGalen Guyer <galen@galenguyer.com>2022-06-02 23:19:35 -0400
committerGalen Guyer <galen@galenguyer.com>2022-06-03 08:27:45 -0400
commit69a689fbb406f05634a38d1f2b02e05eb3c78bb1 (patch)
tree27cc21631960ad814dc637cc255ee6574f1c2c9f
parent84a119a974959e5da0d7024fc9f49cca94e926e8 (diff)
on't do anything with totp if the feature is off
-rw-r--r--src/routes/Login.js9
1 files changed, 7 insertions, 2 deletions
diff --git a/src/routes/Login.js b/src/routes/Login.js
index 85e0f88..243c4af 100644
--- a/src/routes/Login.js
+++ b/src/routes/Login.js
@@ -98,6 +98,9 @@ function Login(props) {
};
const checkTotpRequired = debounce((e) => {
+ if (!features.totp) {
+ return;
+ }
fetch("/api/v1/users/totp?email=" + e.target.value).then((res) => {
if (res.status === 200) {
res.json().then((data) => {
@@ -124,8 +127,10 @@ function Login(props) {
<Input id="email" type="email" onChange={checkTotpRequired}></Input>
<StyledLabel for="password">Password</StyledLabel>
<Input id="password" type="password" onKeyUp={onKeyPress}></Input>
- <StyledLabel for="totp">TOTP Code</StyledLabel>
- <Input id="totp" disabled={!totpRequired} placeholder={totpRequired?"":"Not Required"}></Input>
+ {features.totp && <>
+ <StyledLabel for="totp">TOTP Code</StyledLabel>
+ <Input id="totp" disabled={!totpRequired} placeholder={totpRequired ? "" : "Not Required"}></Input>
+ </>}
<AlignRight>
{/* <Button secondary>Cancel</Button> */}
<Button onClick={handleSubmit} primary>