From 40844813ae25e840df63d65bcaaf9e99548e6dff Mon Sep 17 00:00:00 2001 From: Lamarcke Date: Sat, 9 Mar 2024 01:40:14 -0300 Subject: [PATCH] - Add discord login option --- src/components/auth/SuperTokensProvider.tsx | 6 ++--- .../handlers/PreferencesUsernameChanger.tsx | 23 +++++++------------ 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/src/components/auth/SuperTokensProvider.tsx b/src/components/auth/SuperTokensProvider.tsx index 19d523a..a44786f 100755 --- a/src/components/auth/SuperTokensProvider.tsx +++ b/src/components/auth/SuperTokensProvider.tsx @@ -18,9 +18,9 @@ export const frontendConfig = () => { contactMethod: "EMAIL", signInUpFeature: { providers: [ - ThirdPartyPasswordlessReact.Google.init(), - ThirdPartyPasswordlessReact.Github.init(), - ThirdPartyPasswordlessReact.Apple.init(), + // TODO: Enable once it's approved + // ThirdPartyPasswordlessReact.Google.init(), + ThirdPartyPasswordlessReact.Discord.init(), ], }, }), diff --git a/src/components/preferences/handlers/PreferencesUsernameChanger.tsx b/src/components/preferences/handlers/PreferencesUsernameChanger.tsx index d2ff4e3..19bda7c 100644 --- a/src/components/preferences/handlers/PreferencesUsernameChanger.tsx +++ b/src/components/preferences/handlers/PreferencesUsernameChanger.tsx @@ -10,6 +10,7 @@ import { Button, Stack, Text, TextInput, Title } from "@mantine/core"; import { useMutation } from "@tanstack/react-query"; import { ProfileService } from "@/wrapper/server"; import { BaseModalChildrenProps } from "@/util/types/modal-props"; +import { notifications } from "@mantine/notifications"; interface Props extends BaseModalChildrenProps {} @@ -24,16 +25,14 @@ const PreferencesUsernameChanger = ({ onClose }: Props) => { }, onSuccess: () => { profile.invalidate(); + notifications.show({ + color: "green", + message: "Your username has been updated!", + }); if (onClose) onClose(); }, }); - const checkBlockedFromUpdating = useCallback(() => { - // TODO: Implement this check - - return false; - }, []); - const handleSubmit = (evt: FormEvent) => { evt.preventDefault(); const formData = new FormData(evt.currentTarget); @@ -44,12 +43,6 @@ const PreferencesUsernameChanger = ({ onClose }: Props) => { return (
- {checkBlockedFromUpdating() && ( - - You have updated your username in the last 30 days and can't - update it yet. - - )} {profileMutation.isError && ( {profileMutation.error.message} )} @@ -63,13 +56,13 @@ const PreferencesUsernameChanger = ({ onClose }: Props) => { "It must be unique and have at least five characters." } minLength={5} - disabled={checkBlockedFromUpdating()} + defaultValue={profile.data?.username} />