-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
171 additions
and
189 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
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
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
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
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
82 changes: 0 additions & 82 deletions
82
Parlance.ClientApp/src/components/modals/account/LoginPasswordResetModal.jsx
This file was deleted.
Oops, something went wrong.
57 changes: 57 additions & 0 deletions
57
Parlance.ClientApp/src/components/modals/account/LoginPasswordResetModal.tsx
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 |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import Modal from "../../Modal"; | ||
import React, { useState } from "react"; | ||
import LoginUsernameModal from "./LoginUsernameModal"; | ||
import UserManager from "../../../helpers/UserManager"; | ||
import { useTranslation } from "react-i18next"; | ||
import LineEdit from "../../LineEdit"; | ||
|
||
export function LoginPasswordResetModal() { | ||
const [password, setPassword] = useState(""); | ||
const [confirmPassword, setConfirmPassword] = useState(""); | ||
const { t } = useTranslation(); | ||
|
||
return ( | ||
<Modal | ||
heading={t("RESET_PASSWORD")} | ||
buttons={[ | ||
{ | ||
text: t("CANCEL"), | ||
onClick: () => Modal.mount(<LoginUsernameModal />), | ||
}, | ||
{ | ||
text: t("OK"), | ||
onClick: () => { | ||
if (password !== confirmPassword) { | ||
return; | ||
} | ||
|
||
UserManager.setLoginDetail("newPassword", password); | ||
UserManager.attemptLogin(); | ||
}, | ||
}, | ||
]} | ||
> | ||
<div style={{ display: "flex", flexDirection: "column" }}> | ||
{t("LOG_IN_PASSWORD_RESET_PROMPT_1")} | ||
{t("PASSWORD_SET_SECURITY_PROMPT")} | ||
<LineEdit | ||
password={true} | ||
placeholder={t("PASSWORD")} | ||
value={password} | ||
onChange={e => | ||
setPassword((e.target as HTMLInputElement).value) | ||
} | ||
/> | ||
<LineEdit | ||
password={true} | ||
type={"password"} | ||
placeholder={t("CONFIRM_PASSWORD")} | ||
value={confirmPassword} | ||
onChange={e => | ||
setConfirmPassword((e.target as HTMLInputElement).value) | ||
} | ||
/> | ||
</div> | ||
</Modal> | ||
); | ||
} |
6 changes: 3 additions & 3 deletions
6
.../account/LoginSecurityKeyFailureModal.jsx → .../account/LoginSecurityKeyFailureModal.tsx
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
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
4 changes: 2 additions & 2 deletions
4
Parlance.ClientApp/src/components/modals/account/LoginUsernameModal.tsx
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
62 changes: 0 additions & 62 deletions
62
Parlance.ClientApp/src/components/modals/account/resets/EmailResetModal.jsx
This file was deleted.
Oops, something went wrong.
57 changes: 57 additions & 0 deletions
57
Parlance.ClientApp/src/components/modals/account/resets/EmailResetModal.tsx
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 |
---|---|---|
@@ -0,0 +1,57 @@ | ||
import { useState } from "react"; | ||
import Modal from "../../../Modal"; | ||
import { PasswordResetModal } from "./PasswordResetModal"; | ||
import UserManager from "../../../../helpers/UserManager"; | ||
import { useTranslation } from "react-i18next"; | ||
import LineEdit from "../../../../components/LineEdit"; | ||
import { VerticalSpacer } from "@/components/Layouts"; | ||
import { | ||
PasswordResetMethod, | ||
PasswordResetMethodEmail, | ||
} from "@/interfaces/users"; | ||
|
||
export function EmailResetModal({ | ||
method, | ||
resetMethods, | ||
}: { | ||
method: PasswordResetMethodEmail; | ||
resetMethods: PasswordResetMethod[]; | ||
}) { | ||
const [email, setEmail] = useState(""); | ||
const { t } = useTranslation(); | ||
|
||
return ( | ||
<Modal | ||
heading={t("PASSWORD_RECOVERY_TITLE")} | ||
buttons={[ | ||
{ | ||
text: t("BACK"), | ||
onClick: () => | ||
Modal.mount( | ||
<PasswordResetModal resetMethods={resetMethods} />, | ||
), | ||
}, | ||
{ | ||
text: t("RESET_PASSWORD"), | ||
onClick: () => | ||
UserManager.performPasswordReset("email", { | ||
email: email, | ||
}), | ||
}, | ||
]} | ||
> | ||
<div style={{ display: "flex", flexDirection: "column" }}> | ||
{t("PASSWORD_RECOVERY_EMAIL_PROMPT_1")} | ||
<VerticalSpacer height={3} /> | ||
<LineEdit | ||
type={"text"} | ||
placeholder={`${method.user}∙∙∙@${method.domain}∙∙∙`} | ||
value={email} | ||
onChange={e => | ||
setEmail((e.target as HTMLInputElement).value) | ||
} | ||
/> | ||
</div> | ||
</Modal> | ||
); | ||
} |
Oops, something went wrong.