diff --git a/client/src/features/order-chat/ui/OrderChat.tsx b/client/src/features/order-chat/ui/OrderChat.tsx
index 65eac11..ad07c43 100644
--- a/client/src/features/order-chat/ui/OrderChat.tsx
+++ b/client/src/features/order-chat/ui/OrderChat.tsx
@@ -53,12 +53,7 @@ export function OrderChat({ messages, isPending, onSend }: Props) {
const isAdminMsg = m.authorType === 'admin'
const adminAv = adminAvatarQuery.data
const avatarNode = isAdminMsg ? (
-
+
) : currentUser ? (
([])
+ const [showSetPassword, setShowSetPassword] = useState(false)
+ const passwordForm = useForm<{ password: string; passwordConfirm: string }>({
+ defaultValues: { password: '', passwordConfirm: '' },
+ })
+
+ useEffect(() => {
+ fetchAuthMethodsFx().then(setAuthMethods).catch(() => {
+ setAuthMethods([])
+ })
+ }, [])
+
+ const setPasswordMutation = useMutation({
+ mutationFn: async (pw: string) => {
+ await setPasswordFx(pw)
+ const methods = await fetchAuthMethodsFx()
+ setAuthMethods(methods)
+ setShowSetPassword(false)
+ },
+ onError: () => {},
+ })
+
+ const unlinkMutation = useMutation({
+ mutationFn: async (provider: 'vk' | 'yandex') => {
+ await unlinkOAuthFx(provider)
+ const methods = await fetchAuthMethodsFx()
+ setAuthMethods(methods)
+ },
+ onError: () => {},
+ })
+
+ const linkedCount = useCallback(() => {
+ return authMethods.filter((m) => m.active).length
+ }, [authMethods])
+
+ const METHOD_LABELS: Record = { password: 'Пароль', vk: 'ВКонтакте', yandex: 'Яндекс' }
+
if (!user) {
return Нужно войти. Перейдите на страницу «Вход».
}
@@ -134,7 +177,7 @@ export function SettingsPage() {
}}
/>
- {hasUnsavedPreview ? 'Предпросмотр' : hasAvatar ? 'Сохранён' : 'Авто'}
+ {hasUnsavedPreview ? 'Предпросмотр' : user.avatar ? 'Сохранён' : 'Авто'}
{hasUnsavedPreview && (
@@ -201,6 +244,94 @@ export function SettingsPage() {
)}
+ {!user.isAdmin && (
+ <>
+
+
+
+ Методы входа
+
+
+ {authMethods.map((m) => (
+
+ {METHOD_LABELS[m.type] || m.type}
+
+ {m.active && m.type !== 'password' && (
+
+ )}
+ {!m.active && m.type === 'password' && (
+
+ )}
+ {!m.active && m.type !== 'password' && (
+
+ )}
+
+ ))}
+
+
+ {showSetPassword && (
+
+
+
+
+
+
+
+
+ )}
+
+ >
+ )}
+