1 parent
707876825e
commit
cb594bf8e8
1 file changed
+45
-40
@@ -12,12 +12,13 @@ import { Input } from "@/components/ui/input"
|
|||||||
import { Label } from "@/components/ui/label"
|
import { Label } from "@/components/ui/label"
|
||||||
import { useState } from "react"
|
import { useState } from "react"
|
||||||
import { loginUser } from "@/handlers/api/user.handler"
|
import { loginUser } from "@/handlers/api/user.handler"
|
||||||
|
import { useConfig } from "@/contexts/ConfigContext"
|
||||||
|
|
||||||
export const description =
|
export const description =
|
||||||
"A login form with email and password. There's an option to login with Google and a link to sign up if you don't have an account."
|
"A login form with email and password. There's an option to login with Google and a link to sign up if you don't have an account."
|
||||||
|
|
||||||
export function LoginForm() {
|
export function LoginForm() {
|
||||||
|
const { exImmichUrl } = useConfig()
|
||||||
const [formData, setFormData] = useState({
|
const [formData, setFormData] = useState({
|
||||||
email: "",
|
email: "",
|
||||||
password: "",
|
password: "",
|
||||||
@@ -44,45 +45,49 @@ export function LoginForm() {
|
|||||||
|
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Card className="mx-auto max-w-sm">
|
<div className="relative flex min-h-screen justify-center flex-col bg-background">
|
||||||
<CardHeader>
|
<Card className="mx-auto max-w-sm">
|
||||||
<CardTitle className="text-2xl">Login</CardTitle>
|
<CardHeader>
|
||||||
<CardDescription>
|
<img
|
||||||
Enter your email below to login to your account
|
src="/favicon.png"
|
||||||
</CardDescription>
|
width={32}
|
||||||
</CardHeader>
|
height={32}
|
||||||
<CardContent>
|
alt="Immich Power Tools"
|
||||||
<form className="grid gap-4" onSubmit={handleSubmit}>
|
className="w-8 h-8"
|
||||||
<div className="grid gap-2">
|
/>
|
||||||
<Label htmlFor="email">Email</Label>
|
<CardTitle className="text-2xl">Login to Immich</CardTitle>
|
||||||
<Input
|
<CardDescription>
|
||||||
id="email"
|
Login to your connected Immich instance <Link href={exImmichUrl} className="text-xs" target="_blank">({exImmichUrl})</Link>
|
||||||
type="email"
|
</CardDescription>
|
||||||
placeholder="m@example.com"
|
</CardHeader>
|
||||||
required
|
<CardContent>
|
||||||
onChange={handleChange}
|
<form className="grid gap-4" onSubmit={handleSubmit}>
|
||||||
/>
|
<div className="grid gap-2">
|
||||||
</div>
|
<Label htmlFor="email">Email</Label>
|
||||||
<div className="grid gap-2">
|
<Input
|
||||||
<div className="flex items-center">
|
id="email"
|
||||||
<Label htmlFor="password">Password</Label>
|
type="email"
|
||||||
<Link href="#" className="ml-auto inline-block text-sm underline">
|
placeholder="m@example.com"
|
||||||
Forgot your password?
|
required
|
||||||
</Link>
|
onChange={handleChange}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
<Input id="password" type="password" required
|
<div className="grid gap-2">
|
||||||
onChange={handleChange}
|
<Label htmlFor="password">Password</Label>
|
||||||
/>
|
<Input id="password" type="password" required
|
||||||
</div>
|
onChange={handleChange}
|
||||||
<Button type="submit" className="w-full" disabled={loading}>
|
/>
|
||||||
Login
|
</div>
|
||||||
</Button>
|
<Button type="submit" className="w-full" disabled={loading}>
|
||||||
<Button variant="outline" className="w-full" disabled={loading}>
|
Login
|
||||||
Login with Google
|
</Button>
|
||||||
</Button>
|
<Button variant="outline" className="w-full" disabled={loading}>
|
||||||
</form>
|
Login with OAuth
|
||||||
|
</Button>
|
||||||
</CardContent>
|
</form>
|
||||||
</Card>
|
|
||||||
|
</CardContent>
|
||||||
|
</Card>
|
||||||
|
</div>
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user