From e619245f1fa83a29a9ec553ef9017871bb5c27c0 Mon Sep 17 00:00:00 2001
From: l3wdfut4pwr <l3wdfut4pwr@gmail.com>
Date: Wed, 29 Apr 2026 02:07:46 +0300
Subject: add google auth

---
 src/components/settings/SetPasswordField.tsx | 76 ++++++++++++++++++++++++++++
 1 file changed, 76 insertions(+)
 create mode 100644 src/components/settings/SetPasswordField.tsx

(limited to 'src/components/settings/SetPasswordField.tsx')

diff --git a/src/components/settings/SetPasswordField.tsx b/src/components/settings/SetPasswordField.tsx
new file mode 100644
index 0000000..6030c8f
--- /dev/null
+++ b/src/components/settings/SetPasswordField.tsx
@@ -0,0 +1,76 @@
+'use client';
+
+import { useState } from 'react';
+import { InputField } from '@/components/ui/inputfield';
+import { Button } from '@/components/ui/button';
+import { Separator } from '@/components/ui/separator';
+import { setPassword } from '@/lib/api/SetPassword';
+
+export const SetPasswordField = () => {
+    const [newPassword, setNewPassword] = useState('');
+    const [repeatPassword, setRepeatPassword] = useState('');
+    const [loading, setLoading] = useState(false);
+    const [error, setError] = useState<string | null>(null);
+
+    const handleSubmit = async () => {
+        setError(null);
+
+        if (newPassword !== repeatPassword) {
+            setError('Пароли не совпадают');
+            return;
+        }
+
+        if (newPassword.length < 8) {
+            setError('Пароль должен быть минимум 8 символов');
+            return;
+        }
+
+        setLoading(true);
+
+        const res = await setPassword(newPassword, repeatPassword);
+
+        setLoading(false);
+
+        if (res.error) {
+            setError(res.error.general);
+            return;
+        }
+
+        setNewPassword('');
+        setRepeatPassword('');
+    };
+
+    return (
+        <div className="flex flex-col gap-[20px] w-[310px]">
+            <p className="text-light-violet font-medium">ЗАДАТЬ ПАРОЛЬ</p>
+
+            <div className="flex flex-col gap-[10px]">
+                <InputField
+                    placeholder="Введите пароль"
+                    isPassword
+                    type="password"
+                    name="new_password"
+                    value={newPassword}
+                    onChange={(e: any) => setNewPassword(e.target.value)}
+                />
+
+                <InputField
+                    placeholder="Повторите пароль"
+                    isPassword
+                    type="password"
+                    name="repeat_password"
+                    value={repeatPassword}
+                    onChange={(e: any) => setRepeatPassword(e.target.value)}
+                />
+            </div>
+
+            {error && <p className="text-red text-sm">{error}</p>}
+
+            <Button onClick={handleSubmit} disabled={loading}>
+                {loading ? 'Сохранение...' : 'Сменить'}
+            </Button>
+
+            <Separator className="bg-violet/30 h-[1px] w-[900px]" />
+        </div>
+    );
+};
-- 
cgit v1.3-3-g829e

