@@ -781,6 +801,7 @@ export class SiteForm extends Component {
enable_downvotes: stateSiteForm.enable_downvotes,
application_question: stateSiteForm.application_question,
registration_mode: stateSiteForm.registration_mode,
+ oauth_registration: stateSiteForm.oauth_registration,
require_email_verification: stateSiteForm.require_email_verification,
private_instance: stateSiteForm.private_instance,
default_theme: stateSiteForm.default_theme,
@@ -895,6 +916,11 @@ export class SiteForm extends Component {
i.setState(i.state);
}
+ handleSiteOauthRegistration(i: SiteForm, event: any) {
+ i.state.siteForm.oauth_registration = event.target.checked;
+ i.setState(i.state);
+ }
+
handleSiteCommunityCreationAdminOnly(i: SiteForm, event: any) {
i.state.siteForm.community_creation_admin_only = event.target.checked;
i.setState(i.state);
diff --git a/src/shared/components/person/settings.tsx b/src/shared/components/person/settings.tsx
index ddd13afd2..3e9a27284 100644
--- a/src/shared/components/person/settings.tsx
+++ b/src/shared/components/person/settings.tsx
@@ -519,6 +519,7 @@ export class Settings extends Component {
value={this.state.changePasswordForm.old_password}
onInput={linkEvent(this, this.handleOldPasswordChange)}
label={I18NextService.i18n.t("old_password")}
+ required={false}
/>
@@ -1709,12 +1710,12 @@ export class Settings extends Component {
const { new_password, new_password_verify, old_password } =
i.state.changePasswordForm;
- if (new_password && old_password && new_password_verify) {
+ if (new_password && new_password_verify) {
i.setState({ changePasswordRes: LOADING_REQUEST });
const changePasswordRes = await HttpService.client.changePassword({
new_password,
new_password_verify,
- old_password,
+ old_password: old_password || "",
});
if (changePasswordRes.state === "success") {
snapToTop();
diff --git a/src/shared/routes.ts b/src/shared/routes.ts
index a26c72f2d..f7622a651 100644
--- a/src/shared/routes.ts
+++ b/src/shared/routes.ts
@@ -28,7 +28,11 @@ import {
} from "./components/home/login";
import { LoginReset } from "./components/home/login-reset";
import { Setup } from "./components/home/setup";
-import { Signup } from "./components/home/signup";
+import {
+ Signup,
+ SignupFetchConfig,
+ getSignupQueryParams,
+} from "./components/home/signup";
import {
Modlog,
ModlogFetchConfig,
@@ -75,6 +79,11 @@ import {
import { InitialFetchRequest, RouteData } from "./interfaces";
import { GetSiteResponse } from "lemmy-js-client";
import { Inferno } from "inferno";
+import {
+ OAuthCallback,
+ OAuthCallbackConfig,
+ getOAuthCallbackQueryParams,
+} from "./components/home/oauth/oauth-callback";
export interface IRoutePropsWithFetch<
DataT extends RouteData,
@@ -114,8 +123,9 @@ export const routes: IRoutePropsWithFetch[] = [
},
{
path: `/signup`,
+ getQueryParams: getSignupQueryParams,
component: Signup,
- },
+ } as SignupFetchConfig,
{
path: `/create_post`,
component: CreatePost,
@@ -218,6 +228,11 @@ export const routes: IRoutePropsWithFetch[] = [
path: `/verify_email/:token`,
component: VerifyEmail,
},
+ {
+ path: `/oauth/callback`,
+ getQueryParams: getOAuthCallbackQueryParams,
+ component: OAuthCallback,
+ } as OAuthCallbackConfig,
{
path: `/instances`,
component: Instances,
diff --git a/src/shared/utils/types/oauth.ts b/src/shared/utils/types/oauth.ts
new file mode 100644
index 000000000..60dee9122
--- /dev/null
+++ b/src/shared/utils/types/oauth.ts
@@ -0,0 +1,6 @@
+import { CreateOAuthProvider } from "lemmy-js-client";
+
+export type ProviderToEdit = Omit<
+ CreateOAuthProvider,
+ "client_id" | "client_secret"
+>;