Updating totp_2fa names.

This commit is contained in:
Dessalines 2023-03-02 18:26:33 -05:00
parent 388d089d9d
commit dce0f66190
4 changed files with 16 additions and 16 deletions

View file

@ -45,7 +45,7 @@
"inferno-server": "^8.0.6", "inferno-server": "^8.0.6",
"isomorphic-cookie": "^1.2.4", "isomorphic-cookie": "^1.2.4",
"jwt-decode": "^3.1.2", "jwt-decode": "^3.1.2",
"lemmy-js-client": "0.17.2-rc.2", "lemmy-js-client": "0.17.2-rc.3",
"markdown-it": "^13.0.1", "markdown-it": "^13.0.1",
"markdown-it-container": "^3.0.0", "markdown-it-container": "^3.0.0",
"markdown-it-footnote": "^3.0.3", "markdown-it-footnote": "^3.0.3",

View file

@ -26,7 +26,7 @@ interface State {
form: { form: {
username_or_email?: string; username_or_email?: string;
password?: string; password?: string;
totp_token?: string; totp_2fa_token?: string;
}; };
loginLoading: boolean; loginLoading: boolean;
showTotp: boolean; showTotp: boolean;
@ -160,7 +160,7 @@ export class Login extends Component<any, State> {
id="login-totp-token" id="login-totp-token"
pattern="[0-9]*" pattern="[0-9]*"
autoComplete="one-time-code" autoComplete="one-time-code"
value={this.state.form.totp_token} value={this.state.form.totp_2fa_token}
onInput={linkEvent(this, this.handleLoginTotpChange)} onInput={linkEvent(this, this.handleLoginTotpChange)}
/> />
</div> </div>
@ -184,12 +184,12 @@ export class Login extends Component<any, State> {
let lForm = i.state.form; let lForm = i.state.form;
let username_or_email = lForm.username_or_email; let username_or_email = lForm.username_or_email;
let password = lForm.password; let password = lForm.password;
let totp_token = lForm.totp_token; let totp_2fa_token = lForm.totp_2fa_token;
if (username_or_email && password) { if (username_or_email && password) {
let form: LoginI = { let form: LoginI = {
username_or_email, username_or_email,
password, password,
totp_token, totp_2fa_token,
}; };
WebSocketService.Instance.send(wsClient.login(form)); WebSocketService.Instance.send(wsClient.login(form));
} }
@ -201,7 +201,7 @@ export class Login extends Component<any, State> {
} }
handleLoginTotpChange(i: Login, event: any) { handleLoginTotpChange(i: Login, event: any) {
i.state.form.totp_token = event.target.value; i.state.form.totp_2fa_token = event.target.value;
i.setState(i.state); i.setState(i.state);
} }

View file

@ -86,7 +86,7 @@ interface SettingsState {
show_read_posts?: boolean; show_read_posts?: boolean;
show_new_post_notifs?: boolean; show_new_post_notifs?: boolean;
discussion_languages?: number[]; discussion_languages?: number[];
generate_totp?: boolean; generate_totp_2fa?: boolean;
}; };
changePasswordForm: { changePasswordForm: {
new_password?: string; new_password?: string;
@ -857,7 +857,7 @@ export class Settings extends Component<any, SettingsState> {
totpSection() { totpSection() {
let totpUrl = let totpUrl =
UserService.Instance.myUserInfo?.local_user_view.local_user.totp_url; UserService.Instance.myUserInfo?.local_user_view.local_user.totp_2fa_url;
return ( return (
<> <>
@ -868,7 +868,7 @@ export class Settings extends Component<any, SettingsState> {
className="form-check-input" className="form-check-input"
id="user-generate-totp" id="user-generate-totp"
type="checkbox" type="checkbox"
checked={this.state.saveUserSettingsForm.generate_totp} checked={this.state.saveUserSettingsForm.generate_totp_2fa}
onChange={linkEvent(this, this.handleGenerateTotp)} onChange={linkEvent(this, this.handleGenerateTotp)}
/> />
<label className="form-check-label" htmlFor="user-generate-totp"> <label className="form-check-label" htmlFor="user-generate-totp">
@ -892,7 +892,7 @@ export class Settings extends Component<any, SettingsState> {
id="user-remove-totp" id="user-remove-totp"
type="checkbox" type="checkbox"
checked={ checked={
this.state.saveUserSettingsForm.generate_totp == false this.state.saveUserSettingsForm.generate_totp_2fa == false
} }
onChange={linkEvent(this, this.handleRemoveTotp)} onChange={linkEvent(this, this.handleRemoveTotp)}
/> />
@ -1077,14 +1077,14 @@ export class Settings extends Component<any, SettingsState> {
if (checked) { if (checked) {
toast(i18n.t("two_factor_setup_instructions")); toast(i18n.t("two_factor_setup_instructions"));
} }
i.state.saveUserSettingsForm.generate_totp = checked; i.state.saveUserSettingsForm.generate_totp_2fa = checked;
i.setState(i.state); i.setState(i.state);
} }
handleRemoveTotp(i: Settings, event: any) { handleRemoveTotp(i: Settings, event: any) {
// Coerce true to undefined here, so it won't generate it. // Coerce true to undefined here, so it won't generate it.
let checked: boolean | undefined = !event.target.checked && undefined; let checked: boolean | undefined = !event.target.checked && undefined;
i.state.saveUserSettingsForm.generate_totp = checked; i.state.saveUserSettingsForm.generate_totp_2fa = checked;
i.setState(i.state); i.setState(i.state);
} }

View file

@ -5403,10 +5403,10 @@ leac@^0.6.0:
resolved "https://registry.yarnpkg.com/leac/-/leac-0.6.0.tgz#dcf136e382e666bd2475f44a1096061b70dc0912" resolved "https://registry.yarnpkg.com/leac/-/leac-0.6.0.tgz#dcf136e382e666bd2475f44a1096061b70dc0912"
integrity sha512-y+SqErxb8h7nE/fiEX07jsbuhrpO9lL8eca7/Y1nuWV2moNlXhyd59iDGcRf6moVyDMbmTNzL40SUyrFU/yDpg== integrity sha512-y+SqErxb8h7nE/fiEX07jsbuhrpO9lL8eca7/Y1nuWV2moNlXhyd59iDGcRf6moVyDMbmTNzL40SUyrFU/yDpg==
lemmy-js-client@0.17.2-rc.2: lemmy-js-client@0.17.2-rc.3:
version "0.17.2-rc.2" version "0.17.2-rc.3"
resolved "https://registry.yarnpkg.com/lemmy-js-client/-/lemmy-js-client-0.17.2-rc.2.tgz#c2b045742c44992ec563c75a17cc1c7ebbb385eb" resolved "https://registry.yarnpkg.com/lemmy-js-client/-/lemmy-js-client-0.17.2-rc.3.tgz#dc2a33e9228aef260b03a6e1f55698a2f975f979"
integrity sha512-Nsb0CnQ8JA8KlhDxb4Tri1QTT8l+4KMjbh17hBmMTjXzlSbo0xDyGBzF60Z2ffKu1ZPPll1ncO2tJeqCroin6w== integrity sha512-FlWEPMrW2Q/FbtihLOHq2YtcRuoX7700LweCnsm6R6dD6SzsnWy9nKJhn24fcjcR2o6tw0oZKgP0ccq9jPDgfQ==
dependencies: dependencies:
node-fetch "2.6.6" node-fetch "2.6.6"