X-Git-Url: http://these/git/?a=blobdiff_plain;f=src%2Fshared%2Fcomponents%2Fperson%2Fsettings.tsx;h=d024aae222b80081fa9941401443cfdc25353173;hb=b7ec7ae3110c560968e0cb24a32f1fe9166eec29;hp=1ef95f5a5dd02cc3e29c5d30ebdd54d1a4a2c9a3;hpb=0fee7cba3b63bcd9854215e5b545e657b1a82efa;p=lemmy-ui.git diff --git a/src/shared/components/person/settings.tsx b/src/shared/components/person/settings.tsx index 1ef95f5..d024aae 100644 --- a/src/shared/components/person/settings.tsx +++ b/src/shared/components/person/settings.tsx @@ -29,7 +29,7 @@ import { SortType, } from "lemmy-js-client"; import { elementUrl, emDash, relTags } from "../../config"; -import { FirstLoadService, UserService } from "../../services"; +import { UserService } from "../../services"; import { HttpService, RequestState } from "../../services/HttpService"; import { I18NextService, languages } from "../../services/I18NextService"; import { setupTippy } from "../../tippy"; @@ -40,6 +40,7 @@ import { ImageUploadForm } from "../common/image-upload-form"; import { LanguageSelect } from "../common/language-select"; import { ListingTypeSelect } from "../common/listing-type-select"; import { MarkdownTextArea } from "../common/markdown-textarea"; +import PasswordInput from "../common/password-input"; import { SearchableSelect } from "../common/searchable-select"; import { SortSelect } from "../common/sort-select"; import Tabs from "../common/tabs"; @@ -170,8 +171,6 @@ export class Settings extends Component { this.handleBlockPerson = this.handleBlockPerson.bind(this); this.handleBlockCommunity = this.handleBlockCommunity.bind(this); - FirstLoadService.isFirstLoad; - const mui = UserService.Instance.myUserInfo; if (mui) { const { @@ -318,61 +317,32 @@ export class Settings extends Component { changePasswordHtmlForm() { return ( <> -
{I18NextService.i18n.t("change_password")}
+

{I18NextService.i18n.t("change_password")}

-
- -
- -
+
+
-
- -
- -
+
+
-
- -
- -
+
+

-
+ {this.state.deleteAccountShowConfirm && ( <> -
+
- + )} -
+ ); @@ -1177,8 +1157,12 @@ export class Settings extends Component { ...i.state.saveUserSettingsForm, auth: myAuthRequired(), }); + if (saveRes.state === "success") { - UserService.Instance.login(saveRes.data); + UserService.Instance.login({ + res: saveRes.data, + showToast: false, + }); toast(I18NextService.i18n.t("saved")); window.scrollTo(0, 0); } @@ -1200,7 +1184,10 @@ export class Settings extends Component { auth: myAuthRequired(), }); if (changePasswordRes.state === "success") { - UserService.Instance.login(changePasswordRes.data); + UserService.Instance.login({ + res: changePasswordRes.data, + showToast: false, + }); window.scrollTo(0, 0); toast(I18NextService.i18n.t("password_changed")); } @@ -1217,7 +1204,8 @@ export class Settings extends Component { i.setState(s => ((s.deleteAccountForm.password = event.target.value), s)); } - async handleDeleteAccount(i: Settings) { + async handleDeleteAccount(i: Settings, event: Event) { + event.preventDefault(); const password = i.state.deleteAccountForm.password; if (password) { i.setState({ deleteAccountRes: { state: "loading" } });