fix: login with credential (#2183)
This commit is contained in:
+14
-1
@@ -1,6 +1,6 @@
|
||||
# CHANGELOG
|
||||
|
||||
## [0.2.7-beta.0](https://github.com/RSSNext/follow/compare/v0.2.0-beta.2...v0.2.7-beta.0) (2024-12-12)
|
||||
## [0.2.7-beta.1](https://github.com/RSSNext/follow/compare/v0.2.7-beta.0...v0.2.7-beta.1) (2024-12-16)
|
||||
|
||||
|
||||
### Bug Fixes
|
||||
@@ -13,6 +13,7 @@
|
||||
* add changelog ([4de6355](https://github.com/RSSNext/follow/commit/4de6355bb77ae7b00416be6827a5b71a3a724dfa))
|
||||
* add cleaner cron impl ([faae74b](https://github.com/RSSNext/follow/commit/faae74b8ba465a240bcdd40de33e446bc0799c41))
|
||||
* add deps for integration cmds ([#1696](https://github.com/RSSNext/follow/issues/1696)) ([1353d4b](https://github.com/RSSNext/follow/commit/1353d4bfc552c20fdcfc9723a4cafb9ef47c769d))
|
||||
* add electron as root package deps ([4cde1ac](https://github.com/RSSNext/follow/commit/4cde1acbf027e75a955afed49bda100bf83aac38))
|
||||
* add entryId to deps, try fix `isActive` judge ([76fc17e](https://github.com/RSSNext/follow/commit/76fc17eddf1137fb9af227b5a951d62ce4e7cc58))
|
||||
* add feed and feed list overlap ([6395d22](https://github.com/RSSNext/follow/commit/6395d223750d06d6a73e8bef4f5081cdf8d7c46a))
|
||||
* add manifest to purge cache ([2f8dc0b](https://github.com/RSSNext/follow/commit/2f8dc0bc8561ebf9bb40160de8658eac799b31b0))
|
||||
@@ -35,11 +36,13 @@
|
||||
* app upgrade toast open link should in new window ([fc81546](https://github.com/RSSNext/follow/commit/fc81546bed6b07626215a57543a735001728f520))
|
||||
* app upgraded toast href error ([#1444](https://github.com/RSSNext/follow/issues/1444)) ([c875d69](https://github.com/RSSNext/follow/commit/c875d697b2a1cd9e49f3c91397531a82928e1bc8))
|
||||
* app version ([c5854f4](https://github.com/RSSNext/follow/commit/c5854f45795bf6cb78a9d24f05678fe548ceba06))
|
||||
* article render container responsive width ([cae7fa6](https://github.com/RSSNext/follow/commit/cae7fa67155ee6934a3613d68fbcd515d8761600))
|
||||
* assets rewrite ([#1204](https://github.com/RSSNext/follow/issues/1204)) ([488e8ef](https://github.com/RSSNext/follow/commit/488e8effc6f00769df7dbf68d4e6d1e4e950b8e7))
|
||||
* attempt to fix the page freeze issue when re-opening modal after closing ([36d235e](https://github.com/RSSNext/follow/commit/36d235eeb8d08c841d475db2a354ad05d3f268d7))
|
||||
* audio cover style ([21a93c7](https://github.com/RSSNext/follow/commit/21a93c757dfbc161d67f28500f0129bde1959662))
|
||||
* audio player on mobile ([1e936e2](https://github.com/RSSNext/follow/commit/1e936e2c593adafa92d54ddc542ff30688c0e3bc))
|
||||
* audio player width, fixed [#1934](https://github.com/RSSNext/follow/issues/1934) ([238938a](https://github.com/RSSNext/follow/commit/238938a4da5b854f9f3422b93059b9f82f60d09b))
|
||||
* **auth:** handle optional icon class names for providers in login components ([de8d337](https://github.com/RSSNext/follow/commit/de8d3376713be0b696579e16395b887b2658d59f))
|
||||
* **auth:** redirect url ([e7d5576](https://github.com/RSSNext/follow/commit/e7d5576b63a77cd4f4e25a3124f9685f408a73de))
|
||||
* auto archived list flash ([#1269](https://github.com/RSSNext/follow/issues/1269)) ([8d2478c](https://github.com/RSSNext/follow/commit/8d2478c6a93aa9f5a99fddc55bbb8e532e1a0fe1))
|
||||
* auto load achieved entries when show achieved button is available ([074a60d](https://github.com/RSSNext/follow/commit/074a60d3cf93bcede88ea4d70b07cf7480be4229))
|
||||
@@ -127,6 +130,7 @@
|
||||
* fallback for code can not render to html ([08acded](https://github.com/RSSNext/follow/commit/08acded2d549bc80d2ed8f180a6d89cc3a3c861a)), closes [#1142](https://github.com/RSSNext/follow/issues/1142)
|
||||
* feed action in selection ([ef9db5c](https://github.com/RSSNext/follow/commit/ef9db5c8b39c8229b1e907c6a0e6e74431f677de))
|
||||
* feed boost modal title wrap ([a3eb287](https://github.com/RSSNext/follow/commit/a3eb2875e9456e8ec30ed96294b2bad82ccd5a4d))
|
||||
* feed column pb in mobile ([4035a6b](https://github.com/RSSNext/follow/commit/4035a6b7b839a284e452f51e75c759f25136784a))
|
||||
* feed icon fallback delay ms ([89239d8](https://github.com/RSSNext/follow/commit/89239d89aa52429eef348e500c7ed7d6170c766a))
|
||||
* feed icon margin right ([0f32364](https://github.com/RSSNext/follow/commit/0f3236406dc354adc9830c51e73f9fb4790f159a))
|
||||
* feedIcon margin ([03ce13d](https://github.com/RSSNext/follow/commit/03ce13d45bd89908bd9bcb06484a07873b6388f5))
|
||||
@@ -153,7 +157,9 @@
|
||||
* **i18n:** update Japanese translations for better clarity ([#1842](https://github.com/RSSNext/follow/issues/1842)) ([bf9fb22](https://github.com/RSSNext/follow/commit/bf9fb2289ae7d6c553ec10ba28cab9f04e9f1bcd))
|
||||
* **i18n:** update label for notification badge settings in zh-CN locale and others ([#1455](https://github.com/RSSNext/follow/issues/1455)) ([ec82f03](https://github.com/RSSNext/follow/commit/ec82f036b44a3d0d463c48c1d793fc517def1d07))
|
||||
* ignore `file` and editor protocols ([2badb9b](https://github.com/RSSNext/follow/commit/2badb9b1c0bf6628d2a2fc177063fd0c7c7fb08b))
|
||||
* image error ui ([#2124](https://github.com/RSSNext/follow/issues/2124)) ([008cc98](https://github.com/RSSNext/follow/commit/008cc98f8a2624d4360e7c6bb8ba7176436f8579))
|
||||
* immer object extensible ([6ad35ad](https://github.com/RSSNext/follow/commit/6ad35ad6712a68db9e231bf5733a2956ccecda90))
|
||||
* import ([9d6e7d4](https://github.com/RSSNext/follow/commit/9d6e7d44363efc50a592e13e7c20aa6eca2e03d0))
|
||||
* improve multi select behavior ([24017df](https://github.com/RSSNext/follow/commit/24017dfb3190c91969ec68d3d88544e051880469))
|
||||
* improve perform for feed column ([#1708](https://github.com/RSSNext/follow/issues/1708)) ([1f349ed](https://github.com/RSSNext/follow/commit/1f349ed73e912825fb34877f5db9df13c6c6f879))
|
||||
* initializeDayjs in server ([d408581](https://github.com/RSSNext/follow/commit/d408581a13ad78d5a871d98f3ff0ff9bb5e45ae5)), closes [#1198](https://github.com/RSSNext/follow/issues/1198)
|
||||
@@ -165,6 +171,7 @@
|
||||
* load instagram image fail ([f8fd58f](https://github.com/RSSNext/follow/commit/f8fd58f78ec11bc221eb9190ac7b6a66dd858f9c)), closes [#1539](https://github.com/RSSNext/follow/issues/1539)
|
||||
* localeCompare is undefined ([ab28156](https://github.com/RSSNext/follow/commit/ab28156cb8bd998ec1bc6b43b9a44bd2ecd17137))
|
||||
* lock ([97c1ece](https://github.com/RSSNext/follow/commit/97c1ece9e3d855c7dbcf7238e7953e9bd206811c))
|
||||
* login override provider icon ([96b8929](https://github.com/RSSNext/follow/commit/96b892923ab1e791d29f0464b847a6873c61f075))
|
||||
* mark as read when navigating ([423777e](https://github.com/RSSNext/follow/commit/423777e1372631b8ea8d06913ce55fbdf97f1f07))
|
||||
* mark feed unread dirty, refetch unread next time, fixed [#1830](https://github.com/RSSNext/follow/issues/1830) ([58d0e9c](https://github.com/RSSNext/follow/commit/58d0e9c1902157c2e9fb1444bc1c0db0b775485b))
|
||||
* mark single feed as all read ([a4acd2f](https://github.com/RSSNext/follow/commit/a4acd2fb65335f228875ed5b38f03a9c71b76e1b))
|
||||
@@ -318,6 +325,7 @@
|
||||
* use replace for discover form navigation ([63602f2](https://github.com/RSSNext/follow/commit/63602f266390781a3552a14eefa35455f19c92b6))
|
||||
* use turbo run concurrently task ([742f915](https://github.com/RSSNext/follow/commit/742f91517d87d136bc8dc6ee65008e9b6880d435))
|
||||
* validate file format for OPML and XML in import schema ([2f9bd43](https://github.com/RSSNext/follow/commit/2f9bd43775dd0260ade8aac80f7067b927edba7a))
|
||||
* values().map is undefined ([74ba483](https://github.com/RSSNext/follow/commit/74ba483b0d6b679e551336db51d1a6737bb000ee))
|
||||
* vercel do not support `__` prefix for api route ([45a66e0](https://github.com/RSSNext/follow/commit/45a66e0f972d18831795d92b1d3c1f3893f396dc))
|
||||
* vercel rewrite config ([#1203](https://github.com/RSSNext/follow/issues/1203)) ([c954d61](https://github.com/RSSNext/follow/commit/c954d61f074e282a9a86cbf1d1546748871c20e7))
|
||||
* video media can not play in video view ([4cbf8a5](https://github.com/RSSNext/follow/commit/4cbf8a54fcf11fb71ff935baee52c79a83f5035c)), closes [#1645](https://github.com/RSSNext/follow/issues/1645)
|
||||
@@ -367,6 +375,7 @@
|
||||
* **discover:** improve trending style and discover no image placeholer ([86be1a2](https://github.com/RSSNext/follow/commit/86be1a2e46d3298157cece0731e687a462f833d5))
|
||||
* dnd ([#1471](https://github.com/RSSNext/follow/issues/1471)) ([c9333d5](https://github.com/RSSNext/follow/commit/c9333d5004c170955ab96b9f7f5a2825e1042271))
|
||||
* dynamic auth providers ([b031ce5](https://github.com/RSSNext/follow/commit/b031ce57b8d7835c15fd9eecc6f99eaf50a368d1))
|
||||
* email verification ([3497623](https://github.com/RSSNext/follow/commit/3497623b853f8321ed81788e32d43846be6d6135))
|
||||
* entry image gallery modal ([e0d3e17](https://github.com/RSSNext/follow/commit/e0d3e17da4ee17217d7b78871b546f43af87d893))
|
||||
* export database ([85b4502](https://github.com/RSSNext/follow/commit/85b4502f9c113b8de73ccf4a167aa514a3c149ea))
|
||||
* **external:** move `login` and `redirect` route to external ([7916803](https://github.com/RSSNext/follow/commit/791680332d5e1c2c52eda792dd7ff69281f25adb))
|
||||
@@ -398,9 +407,12 @@
|
||||
* multi select with shift ([2158b1c](https://github.com/RSSNext/follow/commit/2158b1cc255baf3ff5e4e1a5806d85b7df64bd55)), closes [#1256](https://github.com/RSSNext/follow/issues/1256)
|
||||
* new user guide in mobile ([9eca05e](https://github.com/RSSNext/follow/commit/9eca05ef6f3612658397719a0af00dfc30196ca3))
|
||||
* **obsidian:** use readability content when available ([b4a3197](https://github.com/RSSNext/follow/commit/b4a3197e6ebd39bb259a6bc67f408569354a205e))
|
||||
* optimize action pages ([a10b78a](https://github.com/RSSNext/follow/commit/a10b78a79ce836bfbd5b40e9021c30dfef64a23e))
|
||||
* prefer origin addresses for content images ([d4d4345](https://github.com/RSSNext/follow/commit/d4d43451dec839b64239e1835b2ac1a1aa2478be))
|
||||
* **reader:** support custom css, fixed [#256](https://github.com/RSSNext/follow/issues/256) ([b251fa9](https://github.com/RSSNext/follow/commit/b251fa9421417c75d71707c8f08850f2cc902e1a))
|
||||
* redesign login modal ([77dd6ce](https://github.com/RSSNext/follow/commit/77dd6ce2f97ea659def1104119085db3201ec029))
|
||||
* reduce the size of the list in feed list ([e9f7ff3](https://github.com/RSSNext/follow/commit/e9f7ff31768db6bcc269c9becfb253315386baa1))
|
||||
* register or login with email and password ([#2075](https://github.com/RSSNext/follow/issues/2075)) ([ae0dc2c](https://github.com/RSSNext/follow/commit/ae0dc2c30dd62d6ef4f87239298ec89c47c55861))
|
||||
* remove DISABLE_PERSONAL_DAILY_POWER ([064f8f5](https://github.com/RSSNext/follow/commit/064f8f524398a451d46e88b2d8b604f807d4ea96))
|
||||
* remove entries total and remaining to reduce big queries ([df343b1](https://github.com/RSSNext/follow/commit/df343b10d0745a239e3b15fe11c1d3b2cd9ac3bb))
|
||||
* remove entryCount in feed claim list ([723cc43](https://github.com/RSSNext/follow/commit/723cc43891e3fe7e3ce8c09a422df9fdd42577be))
|
||||
@@ -440,6 +452,7 @@
|
||||
* add code cache cleaner ([a0fd15f](https://github.com/RSSNext/follow/commit/a0fd15f4abbab340264da4281f2e4ca9f89ffffa))
|
||||
* batch profile ([#1464](https://github.com/RSSNext/follow/issues/1464)) ([a3e9c0e](https://github.com/RSSNext/follow/commit/a3e9c0edc83628d9c0ceb998d95184c5fd635f6f))
|
||||
* enable router navigation transition ([24e1aea](https://github.com/RSSNext/follow/commit/24e1aead5e9bbb98b59194166fa4fd07eb167353))
|
||||
* **external:** hydrate auth providers ([e0661ff](https://github.com/RSSNext/follow/commit/e0661ff2b9cc76f1a86ba6f293c0c37b5ad8d789))
|
||||
* lazy show action, reduce lcp time ([fcf775c](https://github.com/RSSNext/follow/commit/fcf775c976591258f83dea6e34ca3161b539b15e))
|
||||
* modify some animations to CSS animations ([9ec3fe5](https://github.com/RSSNext/follow/commit/9ec3fe562bf3527ad4279a9a57c0b0bb5934dba1))
|
||||
* optimize dnd re-render ([12bd659](https://github.com/RSSNext/follow/commit/12bd6594585fda9f7b83daad7f6eebae3059d985))
|
||||
|
||||
@@ -79,7 +79,7 @@ export const LoginModalContent = (props: LoginModalContentProps) => {
|
||||
const extraProviders = useMemo(() => {
|
||||
if (!authProviders) return []
|
||||
return Object.entries(authProviders)
|
||||
.filter(([key]) => !defaultProviders[key])
|
||||
.filter(([key]) => !defaultProviders[key] && key !== "credential")
|
||||
.map(([_, provider]) => provider)
|
||||
}, [authProviders])
|
||||
|
||||
@@ -116,7 +116,9 @@ export const LoginModalContent = (props: LoginModalContentProps) => {
|
||||
}}
|
||||
>
|
||||
<LoginButtonContent isLoading={loadingLockSet === provider.id}>
|
||||
<i className={clsx("mr-2 text-xl", authProvidersConfig[provider.id].iconClassName)} />{" "}
|
||||
<i
|
||||
className={clsx("mr-2 text-xl", authProvidersConfig[provider.id]?.iconClassName)}
|
||||
/>{" "}
|
||||
{t("signin.continue_with", { provider: provider.name })}
|
||||
</LoginButtonContent>
|
||||
</MotionButtonBase>
|
||||
|
||||
@@ -10,6 +10,8 @@ import {
|
||||
FormMessage,
|
||||
} from "@follow/components/ui/form/index.jsx"
|
||||
import { Input } from "@follow/components/ui/input/index.js"
|
||||
import { Label } from "@follow/components/ui/label/index.js"
|
||||
import { sendVerificationEmail } from "@follow/shared/auth"
|
||||
import { cn } from "@follow/utils/utils"
|
||||
import { zodResolver } from "@hookform/resolvers/zod"
|
||||
import { useMutation } from "@tanstack/react-query"
|
||||
@@ -65,6 +67,18 @@ export const ProfileSettingForm = ({
|
||||
},
|
||||
})
|
||||
|
||||
const verifyEmailMutation = useMutation({
|
||||
mutationFn: async () => {
|
||||
if (!user?.email) return
|
||||
return sendVerificationEmail({
|
||||
email: user.email,
|
||||
})
|
||||
},
|
||||
onSuccess: () => {
|
||||
toast.success(t("profile.email.verification_sent"))
|
||||
},
|
||||
})
|
||||
|
||||
function onSubmit(values: z.infer<typeof formSchema>) {
|
||||
updateMutation.mutate(values)
|
||||
}
|
||||
@@ -72,6 +86,27 @@ export const ProfileSettingForm = ({
|
||||
return (
|
||||
<Form {...form}>
|
||||
<form onSubmit={form.handleSubmit(onSubmit)} className={cn("mt-4 space-y-4", className)}>
|
||||
<div className="space-y-2">
|
||||
<Label>{t("profile.email.label")}</Label>
|
||||
<p className="flex gap-2 text-sm text-muted-foreground">
|
||||
{user?.email}
|
||||
<span className={cn(user?.emailVerified ? "text-green-500" : "text-red-500")}>
|
||||
{user?.emailVerified ? t("profile.email.verified") : t("profile.email.unverified")}
|
||||
</span>
|
||||
</p>
|
||||
{!user?.emailVerified && (
|
||||
<Button
|
||||
variant="outline"
|
||||
type="button"
|
||||
isLoading={verifyEmailMutation.isPending}
|
||||
onClick={() => {
|
||||
verifyEmailMutation.mutate()
|
||||
}}
|
||||
>
|
||||
{t("profile.email.send_verification")}
|
||||
</Button>
|
||||
)}
|
||||
</div>
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="handle"
|
||||
|
||||
@@ -0,0 +1,138 @@
|
||||
import { Button } from "@follow/components/ui/button/index.js"
|
||||
import {
|
||||
Form,
|
||||
FormControl,
|
||||
FormField,
|
||||
FormItem,
|
||||
FormLabel,
|
||||
FormMessage,
|
||||
} from "@follow/components/ui/form/index.jsx"
|
||||
import { Input } from "@follow/components/ui/input/index.js"
|
||||
import { changePassword } from "@follow/shared/auth"
|
||||
import { zodResolver } from "@hookform/resolvers/zod"
|
||||
import { useMutation } from "@tanstack/react-query"
|
||||
import { useForm } from "react-hook-form"
|
||||
import { useTranslation } from "react-i18next"
|
||||
import { toast } from "sonner"
|
||||
import { z } from "zod"
|
||||
|
||||
import { useHasPassword } from "~/queries/auth"
|
||||
|
||||
const passwordSchema = z.string().min(8).max(128)
|
||||
|
||||
const updatePasswordFormSchema = z
|
||||
.object({
|
||||
currentPassword: passwordSchema,
|
||||
newPassword: passwordSchema,
|
||||
confirmPassword: passwordSchema,
|
||||
})
|
||||
.refine((data) => data.newPassword === data.confirmPassword, {
|
||||
message: "Passwords don't match",
|
||||
path: ["confirmPassword"],
|
||||
})
|
||||
|
||||
const UpdateExistingPasswordForm = () => {
|
||||
const { t } = useTranslation("settings")
|
||||
|
||||
const form = useForm<z.infer<typeof updatePasswordFormSchema>>({
|
||||
resolver: zodResolver(updatePasswordFormSchema),
|
||||
defaultValues: {
|
||||
currentPassword: "",
|
||||
newPassword: "",
|
||||
confirmPassword: "",
|
||||
},
|
||||
})
|
||||
|
||||
const updateMutation = useMutation({
|
||||
mutationFn: async (values: z.infer<typeof updatePasswordFormSchema>) => {
|
||||
const res = await changePassword({
|
||||
currentPassword: values.currentPassword,
|
||||
newPassword: values.newPassword,
|
||||
revokeOtherSessions: true,
|
||||
})
|
||||
if (res.error) {
|
||||
throw new Error(res.error.message)
|
||||
}
|
||||
},
|
||||
onError: (error) => {
|
||||
toast.error(error.message)
|
||||
},
|
||||
onSuccess: (_) => {
|
||||
toast(t("profile.update_password_success"), {
|
||||
duration: 3000,
|
||||
})
|
||||
form.reset()
|
||||
},
|
||||
})
|
||||
|
||||
function onSubmit(values: z.infer<typeof updatePasswordFormSchema>) {
|
||||
updateMutation.mutate(values)
|
||||
}
|
||||
|
||||
return (
|
||||
<Form {...form}>
|
||||
<form onSubmit={form.handleSubmit(onSubmit)} className="mt-4 space-y-4">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="currentPassword"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("profile.change_password.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input
|
||||
type="password"
|
||||
placeholder={t("profile.current_password.label")}
|
||||
{...field}
|
||||
/>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="newPassword"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormControl>
|
||||
<Input type="password" placeholder={t("profile.new_password.label")} {...field} />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="confirmPassword"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormControl>
|
||||
<Input
|
||||
type="password"
|
||||
placeholder={t("profile.confirm_password.label")}
|
||||
{...field}
|
||||
/>
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
<div className="text-right">
|
||||
<Button type="submit" isLoading={updateMutation.isPending}>
|
||||
{t("profile.submit")}
|
||||
</Button>
|
||||
</div>
|
||||
</form>
|
||||
</Form>
|
||||
)
|
||||
}
|
||||
|
||||
export const UpdatePasswordForm = () => {
|
||||
const { data: hasPassword, isLoading } = useHasPassword()
|
||||
|
||||
if (isLoading || !hasPassword) {
|
||||
return null
|
||||
}
|
||||
|
||||
return <UpdateExistingPasswordForm />
|
||||
}
|
||||
@@ -1,4 +1,5 @@
|
||||
import { ProfileSettingForm } from "~/modules/profile/profile-setting-form"
|
||||
import { UpdatePasswordForm } from "~/modules/profile/update-password-form"
|
||||
import { SettingsTitle } from "~/modules/settings/title"
|
||||
import { defineSettingPageData } from "~/modules/settings/utils"
|
||||
|
||||
@@ -15,6 +16,7 @@ export function Component() {
|
||||
<>
|
||||
<SettingsTitle />
|
||||
<ProfileSettingForm />
|
||||
<UpdatePasswordForm />
|
||||
</>
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
import { getSession } from "@follow/shared/auth"
|
||||
import { getSession, listAccounts } from "@follow/shared/auth"
|
||||
import type { AuthSession } from "@follow/shared/hono"
|
||||
import type { FetchError } from "ofetch"
|
||||
|
||||
@@ -7,6 +7,23 @@ import { defineQuery } from "~/lib/defineQuery"
|
||||
|
||||
export const auth = {
|
||||
getSession: () => defineQuery(["auth", "session"], () => getSession()),
|
||||
getAccounts: () =>
|
||||
defineQuery(["auth", "accounts"], async () => {
|
||||
const accounts = await listAccounts()
|
||||
return accounts.data as Array<{ id: string; provider: string }>
|
||||
}),
|
||||
}
|
||||
|
||||
export const useAccounts = () => {
|
||||
return useAuthQuery(auth.getAccounts())
|
||||
}
|
||||
|
||||
export const useHasPassword = () => {
|
||||
const accounts = useAccounts()
|
||||
return {
|
||||
...accounts,
|
||||
data: !!accounts.data?.find((account) => account.provider === "credential"),
|
||||
}
|
||||
}
|
||||
|
||||
export const useSession = (options?: { enabled?: boolean }) => {
|
||||
|
||||
@@ -0,0 +1,302 @@
|
||||
import { UserAvatar } from "@client/components/ui/user-avatar"
|
||||
import { queryClient } from "@client/lib/query-client"
|
||||
import { useSession } from "@client/query/auth"
|
||||
import { useAuthProviders } from "@client/query/users"
|
||||
import { Logo } from "@follow/components/icons/logo.jsx"
|
||||
import { AutoResizeHeight } from "@follow/components/ui/auto-resize-height/index.jsx"
|
||||
import { Button, MotionButtonBase } from "@follow/components/ui/button/index.js"
|
||||
import { Divider } from "@follow/components/ui/divider/index.js"
|
||||
import {
|
||||
Form,
|
||||
FormControl,
|
||||
FormField,
|
||||
FormItem,
|
||||
FormLabel,
|
||||
FormMessage,
|
||||
} from "@follow/components/ui/form/index.jsx"
|
||||
import { Input } from "@follow/components/ui/input/index.js"
|
||||
import { LoadingCircle } from "@follow/components/ui/loading/index.jsx"
|
||||
import { authProvidersConfig } from "@follow/constants"
|
||||
import { createSession, loginHandler, signOut } from "@follow/shared/auth"
|
||||
import { DEEPLINK_SCHEME } from "@follow/shared/constants"
|
||||
import { cn } from "@follow/utils/utils"
|
||||
import { zodResolver } from "@hookform/resolvers/zod"
|
||||
import { useCallback, useEffect, useMemo, useRef, useState } from "react"
|
||||
import { useForm } from "react-hook-form"
|
||||
import { Trans, useTranslation } from "react-i18next"
|
||||
import { Link, useLocation, useNavigate } from "react-router"
|
||||
import { toast } from "sonner"
|
||||
import { z } from "zod"
|
||||
|
||||
const overrideProviderIconMap: Record<string, React.ReactNode> = {
|
||||
apple: <i className="i-mgc-apple-cute-fi size-5 text-black dark:text-white" />,
|
||||
github: <i className="i-mgc-github-cute-fi size-5 text-black dark:text-white" />,
|
||||
}
|
||||
|
||||
export function Login() {
|
||||
const { status, refetch } = useSession()
|
||||
|
||||
const [redirecting, setRedirecting] = useState(false)
|
||||
|
||||
const { data: authProviders, isLoading } = useAuthProviders()
|
||||
|
||||
const location = useLocation()
|
||||
const urlParams = new URLSearchParams(location.search)
|
||||
const provider = urlParams.get("provider")
|
||||
const isCredentialProvider = provider === "credential"
|
||||
|
||||
const isAuthenticated = status === "authenticated"
|
||||
|
||||
const { t } = useTranslation("external")
|
||||
|
||||
useEffect(() => {
|
||||
if (provider && !isCredentialProvider && status === "unauthenticated") {
|
||||
loginHandler(provider)
|
||||
setRedirecting(true)
|
||||
}
|
||||
}, [isCredentialProvider, provider, status])
|
||||
|
||||
const getCallbackUrl = useCallback(async () => {
|
||||
const { data } = await createSession()
|
||||
if (!data) return null
|
||||
return {
|
||||
url: `${DEEPLINK_SCHEME}auth?ck=${data.ck}&userId=${data.userId}`,
|
||||
userId: data.userId,
|
||||
}
|
||||
}, [])
|
||||
|
||||
const handleOpenApp = useCallback(async () => {
|
||||
const callbackUrl = await getCallbackUrl()
|
||||
if (!callbackUrl) return
|
||||
window.open(callbackUrl.url, "_top")
|
||||
}, [getCallbackUrl])
|
||||
|
||||
const onceRef = useRef(false)
|
||||
useEffect(() => {
|
||||
if (isAuthenticated && !onceRef.current) {
|
||||
handleOpenApp()
|
||||
}
|
||||
onceRef.current = true
|
||||
}, [handleOpenApp, isAuthenticated])
|
||||
|
||||
const LoginOrStatusContent = useMemo(() => {
|
||||
switch (true) {
|
||||
case isAuthenticated: {
|
||||
return (
|
||||
<div className="flex w-full flex-col items-center justify-center gap-10 px-4">
|
||||
<div className="relative flex items-center justify-center">
|
||||
<UserAvatar className="gap-4 px-10 py-4 text-2xl" />
|
||||
<div className="absolute right-0">
|
||||
<Button
|
||||
variant="ghost"
|
||||
onClick={async () => {
|
||||
await signOut()
|
||||
await refetch()
|
||||
}}
|
||||
>
|
||||
<i className="i-mingcute-exit-line text-xl" />
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
<h2 className="text-center">
|
||||
{t("redirect.successMessage", { app_name: APP_NAME })} <br />
|
||||
<br />
|
||||
{t("redirect.instruction", { app_name: APP_NAME })}
|
||||
</h2>
|
||||
<div className="center flex flex-col gap-20 sm:flex-row">
|
||||
<Button
|
||||
variant="text"
|
||||
className="h-14 text-base"
|
||||
onClick={() => {
|
||||
window.location.href = "/"
|
||||
}}
|
||||
>
|
||||
{t("redirect.continueInBrowser")}
|
||||
</Button>
|
||||
|
||||
<Button className="h-14 !rounded-full px-5 text-lg" onClick={handleOpenApp}>
|
||||
{t("redirect.openApp", { app_name: APP_NAME })}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
default: {
|
||||
if (!authProviders?.credential) {
|
||||
return (
|
||||
<div className="flex w-[350px] max-w-full flex-col gap-3">
|
||||
{Object.entries(authProviders || [])
|
||||
.filter(([key]) => key !== "credential")
|
||||
.map(([key, provider]) => (
|
||||
<Button
|
||||
key={key}
|
||||
buttonClassName={cn(
|
||||
"h-[48px] w-full rounded-[8px] font-sans text-base text-white hover:!bg-black/80 focus:!border-black/80 focus:!ring-black/80",
|
||||
authProvidersConfig[key]?.buttonClassName,
|
||||
)}
|
||||
onClick={() => {
|
||||
loginHandler(key)
|
||||
}}
|
||||
>
|
||||
<i className={cn("mr-2 text-xl", authProvidersConfig[key]?.iconClassName)} />{" "}
|
||||
{t("login.continueWith", { provider: provider.name })}
|
||||
</Button>
|
||||
))}
|
||||
</div>
|
||||
)
|
||||
} else {
|
||||
return (
|
||||
<>
|
||||
<LoginWithPassword />
|
||||
<div className="mt-2 w-full space-y-2">
|
||||
<div className="flex items-center justify-center">
|
||||
<Divider className="flex-1" />
|
||||
<p className="px-4 text-center text-sm text-muted-foreground">{t("login.or")}</p>
|
||||
<Divider className="flex-1" />
|
||||
</div>
|
||||
</div>
|
||||
<div className="flex items-center justify-center gap-4">
|
||||
{Object.entries(authProviders || [])
|
||||
.filter(([key]) => key !== "credential")
|
||||
.map(([key, provider]) => (
|
||||
<MotionButtonBase
|
||||
key={key}
|
||||
onClick={() => {
|
||||
loginHandler(key)
|
||||
}}
|
||||
>
|
||||
{overrideProviderIconMap[provider.id] ? (
|
||||
<div className="center box-content inline-flex size-5 rounded-full border p-2 duration-200 hover:bg-muted">
|
||||
{overrideProviderIconMap[provider.id]}
|
||||
</div>
|
||||
) : (
|
||||
<div
|
||||
className="center inline-flex rounded-full border p-2 duration-200 hover:bg-muted [&_svg]:size-5"
|
||||
dangerouslySetInnerHTML={{
|
||||
__html: provider.icon,
|
||||
}}
|
||||
style={{
|
||||
color: provider.color,
|
||||
}}
|
||||
/>
|
||||
)}
|
||||
</MotionButtonBase>
|
||||
))}
|
||||
</div>
|
||||
</>
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
}, [authProviders, handleOpenApp, isAuthenticated, refetch, t])
|
||||
const Content = useMemo(() => {
|
||||
switch (true) {
|
||||
case redirecting: {
|
||||
return <div>{t("login.redirecting")}</div>
|
||||
}
|
||||
default: {
|
||||
return <div className="flex flex-col gap-3">{LoginOrStatusContent}</div>
|
||||
}
|
||||
}
|
||||
}, [LoginOrStatusContent, redirecting, t])
|
||||
|
||||
return (
|
||||
<div className="flex h-screen w-full flex-col items-center justify-center">
|
||||
<Logo className="size-16" />
|
||||
{isLoading && <LoadingCircle className="mt-8" size="large" />}
|
||||
|
||||
<AutoResizeHeight>
|
||||
<>
|
||||
{!isAuthenticated && !isLoading && (
|
||||
<h1 className="center mb-6 mt-8 flex text-2xl font-bold">
|
||||
{t("login.logInTo")}
|
||||
{` ${APP_NAME}`}
|
||||
</h1>
|
||||
)}
|
||||
{Content}
|
||||
</>
|
||||
</AutoResizeHeight>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
const formSchema = z.object({
|
||||
email: z.string().email(),
|
||||
password: z.string().max(128),
|
||||
})
|
||||
|
||||
async function onSubmit(values: z.infer<typeof formSchema>) {
|
||||
const res = await loginHandler("credential", "browser", values)
|
||||
if (res?.error) {
|
||||
toast.error(res.error.message)
|
||||
return
|
||||
}
|
||||
queryClient.invalidateQueries({ queryKey: ["auth", "session"] })
|
||||
}
|
||||
|
||||
function LoginWithPassword() {
|
||||
const { t } = useTranslation("external")
|
||||
const form = useForm<z.infer<typeof formSchema>>({
|
||||
resolver: zodResolver(formSchema),
|
||||
defaultValues: {
|
||||
email: "",
|
||||
password: "",
|
||||
},
|
||||
})
|
||||
const { isValid } = form.formState
|
||||
const navigate = useNavigate()
|
||||
|
||||
return (
|
||||
<Form {...form}>
|
||||
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-1">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="email"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("login.email")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input type="email" {...field} />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="password"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("login.password")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input type="password" {...field} />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
<Link to="/forget-password" className="block py-1 text-xs text-accent hover:underline">
|
||||
{t("login.forget_password.note")}
|
||||
</Link>
|
||||
<Button
|
||||
type="submit"
|
||||
className="w-full"
|
||||
buttonClassName="text-base !mt-3"
|
||||
disabled={!isValid}
|
||||
>
|
||||
{t("login.continueWith", { provider: "email" })}
|
||||
</Button>
|
||||
<Button
|
||||
buttonClassName="!mt-3 text-base"
|
||||
className="w-full"
|
||||
variant="outline"
|
||||
onClick={() => {
|
||||
navigate("/register")
|
||||
}}
|
||||
>
|
||||
<Trans ns="external" i18nKey="login.signUp" />
|
||||
</Button>
|
||||
</form>
|
||||
</Form>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,112 @@
|
||||
import { Button, MotionButtonBase } from "@follow/components/ui/button/index.jsx"
|
||||
import {
|
||||
Card,
|
||||
CardContent,
|
||||
CardDescription,
|
||||
CardHeader,
|
||||
CardTitle,
|
||||
} from "@follow/components/ui/card/index.jsx"
|
||||
import {
|
||||
Form,
|
||||
FormControl,
|
||||
FormField,
|
||||
FormItem,
|
||||
FormLabel,
|
||||
FormMessage,
|
||||
} from "@follow/components/ui/form/index.jsx"
|
||||
import { Input } from "@follow/components/ui/input/index.js"
|
||||
import { forgetPassword } from "@follow/shared/auth"
|
||||
import { env } from "@follow/shared/env"
|
||||
import { zodResolver } from "@hookform/resolvers/zod"
|
||||
import { useMutation } from "@tanstack/react-query"
|
||||
import { useForm } from "react-hook-form"
|
||||
import { useTranslation } from "react-i18next"
|
||||
import { useNavigate } from "react-router"
|
||||
import { toast } from "sonner"
|
||||
import { z } from "zod"
|
||||
|
||||
const forgetPasswordFormSchema = z.object({
|
||||
email: z.string().email(),
|
||||
})
|
||||
|
||||
export function Component() {
|
||||
const { t } = useTranslation("external")
|
||||
const form = useForm<z.infer<typeof forgetPasswordFormSchema>>({
|
||||
resolver: zodResolver(forgetPasswordFormSchema),
|
||||
defaultValues: {
|
||||
email: "",
|
||||
},
|
||||
})
|
||||
|
||||
const { isValid } = form.formState
|
||||
const updateMutation = useMutation({
|
||||
mutationFn: async (values: z.infer<typeof forgetPasswordFormSchema>) => {
|
||||
const res = await forgetPassword({
|
||||
email: values.email,
|
||||
redirectTo: `${env.VITE_WEB_URL}/reset-password`,
|
||||
})
|
||||
if (res.error) {
|
||||
throw new Error(res.error.message)
|
||||
}
|
||||
},
|
||||
onError: (error) => {
|
||||
toast.error(error.message)
|
||||
},
|
||||
onSuccess: () => {
|
||||
toast.success(t("login.forget_password.success"))
|
||||
},
|
||||
})
|
||||
|
||||
function onSubmit(values: z.infer<typeof forgetPasswordFormSchema>) {
|
||||
updateMutation.mutate(values)
|
||||
}
|
||||
|
||||
const navigate = useNavigate()
|
||||
|
||||
return (
|
||||
<div className="flex h-full items-center justify-center">
|
||||
<Card className="w-[350px] max-w-full">
|
||||
<CardHeader>
|
||||
<CardTitle className="flex items-center gap-2">
|
||||
<MotionButtonBase
|
||||
onClick={() => {
|
||||
history.length > 1 ? history.back() : navigate("/login")
|
||||
}}
|
||||
className="-ml-1 inline-flex cursor-pointer items-center"
|
||||
>
|
||||
<i className="i-mingcute-left-line" />
|
||||
</MotionButtonBase>
|
||||
<span>{t("login.forget_password.label")}</span>
|
||||
</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<CardDescription className="mb-4">
|
||||
{t("login.forget_password.description")}
|
||||
</CardDescription>
|
||||
<Form {...form}>
|
||||
<form onSubmit={form.handleSubmit(onSubmit)} className="space-y-4">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="email"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("login.email")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input type="email" {...field} />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
<div className="text-right">
|
||||
<Button disabled={!isValid} type="submit" isLoading={updateMutation.isPending}>
|
||||
{t("login.submit")}
|
||||
</Button>
|
||||
</div>
|
||||
</form>
|
||||
</Form>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -1,135 +0,0 @@
|
||||
import { UserAvatar } from "@client/components/ui/user-avatar"
|
||||
import { useSession } from "@client/query/auth"
|
||||
import { useAuthProviders } from "@client/query/users"
|
||||
import { Logo } from "@follow/components/icons/logo.jsx"
|
||||
import { Button } from "@follow/components/ui/button/index.js"
|
||||
import { authProvidersConfig } from "@follow/constants"
|
||||
import { createSession, loginHandler, signOut } from "@follow/shared/auth"
|
||||
import { DEEPLINK_SCHEME } from "@follow/shared/constants"
|
||||
import { cn } from "@follow/utils/utils"
|
||||
import { useCallback, useEffect, useRef, useState } from "react"
|
||||
import { useTranslation } from "react-i18next"
|
||||
import { useLocation } from "react-router"
|
||||
|
||||
export function Component() {
|
||||
return <Login />
|
||||
}
|
||||
|
||||
function Login() {
|
||||
const { status, refetch } = useSession()
|
||||
|
||||
const [redirecting, setRedirecting] = useState(false)
|
||||
|
||||
const { data: authProviders } = useAuthProviders()
|
||||
const location = useLocation()
|
||||
const urlParams = new URLSearchParams(location.search)
|
||||
const provider = urlParams.get("provider")
|
||||
|
||||
const isAuthenticated = status === "authenticated"
|
||||
|
||||
const { t } = useTranslation("external")
|
||||
|
||||
useEffect(() => {
|
||||
if (provider && status === "unauthenticated") {
|
||||
loginHandler(provider)
|
||||
setRedirecting(true)
|
||||
}
|
||||
}, [status])
|
||||
|
||||
const getCallbackUrl = useCallback(async () => {
|
||||
const { data } = await createSession()
|
||||
if (!data) return null
|
||||
return {
|
||||
url: `${DEEPLINK_SCHEME}auth?ck=${data.ck}&userId=${data.userId}`,
|
||||
userId: data.userId,
|
||||
}
|
||||
}, [])
|
||||
|
||||
const handleOpenApp = useCallback(async () => {
|
||||
const callbackUrl = await getCallbackUrl()
|
||||
if (!callbackUrl) return
|
||||
window.open(callbackUrl.url, "_top")
|
||||
}, [getCallbackUrl])
|
||||
|
||||
const onceRef = useRef(false)
|
||||
useEffect(() => {
|
||||
if (isAuthenticated && !onceRef.current) {
|
||||
handleOpenApp()
|
||||
}
|
||||
onceRef.current = true
|
||||
}, [handleOpenApp, isAuthenticated])
|
||||
|
||||
return (
|
||||
<div className="flex h-screen w-full flex-col items-center justify-center gap-10">
|
||||
<Logo className="size-20" />
|
||||
{!isAuthenticated && (
|
||||
<h1 className="text-3xl font-bold">
|
||||
{t("login.logInTo")}
|
||||
{` ${APP_NAME}`}
|
||||
</h1>
|
||||
)}
|
||||
{redirecting ? (
|
||||
<div>{t("login.redirecting")}</div>
|
||||
) : (
|
||||
<div className="flex flex-col gap-3">
|
||||
{isAuthenticated ? (
|
||||
<div className="flex w-full flex-col items-center justify-center gap-10 px-4">
|
||||
<div className="relative flex items-center justify-center">
|
||||
<UserAvatar className="gap-4 px-10 py-4 text-2xl" />
|
||||
<div className="absolute right-0">
|
||||
<Button
|
||||
variant="ghost"
|
||||
onClick={async () => {
|
||||
await signOut()
|
||||
await refetch()
|
||||
}}
|
||||
>
|
||||
<i className="i-mingcute-exit-line text-xl" />
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
<h2 className="text-center">
|
||||
{t("redirect.successMessage", { app_name: APP_NAME })} <br />
|
||||
<br />
|
||||
{t("redirect.instruction", { app_name: APP_NAME })}
|
||||
</h2>
|
||||
<div className="center flex flex-col gap-20 sm:flex-row">
|
||||
<Button
|
||||
variant="text"
|
||||
className="h-14 text-base"
|
||||
onClick={() => {
|
||||
window.location.href = "/"
|
||||
}}
|
||||
>
|
||||
{t("redirect.continueInBrowser")}
|
||||
</Button>
|
||||
|
||||
<Button className="h-14 !rounded-full px-5 text-lg" onClick={handleOpenApp}>
|
||||
{t("redirect.openApp", { app_name: APP_NAME })}
|
||||
</Button>
|
||||
</div>
|
||||
</div>
|
||||
) : (
|
||||
<>
|
||||
{Object.entries(authProviders || []).map(([key, provider]) => (
|
||||
<Button
|
||||
key={key}
|
||||
buttonClassName={cn(
|
||||
"h-[48px] w-[320px] rounded-[8px] font-sans text-base text-white hover:!bg-black/80 focus:!border-black/80 focus:!ring-black/80",
|
||||
authProvidersConfig[key]?.buttonClassName,
|
||||
)}
|
||||
onClick={() => {
|
||||
loginHandler(key)
|
||||
}}
|
||||
>
|
||||
<i className={cn("mr-2 text-xl", authProvidersConfig[key].iconClassName)} />{" "}
|
||||
{t("login.continueWith", { provider: provider.name })}
|
||||
</Button>
|
||||
))}
|
||||
</>
|
||||
)}
|
||||
</div>
|
||||
)}
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
import { Login } from "@client/modules/login"
|
||||
|
||||
export function Component() {
|
||||
return <Login />
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
import type { GetHydrateData } from "@client/lib/helper"
|
||||
import type { AuthProvider } from "@client/query/users"
|
||||
|
||||
import { createApiFetch } from "~/lib/api-client"
|
||||
import { defineMetadata } from "~/meta-handler"
|
||||
|
||||
const getTypedProviders = async () => {
|
||||
const apiFetch = createApiFetch()
|
||||
const data = (await apiFetch("/better-auth/get-providers")) as Record<string, AuthProvider>
|
||||
|
||||
return data
|
||||
}
|
||||
|
||||
const meta = defineMetadata(async () => {
|
||||
const providers = await getTypedProviders()
|
||||
|
||||
return [
|
||||
{
|
||||
type: "title",
|
||||
title: "Login",
|
||||
},
|
||||
{
|
||||
type: "hydrate",
|
||||
data: providers,
|
||||
path: "/login",
|
||||
key: `betterAuth`,
|
||||
},
|
||||
] as const
|
||||
})
|
||||
|
||||
export type LoginHydrateData = GetHydrateData<typeof meta>
|
||||
export default meta
|
||||
@@ -0,0 +1,139 @@
|
||||
import { Logo } from "@follow/components/icons/logo.jsx"
|
||||
import { Button } from "@follow/components/ui/button/index.jsx"
|
||||
import {
|
||||
Form,
|
||||
FormControl,
|
||||
FormField,
|
||||
FormItem,
|
||||
FormLabel,
|
||||
FormMessage,
|
||||
} from "@follow/components/ui/form/index.jsx"
|
||||
import { Input } from "@follow/components/ui/input/index.js"
|
||||
import { signUp } from "@follow/shared/auth"
|
||||
import { zodResolver } from "@hookform/resolvers/zod"
|
||||
import { useForm } from "react-hook-form"
|
||||
import { Trans, useTranslation } from "react-i18next"
|
||||
import { Link, useNavigate } from "react-router"
|
||||
import { toast } from "sonner"
|
||||
import { z } from "zod"
|
||||
|
||||
export function Component() {
|
||||
return (
|
||||
<div className="flex h-full flex-col items-center justify-center gap-10">
|
||||
<Logo className="size-20" />
|
||||
<RegisterForm />
|
||||
</div>
|
||||
)
|
||||
}
|
||||
|
||||
const formSchema = z
|
||||
.object({
|
||||
email: z.string().email(),
|
||||
password: z.string().min(8).max(128),
|
||||
confirmPassword: z.string(),
|
||||
})
|
||||
.refine((data) => data.password === data.confirmPassword, {
|
||||
message: "Passwords don't match",
|
||||
path: ["confirmPassword"],
|
||||
})
|
||||
|
||||
function RegisterForm() {
|
||||
const { t } = useTranslation("external")
|
||||
|
||||
const form = useForm<z.infer<typeof formSchema>>({
|
||||
resolver: zodResolver(formSchema),
|
||||
defaultValues: {
|
||||
email: "",
|
||||
password: "",
|
||||
confirmPassword: "",
|
||||
},
|
||||
})
|
||||
|
||||
const { isValid } = form.formState
|
||||
|
||||
const navigate = useNavigate()
|
||||
|
||||
function onSubmit(values: z.infer<typeof formSchema>) {
|
||||
return signUp.email({
|
||||
email: values.email,
|
||||
password: values.password,
|
||||
name: values.email.split("@")[0],
|
||||
callbackURL: "/",
|
||||
fetchOptions: {
|
||||
onSuccess() {
|
||||
navigate("/login")
|
||||
},
|
||||
onError(context) {
|
||||
toast.error(context.error.message)
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="relative">
|
||||
<h1 className="center flex text-2xl font-bold">
|
||||
{t("register.label", { app_name: APP_NAME })}
|
||||
</h1>
|
||||
<div className="mt-2 text-center text-muted-foreground">
|
||||
<Trans
|
||||
ns="external"
|
||||
i18nKey="register.note"
|
||||
components={{
|
||||
LoginLink: (
|
||||
<Link to="/login" className="text-accent hover:underline">
|
||||
{t("register.login")}
|
||||
</Link>
|
||||
),
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
<Form {...form}>
|
||||
<form onSubmit={form.handleSubmit(onSubmit)} className="mt-6 space-y-4">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="email"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("register.email")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input type="email" {...field} />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="password"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("register.password")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input type="password" {...field} />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="confirmPassword"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("register.confirm_password")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input type="password" {...field} />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
<Button disabled={!isValid} type="submit" className="w-full">
|
||||
{t("register.submit")}
|
||||
</Button>
|
||||
</form>
|
||||
</Form>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -0,0 +1,130 @@
|
||||
import { Button, MotionButtonBase } from "@follow/components/ui/button/index.jsx"
|
||||
import {
|
||||
Card,
|
||||
CardContent,
|
||||
CardDescription,
|
||||
CardHeader,
|
||||
CardTitle,
|
||||
} from "@follow/components/ui/card/index.jsx"
|
||||
import {
|
||||
Form,
|
||||
FormControl,
|
||||
FormField,
|
||||
FormItem,
|
||||
FormLabel,
|
||||
FormMessage,
|
||||
} from "@follow/components/ui/form/index.jsx"
|
||||
import { Input } from "@follow/components/ui/input/index.js"
|
||||
import { resetPassword } from "@follow/shared/auth"
|
||||
import { zodResolver } from "@hookform/resolvers/zod"
|
||||
import { useMutation } from "@tanstack/react-query"
|
||||
import { useForm } from "react-hook-form"
|
||||
import { useTranslation } from "react-i18next"
|
||||
import { useNavigate } from "react-router"
|
||||
import { toast } from "sonner"
|
||||
import { z } from "zod"
|
||||
|
||||
const passwordSchema = z.string().min(8).max(128)
|
||||
const initPasswordFormSchema = z
|
||||
.object({
|
||||
newPassword: passwordSchema,
|
||||
confirmPassword: passwordSchema,
|
||||
})
|
||||
.refine((data) => data.newPassword === data.confirmPassword, {
|
||||
message: "Passwords don't match",
|
||||
path: ["confirmPassword"],
|
||||
})
|
||||
|
||||
export function Component() {
|
||||
const { t } = useTranslation("external")
|
||||
const form = useForm<z.infer<typeof initPasswordFormSchema>>({
|
||||
resolver: zodResolver(initPasswordFormSchema),
|
||||
defaultValues: {
|
||||
newPassword: "",
|
||||
confirmPassword: "",
|
||||
},
|
||||
})
|
||||
|
||||
const { isValid } = form.formState
|
||||
|
||||
const navigate = useNavigate()
|
||||
const updateMutation = useMutation({
|
||||
mutationFn: async (values: z.infer<typeof initPasswordFormSchema>) => {
|
||||
const res = await resetPassword({ newPassword: values.newPassword })
|
||||
const error = res.error?.message
|
||||
if (error) {
|
||||
throw new Error(error)
|
||||
}
|
||||
},
|
||||
onError: (error) => {
|
||||
toast.error(error.message)
|
||||
},
|
||||
onSuccess: () => {
|
||||
toast.success(t("login.reset_password.success"))
|
||||
navigate("/login")
|
||||
},
|
||||
})
|
||||
|
||||
function onSubmit(values: z.infer<typeof initPasswordFormSchema>) {
|
||||
updateMutation.mutate(values)
|
||||
}
|
||||
|
||||
return (
|
||||
<div className="flex h-full items-center justify-center">
|
||||
<Card className="w-[350px] max-w-full">
|
||||
<CardHeader>
|
||||
<CardTitle className="flex items-center gap-2">
|
||||
<MotionButtonBase
|
||||
onClick={() => {
|
||||
history.length > 1 ? history.back() : navigate("/login")
|
||||
}}
|
||||
className="-ml-1 inline-flex cursor-pointer items-center"
|
||||
>
|
||||
<i className="i-mingcute-left-line" />
|
||||
</MotionButtonBase>
|
||||
<span>{t("login.forget_password.label")}</span>
|
||||
</CardTitle>
|
||||
</CardHeader>
|
||||
<CardContent>
|
||||
<CardDescription>{t("login.reset_password.description")}</CardDescription>
|
||||
<Form {...form}>
|
||||
<form onSubmit={form.handleSubmit(onSubmit)} className="mt-4 space-y-4">
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="newPassword"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("login.new_password.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input type="password" {...field} />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
<FormField
|
||||
control={form.control}
|
||||
name="confirmPassword"
|
||||
render={({ field }) => (
|
||||
<FormItem>
|
||||
<FormLabel>{t("login.confirm_password.label")}</FormLabel>
|
||||
<FormControl>
|
||||
<Input type="password" {...field} />
|
||||
</FormControl>
|
||||
<FormMessage />
|
||||
</FormItem>
|
||||
)}
|
||||
/>
|
||||
|
||||
<div className="text-right">
|
||||
<Button disabled={!isValid} type="submit" isLoading={updateMutation.isPending}>
|
||||
{t("login.submit")}
|
||||
</Button>
|
||||
</div>
|
||||
</form>
|
||||
</Form>
|
||||
</CardContent>
|
||||
</Card>
|
||||
</div>
|
||||
)
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
import { apiClient } from "@client/lib/api-fetch"
|
||||
import { getHydrateData } from "@client/lib/helper"
|
||||
import type { LoginHydrateData } from "@client/pages/(login)/login/metadata"
|
||||
import { getProviders } from "@follow/shared/auth"
|
||||
import { capitalizeFirstLetter, isBizId, parseUrl } from "@follow/utils/utils"
|
||||
import { useQuery } from "@tanstack/react-query"
|
||||
@@ -56,20 +57,22 @@ export const useUserQuery = (handleOrId: string | undefined) => {
|
||||
initialData: getHydrateData(`profiles.$get,query:id=${handleOrId}`),
|
||||
})
|
||||
}
|
||||
|
||||
export interface AuthProvider {
|
||||
name: string
|
||||
id: string
|
||||
color: string
|
||||
icon: string
|
||||
}
|
||||
const getTypedProviders = async () => {
|
||||
const providers = await getProviders()
|
||||
return providers.data as Record<string, AuthProvider>
|
||||
}
|
||||
export const useAuthProviders = () => {
|
||||
return useQuery({
|
||||
queryKey: ["providers"],
|
||||
queryFn: async () => (await getProviders()).data,
|
||||
placeholderData: {
|
||||
google: {
|
||||
id: "google",
|
||||
name: "Google",
|
||||
},
|
||||
github: {
|
||||
id: "github",
|
||||
name: "GitHub",
|
||||
},
|
||||
},
|
||||
queryFn: async () => getTypedProviders(),
|
||||
initialData: getHydrateData(`betterAuth`) as LoginHydrateData,
|
||||
})
|
||||
}
|
||||
|
||||
export { getTypedProviders as getAuthProviders }
|
||||
|
||||
@@ -4,12 +4,12 @@ import { dirname } from "node:path"
|
||||
import { fileURLToPath } from "node:url"
|
||||
|
||||
import chokidar from "chokidar"
|
||||
import { glob } from "glob"
|
||||
import fg from "fast-glob"
|
||||
|
||||
const __dirname = dirname(fileURLToPath(import.meta.url))
|
||||
|
||||
async function generateMetaMap() {
|
||||
const files = await glob("./client/pages/(main)/**/metadata.ts", {
|
||||
const files = await fg.glob("./client/pages/**/*/metadata.ts", {
|
||||
cwd: path.resolve(__dirname, ".."),
|
||||
})
|
||||
|
||||
@@ -18,10 +18,13 @@ async function generateMetaMap() {
|
||||
|
||||
files.forEach((file, index) => {
|
||||
const routePath = file
|
||||
.replace("client/pages/(main)", "")
|
||||
.replace("client/pages/", "")
|
||||
.replace("/metadata.ts", "")
|
||||
.replaceAll(/\[([^\]]+)\]/g, ":$1")
|
||||
|
||||
.replaceAll(/\([^)]+\)\//g, "")
|
||||
.replace(/^\./, "")
|
||||
|
||||
const importName = `i${index}`
|
||||
imports.push(`import ${importName} from "../${file.replace(".ts", "")}"`)
|
||||
routes[routePath] = importName
|
||||
@@ -47,7 +50,7 @@ ${Object.entries(routes)
|
||||
}
|
||||
|
||||
async function watch() {
|
||||
const watchPath = path.resolve(__dirname, "..", "./client/pages/(main)")
|
||||
const watchPath = path.resolve(__dirname, "..", "./client/pages")
|
||||
console.info("Watching metadata files...")
|
||||
|
||||
await generateMetaMap()
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
"rc-modal-sheet": "0.3.2",
|
||||
"react": "^18.3.1",
|
||||
"react-blurhash": "^0.3.0",
|
||||
"react-hook-form": "7.54.0",
|
||||
"react-hotkeys-hook": "4.6.1",
|
||||
"react-i18next": "^15.1.3",
|
||||
"react-photo-view": "1.2.6",
|
||||
@@ -35,7 +36,8 @@
|
||||
"sonner": "1.7.1",
|
||||
"tailwindcss": "3.4.16",
|
||||
"use-context-selector": "2.0.0",
|
||||
"xss": "1.0.15"
|
||||
"xss": "1.0.15",
|
||||
"zod": "3.23.8"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@follow/components": "workspace:*",
|
||||
|
||||
@@ -9,13 +9,9 @@ import { ofetch } from "ofetch"
|
||||
import PKG from "../../../../package.json"
|
||||
import { isDev } from "./env"
|
||||
|
||||
export const createApiClient = () => {
|
||||
const authSessionToken = getTokenFromCookie(requestContext.get("req")?.headers.cookie || "")
|
||||
|
||||
const getBaseURL = () => {
|
||||
const req = requestContext.get("req")!
|
||||
|
||||
const { host } = req.headers
|
||||
|
||||
let baseURL = env.VITE_EXTERNAL_API_URL || env.VITE_API_URL
|
||||
|
||||
if (env.VITE_EXTERNAL_API_URL?.startsWith("/")) {
|
||||
@@ -29,11 +25,14 @@ export const createApiClient = () => {
|
||||
if (upstreamEnv === "prod" && env.VITE_EXTERNAL_PROD_API_URL) {
|
||||
baseURL = env.VITE_EXTERNAL_PROD_API_URL
|
||||
}
|
||||
return baseURL
|
||||
}
|
||||
export const createApiFetch = () => {
|
||||
const baseURL = getBaseURL()
|
||||
|
||||
const apiFetch = ofetch.create({
|
||||
return ofetch.create({
|
||||
credentials: "include",
|
||||
retry: false,
|
||||
|
||||
onRequest(context) {
|
||||
if (isDev) console.info(`request: ${context.request}`)
|
||||
|
||||
@@ -44,7 +43,14 @@ export const createApiClient = () => {
|
||||
return
|
||||
}
|
||||
},
|
||||
baseURL,
|
||||
})
|
||||
}
|
||||
export const createApiClient = () => {
|
||||
const authSessionToken = getTokenFromCookie(requestContext.get("req")?.headers.cookie || "")
|
||||
|
||||
const baseURL = getBaseURL()
|
||||
const apiFetch = createApiFetch()
|
||||
|
||||
const apiClient = hc<AppType>(baseURL, {
|
||||
fetch: async (input: any, options = {}) => apiFetch(input.toString(), options),
|
||||
|
||||
@@ -1,10 +1,12 @@
|
||||
// This file is generated by `pnpm run meta`
|
||||
import i1 from "../client/pages/(main)/share/feeds/[id]/metadata"
|
||||
import i2 from "../client/pages/(main)/share/lists/[id]/metadata"
|
||||
import i0 from "../client/pages/(main)/share/users/[id]/metadata"
|
||||
import i0 from ".././client/pages/(login)/login/metadata"
|
||||
import i3 from ".././client/pages/(main)/share/feeds/[id]/metadata"
|
||||
import i2 from ".././client/pages/(main)/share/lists/[id]/metadata"
|
||||
import i1 from ".././client/pages/(main)/share/users/[id]/metadata"
|
||||
|
||||
export default {
|
||||
"/share/users/:id": i0,
|
||||
"/share/feeds/:id": i1,
|
||||
"/login": i0,
|
||||
"/share/users/:id": i1,
|
||||
"/share/lists/:id": i2,
|
||||
"/share/feeds/:id": i3,
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
## New Features
|
||||
|
||||
- Register or Login with email and password
|
||||
|
||||
## Improvements
|
||||
|
||||
## Bug Fixes
|
||||
|
||||
Vendored
+1
-1
@@ -15,7 +15,7 @@
|
||||
"invitation.getCodeMessage": "You can get an invitation code through the following ways:",
|
||||
"invitation.title": "Invitation Code",
|
||||
"login.backToWebApp": "Back to the web app",
|
||||
"login.logInTo": "Log in to ",
|
||||
"login.logInTo": "Login to ",
|
||||
"login.openApp": "Open app",
|
||||
"login.redirecting": "Redirecting",
|
||||
"login.welcomeTo": "Welcome to ",
|
||||
|
||||
Vendored
+25
-2
@@ -34,14 +34,37 @@
|
||||
"invitation.getCodeMessage": "You can get an invitation code in the following ways:",
|
||||
"invitation.title": "Invitation Code",
|
||||
"login.backToWebApp": "Back To Web App",
|
||||
"login.confirm_password.label": "Confirm Password",
|
||||
"login.continueWith": "Continue with {{provider}}",
|
||||
"login.logInTo": "Log in to ",
|
||||
"login.email": "Email",
|
||||
"login.forget_password.description": "Enter the email address associated with your account and we’ll send you an email about how to reset your password.",
|
||||
"login.forget_password.label": "Forget Password",
|
||||
"login.forget_password.note": "Forgot your password?",
|
||||
"login.forget_password.success": "Email has been sent successfully",
|
||||
"login.logInTo": "Login to ",
|
||||
"login.logInWithEmail": "Login with email",
|
||||
"login.new_password.label": "New Password",
|
||||
"login.openApp": "Open App",
|
||||
"login.or": "Or",
|
||||
"login.password": "Password",
|
||||
"login.redirecting": "Redirecting",
|
||||
"login.register": "Create one",
|
||||
"login.reset_password.description": "Enter new password and confirm it to reset your password",
|
||||
"login.reset_password.label": "Reset Password",
|
||||
"login.reset_password.success": "Password has been successfully reset",
|
||||
"login.signOut": "Sign out",
|
||||
"login.signUp": "Sign up with email",
|
||||
"login.submit": "Submit",
|
||||
"login.welcomeTo": "Welcome to ",
|
||||
"redirect.continueInBrowser": "Continue in Browser",
|
||||
"redirect.instruction": "Now is the time to open {{app_name}} and safely close this page.",
|
||||
"redirect.openApp": "Open {{app_name}}",
|
||||
"redirect.successMessage": "You have successfully connected to {{app_name}} Account."
|
||||
"redirect.successMessage": "You have successfully connected to {{app_name}} Account.",
|
||||
"register.confirm_password": "Confirm Password",
|
||||
"register.email": "Email",
|
||||
"register.label": "Create a {{app_name}} account",
|
||||
"register.login": "Login",
|
||||
"register.note": "Already have an account? <LoginLink />",
|
||||
"register.password": "Password",
|
||||
"register.submit": "Create account"
|
||||
}
|
||||
|
||||
@@ -259,14 +259,25 @@
|
||||
"lists.title": "Title",
|
||||
"lists.view": "View",
|
||||
"profile.avatar.label": "Avatar",
|
||||
"profile.change_password.label": "Change Password",
|
||||
"profile.confirm_password.label": "Confirm Password",
|
||||
"profile.current_password.label": "Current Password",
|
||||
"profile.email.label": "Email",
|
||||
"profile.email.send_verification": "Send Verification Email",
|
||||
"profile.email.unverified": "Unverified",
|
||||
"profile.email.verification_sent": "Email verification sent",
|
||||
"profile.email.verified": "Verified",
|
||||
"profile.handle.description": "Your unique identifier.",
|
||||
"profile.handle.label": "Handle",
|
||||
"profile.name.description": "Your public display name.",
|
||||
"profile.name.label": "Display Name",
|
||||
"profile.new_password.label": "New Password",
|
||||
"profile.reset_password_mail_sent": "Reset password mail sent.",
|
||||
"profile.sidebar_title": "Profile",
|
||||
"profile.submit": "Submit",
|
||||
"profile.title": "Profile Settings",
|
||||
"profile.updateSuccess": "Profile updated.",
|
||||
"profile.update_password_success": "Password updated.",
|
||||
"titles.about": "About",
|
||||
"titles.actions": "Actions",
|
||||
"titles.appearance": "Appearance",
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
{
|
||||
"name": "Follow",
|
||||
"type": "module",
|
||||
"version": "0.2.7-beta.0",
|
||||
"version": "0.2.7-beta.1",
|
||||
"private": true,
|
||||
"packageManager": "pnpm@9.12.3",
|
||||
"description": "Follow your favorites in one inbox",
|
||||
|
||||
@@ -216,17 +216,17 @@ export const Button = React.forwardRef<
|
||||
buttonClassName?: string
|
||||
}
|
||||
>
|
||||
>(({ className, buttonClassName, isLoading, variant, status, ...props }, ref) => {
|
||||
>(({ className, buttonClassName, disabled, isLoading, variant, status, ...props }, ref) => {
|
||||
const handleClick: React.MouseEventHandler<HTMLButtonElement> = React.useCallback(
|
||||
(e) => {
|
||||
if (isLoading || props.disabled) {
|
||||
if (isLoading || disabled) {
|
||||
e.preventDefault()
|
||||
return
|
||||
}
|
||||
|
||||
props.onClick?.(e)
|
||||
},
|
||||
[isLoading, props],
|
||||
[disabled, isLoading, props],
|
||||
)
|
||||
return (
|
||||
<MotionButtonBase
|
||||
@@ -234,11 +234,12 @@ export const Button = React.forwardRef<
|
||||
className={cn(
|
||||
styledButtonVariant({
|
||||
variant,
|
||||
status: isLoading || props.disabled ? "disabled" : undefined,
|
||||
status: isLoading || disabled ? "disabled" : undefined,
|
||||
}),
|
||||
className,
|
||||
buttonClassName,
|
||||
)}
|
||||
disabled={isLoading || disabled}
|
||||
{...props}
|
||||
onClick={handleClick}
|
||||
>
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import { env } from "@follow/shared/env"
|
||||
import type { authPlugins } from "@follow/shared/hono"
|
||||
import type { BetterAuthClientPlugin } from "better-auth/client"
|
||||
import { inferAdditionalFields } from "better-auth/client/plugins"
|
||||
import { createAuthClient } from "better-auth/react"
|
||||
|
||||
import { IN_ELECTRON, WEB_URL } from "./constants"
|
||||
@@ -14,6 +15,14 @@ const serverPlugins = [
|
||||
id: "createSession",
|
||||
$InferServerPlugin: {} as (typeof authPlugins)[1],
|
||||
},
|
||||
inferAdditionalFields({
|
||||
user: {
|
||||
handle: {
|
||||
type: "string",
|
||||
required: false,
|
||||
},
|
||||
},
|
||||
}),
|
||||
] satisfies BetterAuthClientPlugin[]
|
||||
|
||||
const authClient = createAuthClient({
|
||||
@@ -21,14 +30,45 @@ const authClient = createAuthClient({
|
||||
plugins: serverPlugins,
|
||||
})
|
||||
|
||||
export const { signIn, signOut, getSession, getProviders, createSession } = authClient
|
||||
// @keep-sorted
|
||||
export const {
|
||||
changePassword,
|
||||
createSession,
|
||||
forgetPassword,
|
||||
getProviders,
|
||||
getSession,
|
||||
linkSocial,
|
||||
listAccounts,
|
||||
resetPassword,
|
||||
sendVerificationEmail,
|
||||
signIn,
|
||||
signOut,
|
||||
signUp,
|
||||
updateUser,
|
||||
} = authClient
|
||||
|
||||
export const LOGIN_CALLBACK_URL = `${WEB_URL}/login`
|
||||
export type LoginRuntime = "browser" | "app"
|
||||
export const loginHandler = (provider: string, runtime: LoginRuntime = "app") => {
|
||||
export const loginHandler = async (
|
||||
provider: string,
|
||||
runtime?: LoginRuntime,
|
||||
args?: {
|
||||
email?: string
|
||||
password?: string
|
||||
},
|
||||
) => {
|
||||
const { email, password } = args ?? {}
|
||||
if (IN_ELECTRON) {
|
||||
window.open(`${WEB_URL}/login?provider=${provider}`)
|
||||
} else {
|
||||
if (provider === "credential") {
|
||||
if (!email || !password) {
|
||||
window.location.href = "/login"
|
||||
return
|
||||
}
|
||||
return signIn.email({ email, password })
|
||||
}
|
||||
|
||||
signIn.social({
|
||||
provider: provider as "google" | "github" | "apple",
|
||||
callbackURL: runtime === "app" ? LOGIN_CALLBACK_URL : undefined,
|
||||
|
||||
+373
-191
File diff suppressed because it is too large
Load Diff
Generated
+6
@@ -804,6 +804,9 @@ importers:
|
||||
react-blurhash:
|
||||
specifier: ^0.3.0
|
||||
version: 0.3.0(blurhash@2.0.5)(react@18.3.1)
|
||||
react-hook-form:
|
||||
specifier: 7.54.0
|
||||
version: 7.54.0(react@18.3.1)
|
||||
react-hotkeys-hook:
|
||||
specifier: 4.6.1
|
||||
version: 4.6.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1)
|
||||
@@ -831,6 +834,9 @@ importers:
|
||||
xss:
|
||||
specifier: 1.0.15
|
||||
version: 1.0.15
|
||||
zod:
|
||||
specifier: 3.23.8
|
||||
version: 3.23.8
|
||||
devDependencies:
|
||||
'@follow/components':
|
||||
specifier: workspace:*
|
||||
|
||||
Reference in New Issue
Block a user