Fix jwt-token

This commit is contained in:
2025-09-19 13:43:55 +02:00
parent 9a2736d9de
commit 78c5267f63
4 changed files with 54 additions and 26 deletions

View File

@@ -1,6 +1,7 @@
import React, { useState, useEffect } from 'react'
import { XMarkIcon, EyeIcon, EyeSlashIcon } from '@heroicons/react/24/outline'
import toast from 'react-hot-toast'
import { t } from '../utils/tempTranslations' // Temporary translation system
const TenantModal = ({ isOpen, onClose, tenant = null, onSave }) => {
const [formData, setFormData] = useState({

View File

@@ -1,6 +1,7 @@
import React, { useState } from 'react'
import { Navigate } from 'react-router-dom'
import { useAuth } from '../contexts/AuthContext'
import { t } from '../utils/tempTranslations' // Temporary translation system
import { EyeIcon, EyeSlashIcon } from '@heroicons/react/24/outline'
const Login = () => {
@@ -40,10 +41,10 @@ const Login = () => {
<div className="max-w-md w-full space-y-8">
<div>
<h2 className="mt-6 text-center text-3xl font-extrabold text-gray-900">
UAMILS Management Portal
{t('auth.portalTitle')}
</h2>
<p className="mt-2 text-center text-sm text-gray-600">
Sign in to manage tenants and system configuration
{t('auth.loginDescription')}
</p>
</div>
@@ -51,7 +52,7 @@ const Login = () => {
<div className="rounded-md shadow-sm -space-y-px">
<div>
<label htmlFor="username" className="sr-only">
Username
{t('auth.username')}
</label>
<input
id="username"
@@ -59,7 +60,7 @@ const Login = () => {
type="text"
required
className="appearance-none rounded-none relative block w-full px-3 py-2 border border-gray-300 placeholder-gray-500 text-gray-900 rounded-t-md focus:outline-none focus:ring-blue-500 focus:border-blue-500 focus:z-10 sm:text-sm"
placeholder="Username"
placeholder={t('auth.username')}
value={formData.username}
onChange={handleInputChange}
disabled={loading}
@@ -67,7 +68,7 @@ const Login = () => {
</div>
<div className="relative">
<label htmlFor="password" className="sr-only">
Password
{t('auth.password')}
</label>
<input
id="password"
@@ -75,7 +76,7 @@ const Login = () => {
type={showPassword ? 'text' : 'password'}
required
className="appearance-none rounded-none relative block w-full px-3 py-2 pr-10 border border-gray-300 placeholder-gray-500 text-gray-900 rounded-b-md focus:outline-none focus:ring-blue-500 focus:border-blue-500 focus:z-10 sm:text-sm"
placeholder="Password"
placeholder={t('auth.password')}
value={formData.password}
onChange={handleInputChange}
disabled={loading}
@@ -103,17 +104,17 @@ const Login = () => {
{loading ? (
<div className="flex items-center">
<div className="animate-spin rounded-full h-4 w-4 border-b-2 border-white mr-2"></div>
Signing in...
{t('auth.signingIn')}
</div>
) : (
'Sign in'
t('auth.signIn')
)}
</button>
</div>
<div className="text-center">
<p className="text-xs text-gray-500">
Admin access required. Default: admin / admin123
{t('auth.adminAccess')}
</p>
</div>
</form>

View File

@@ -34,7 +34,7 @@ const System = () => {
setLastUpdate(new Date())
} catch (error) {
console.error('Failed to load system info:', error)
toast.error('Failed to load system information')
toast.error(t('system.loadError'))
} finally {
setLoading(false)
}
@@ -291,14 +291,14 @@ const System = () => {
return (
<div className="text-center py-12">
<XCircleIcon className="mx-auto h-12 w-12 text-red-400" />
<h3 className="mt-2 text-sm font-medium text-gray-900">No system information available</h3>
<p className="mt-1 text-sm text-gray-500">Unable to load system metrics.</p>
<h3 className="mt-2 text-sm font-medium text-gray-900">{t('system.noInformation')}</h3>
<p className="mt-1 text-sm text-gray-500">{t('system.noInformationDescription')}</p>
<div className="mt-6">
<button
onClick={loadSystemInfo}
className="inline-flex items-center px-4 py-2 border border-transparent shadow-sm text-sm font-medium rounded-md text-white bg-blue-600 hover:bg-blue-700"
>
Retry
{t('system.retry')}
</button>
</div>
</div>
@@ -309,11 +309,11 @@ const System = () => {
<div>
<div className="mb-8 flex justify-between items-center">
<div>
<h1 className="text-2xl font-bold text-gray-900">System Monitor</h1>
<p className="text-gray-600">Real-time system health and configuration monitoring</p>
<h1 className="text-2xl font-bold text-gray-900">{t('system.title')}</h1>
<p className="text-gray-600">{t('system.description')}</p>
{lastUpdate && (
<p className="text-xs text-gray-400 mt-1">
Last updated: {lastUpdate.toLocaleTimeString()}
{t('system.lastUpdated')}: {lastUpdate.toLocaleTimeString()}
</p>
)}
</div>
@@ -322,20 +322,20 @@ const System = () => {
className="inline-flex items-center px-3 py-2 border border-gray-300 shadow-sm text-sm leading-4 font-medium rounded-md text-gray-700 bg-white hover:bg-gray-50"
>
<CogIcon className="h-4 w-4 mr-2" />
Refresh
{t('common.refresh')}
</button>
</div>
{/* Platform Overview */}
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8">
<StatusCard title="Platform Status" icon={ServerIcon}>
<StatusCard title={t('system.platformStatus')} icon={ServerIcon}>
<div className="space-y-3">
<div className="flex justify-between">
<span className="text-sm text-gray-500">Version</span>
<span className="text-sm text-gray-500">{t('system.version')}</span>
<span className="text-sm font-medium">{systemInfo.platform.version}</span>
</div>
<div className="flex justify-between">
<span className="text-sm text-gray-500">Environment</span>
<span className="text-sm text-gray-500">{t('system.environment')}</span>
<span className="text-sm font-medium capitalize">{systemInfo.platform.environment}</span>
</div>
<div className="flex justify-between">

View File

@@ -91,12 +91,20 @@ const translations = {
issues: 'Issues'
},
system: {
title: 'System Information',
title: 'System Monitor',
description: 'Real-time system health and configuration monitoring',
serverInfo: 'Server Information',
databaseInfo: 'Database Information',
version: 'Version',
environment: 'Environment',
uptime: 'Uptime',
platform: 'Platform'
platform: 'Platform',
platformStatus: 'Platform Status',
lastUpdated: 'Last updated',
loadError: 'Failed to load system information',
noInformation: 'No system information available',
noInformationDescription: 'Unable to load system metrics.',
retry: 'Retry'
},
common: {
loading: 'Loading...',
@@ -125,7 +133,12 @@ const translations = {
username: 'Username',
password: 'Password',
loginButton: 'Sign In',
logout: 'Logout'
logout: 'Logout',
portalTitle: 'UAMILS Management Portal',
loginDescription: 'Sign in to manage tenants and system configuration',
signIn: 'Sign in',
signingIn: 'Signing in...',
adminAccess: 'Admin access required. Default: admin / admin123'
}
},
sv: {
@@ -219,12 +232,20 @@ const translations = {
issues: 'Problem'
},
system: {
title: 'Systeminformation',
title: 'Systemövervakning',
description: 'Realtid systemhälsa och konfigurationsövervakning',
serverInfo: 'Serverinformation',
databaseInfo: 'Databasinformation',
version: 'Version',
environment: 'Miljö',
uptime: 'Drifttid',
platform: 'Plattform'
platform: 'Plattform',
platformStatus: 'Plattformsstatus',
lastUpdated: 'Senast uppdaterad',
loadError: 'Misslyckades att ladda systeminformation',
noInformation: 'Ingen systeminformation tillgänglig',
noInformationDescription: 'Kunde inte ladda systemstatistik.',
retry: 'Försök igen'
},
common: {
loading: 'Laddar...',
@@ -253,7 +274,12 @@ const translations = {
username: 'Användarnamn',
password: 'Lösenord',
loginButton: 'Logga in',
logout: 'Logga ut'
logout: 'Logga ut',
portalTitle: 'UAMILS Förvaltningsportal',
loginDescription: 'Logga in för att hantera hyresgäster och systemkonfiguration',
signIn: 'Logga in',
signingIn: 'Loggar in...',
adminAccess: 'Administratörsåtkomst krävs. Standard: admin / admin123'
}
}
};