diff --git a/modules/web/src/app/login/page.tsx b/modules/web/src/app/login/page.tsx
index c7c33c4..330cf65 100644
--- a/modules/web/src/app/login/page.tsx
+++ b/modules/web/src/app/login/page.tsx
@@ -1,8 +1,11 @@
'use client'
import React, { useEffect, useState } from 'react';
-import { Box, Typography, TextField, Button, Link } from '@mui/material';
+import { Box, Typography, TextField, Button, Link, IconButton, InputAdornment } from '@mui/material';
import PersonIcon from '@mui/icons-material/Person';
+import VisibilityIcon from '@mui/icons-material/Visibility';
+import VisibilityOffIcon from '@mui/icons-material/VisibilityOff';
+import ContentPasteIcon from '@mui/icons-material/ContentPaste';
import GitHubIcon from '@mui/icons-material/GitHub';
import { getVersion } from '@/api/version';
import { useStorage } from '@/hook/useStorage';
@@ -17,6 +20,7 @@ import { useI18n } from '@/hook/useI18n';
const LoginPage = () => {
const [token, setToken] = useState('');
const [tokenError, setTokenError] = useState('');
+ const [showToken, setShowToken] = useState(false);
const [storedToken, setStoredToken] = useStorage('token');
const [cookie, setCookie] = useCookie('dashboard_user');
const { error } = useAlert();
@@ -56,6 +60,16 @@ const LoginPage = () => {
}
};
+ const handlePaste = async () => {
+ try {
+ if (typeof navigator !== 'undefined' && navigator.clipboard && typeof navigator.clipboard.readText === 'function') {
+ const text = await navigator.clipboard.readText();
+ setToken(text || '');
+ setTokenError('');
+ }
+ } catch (_) {}
+ };
+
const handleRunKeink = () => {
showConfirmDialog({
title: t("login.installByKeink"),
@@ -104,13 +118,25 @@ const LoginPage = () => {
),
+ endAdornment: (
+
+
+
+
+ setShowToken(!showToken)} edge="end">
+ {showToken ? : }
+
+
+ ),
}}
value={token}
- onChange={(e) => setToken(e.target.value)}
+ onChange={(e) => { setToken(e.target.value); if (tokenError) setTokenError(''); }}
+ onKeyDown={(e) => { if (e.key === 'Enter') handleLogin(); }}
error={!!tokenError}
helperText={tokenError}
sx={{