Fix jwt-token
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
import React, { useState, useEffect } from 'react'
|
import React, { useState, useEffect } from 'react'
|
||||||
import { XMarkIcon, EyeIcon, EyeSlashIcon } from '@heroicons/react/24/outline'
|
import { XMarkIcon, EyeIcon, EyeSlashIcon } from '@heroicons/react/24/outline'
|
||||||
import toast from 'react-hot-toast'
|
import toast from 'react-hot-toast'
|
||||||
|
import { t } from '../utils/tempTranslations' // Temporary translation system
|
||||||
|
|
||||||
const TenantModal = ({ isOpen, onClose, tenant = null, onSave }) => {
|
const TenantModal = ({ isOpen, onClose, tenant = null, onSave }) => {
|
||||||
const [formData, setFormData] = useState({
|
const [formData, setFormData] = useState({
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
import React, { useState } from 'react'
|
import React, { useState } from 'react'
|
||||||
import { Navigate } from 'react-router-dom'
|
import { Navigate } from 'react-router-dom'
|
||||||
import { useAuth } from '../contexts/AuthContext'
|
import { useAuth } from '../contexts/AuthContext'
|
||||||
|
import { t } from '../utils/tempTranslations' // Temporary translation system
|
||||||
import { EyeIcon, EyeSlashIcon } from '@heroicons/react/24/outline'
|
import { EyeIcon, EyeSlashIcon } from '@heroicons/react/24/outline'
|
||||||
|
|
||||||
const Login = () => {
|
const Login = () => {
|
||||||
@@ -40,10 +41,10 @@ const Login = () => {
|
|||||||
<div className="max-w-md w-full space-y-8">
|
<div className="max-w-md w-full space-y-8">
|
||||||
<div>
|
<div>
|
||||||
<h2 className="mt-6 text-center text-3xl font-extrabold text-gray-900">
|
<h2 className="mt-6 text-center text-3xl font-extrabold text-gray-900">
|
||||||
UAMILS Management Portal
|
{t('auth.portalTitle')}
|
||||||
</h2>
|
</h2>
|
||||||
<p className="mt-2 text-center text-sm text-gray-600">
|
<p className="mt-2 text-center text-sm text-gray-600">
|
||||||
Sign in to manage tenants and system configuration
|
{t('auth.loginDescription')}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
@@ -51,7 +52,7 @@ const Login = () => {
|
|||||||
<div className="rounded-md shadow-sm -space-y-px">
|
<div className="rounded-md shadow-sm -space-y-px">
|
||||||
<div>
|
<div>
|
||||||
<label htmlFor="username" className="sr-only">
|
<label htmlFor="username" className="sr-only">
|
||||||
Username
|
{t('auth.username')}
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
id="username"
|
id="username"
|
||||||
@@ -59,7 +60,7 @@ const Login = () => {
|
|||||||
type="text"
|
type="text"
|
||||||
required
|
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"
|
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}
|
value={formData.username}
|
||||||
onChange={handleInputChange}
|
onChange={handleInputChange}
|
||||||
disabled={loading}
|
disabled={loading}
|
||||||
@@ -67,7 +68,7 @@ const Login = () => {
|
|||||||
</div>
|
</div>
|
||||||
<div className="relative">
|
<div className="relative">
|
||||||
<label htmlFor="password" className="sr-only">
|
<label htmlFor="password" className="sr-only">
|
||||||
Password
|
{t('auth.password')}
|
||||||
</label>
|
</label>
|
||||||
<input
|
<input
|
||||||
id="password"
|
id="password"
|
||||||
@@ -75,7 +76,7 @@ const Login = () => {
|
|||||||
type={showPassword ? 'text' : 'password'}
|
type={showPassword ? 'text' : 'password'}
|
||||||
required
|
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"
|
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}
|
value={formData.password}
|
||||||
onChange={handleInputChange}
|
onChange={handleInputChange}
|
||||||
disabled={loading}
|
disabled={loading}
|
||||||
@@ -103,17 +104,17 @@ const Login = () => {
|
|||||||
{loading ? (
|
{loading ? (
|
||||||
<div className="flex items-center">
|
<div className="flex items-center">
|
||||||
<div className="animate-spin rounded-full h-4 w-4 border-b-2 border-white mr-2"></div>
|
<div className="animate-spin rounded-full h-4 w-4 border-b-2 border-white mr-2"></div>
|
||||||
Signing in...
|
{t('auth.signingIn')}
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : (
|
||||||
'Sign in'
|
t('auth.signIn')
|
||||||
)}
|
)}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div className="text-center">
|
<div className="text-center">
|
||||||
<p className="text-xs text-gray-500">
|
<p className="text-xs text-gray-500">
|
||||||
Admin access required. Default: admin / admin123
|
{t('auth.adminAccess')}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
|
|||||||
@@ -34,7 +34,7 @@ const System = () => {
|
|||||||
setLastUpdate(new Date())
|
setLastUpdate(new Date())
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error('Failed to load system info:', error)
|
console.error('Failed to load system info:', error)
|
||||||
toast.error('Failed to load system information')
|
toast.error(t('system.loadError'))
|
||||||
} finally {
|
} finally {
|
||||||
setLoading(false)
|
setLoading(false)
|
||||||
}
|
}
|
||||||
@@ -291,14 +291,14 @@ const System = () => {
|
|||||||
return (
|
return (
|
||||||
<div className="text-center py-12">
|
<div className="text-center py-12">
|
||||||
<XCircleIcon className="mx-auto h-12 w-12 text-red-400" />
|
<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>
|
<h3 className="mt-2 text-sm font-medium text-gray-900">{t('system.noInformation')}</h3>
|
||||||
<p className="mt-1 text-sm text-gray-500">Unable to load system metrics.</p>
|
<p className="mt-1 text-sm text-gray-500">{t('system.noInformationDescription')}</p>
|
||||||
<div className="mt-6">
|
<div className="mt-6">
|
||||||
<button
|
<button
|
||||||
onClick={loadSystemInfo}
|
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"
|
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>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -309,11 +309,11 @@ const System = () => {
|
|||||||
<div>
|
<div>
|
||||||
<div className="mb-8 flex justify-between items-center">
|
<div className="mb-8 flex justify-between items-center">
|
||||||
<div>
|
<div>
|
||||||
<h1 className="text-2xl font-bold text-gray-900">System Monitor</h1>
|
<h1 className="text-2xl font-bold text-gray-900">{t('system.title')}</h1>
|
||||||
<p className="text-gray-600">Real-time system health and configuration monitoring</p>
|
<p className="text-gray-600">{t('system.description')}</p>
|
||||||
{lastUpdate && (
|
{lastUpdate && (
|
||||||
<p className="text-xs text-gray-400 mt-1">
|
<p className="text-xs text-gray-400 mt-1">
|
||||||
Last updated: {lastUpdate.toLocaleTimeString()}
|
{t('system.lastUpdated')}: {lastUpdate.toLocaleTimeString()}
|
||||||
</p>
|
</p>
|
||||||
)}
|
)}
|
||||||
</div>
|
</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"
|
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" />
|
<CogIcon className="h-4 w-4 mr-2" />
|
||||||
Refresh
|
{t('common.refresh')}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{/* Platform Overview */}
|
{/* Platform Overview */}
|
||||||
<div className="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-4 gap-6 mb-8">
|
<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="space-y-3">
|
||||||
<div className="flex justify-between">
|
<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>
|
<span className="text-sm font-medium">{systemInfo.platform.version}</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex justify-between">
|
<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>
|
<span className="text-sm font-medium capitalize">{systemInfo.platform.environment}</span>
|
||||||
</div>
|
</div>
|
||||||
<div className="flex justify-between">
|
<div className="flex justify-between">
|
||||||
|
|||||||
@@ -91,12 +91,20 @@ const translations = {
|
|||||||
issues: 'Issues'
|
issues: 'Issues'
|
||||||
},
|
},
|
||||||
system: {
|
system: {
|
||||||
title: 'System Information',
|
title: 'System Monitor',
|
||||||
|
description: 'Real-time system health and configuration monitoring',
|
||||||
serverInfo: 'Server Information',
|
serverInfo: 'Server Information',
|
||||||
databaseInfo: 'Database Information',
|
databaseInfo: 'Database Information',
|
||||||
version: 'Version',
|
version: 'Version',
|
||||||
|
environment: 'Environment',
|
||||||
uptime: 'Uptime',
|
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: {
|
common: {
|
||||||
loading: 'Loading...',
|
loading: 'Loading...',
|
||||||
@@ -125,7 +133,12 @@ const translations = {
|
|||||||
username: 'Username',
|
username: 'Username',
|
||||||
password: 'Password',
|
password: 'Password',
|
||||||
loginButton: 'Sign In',
|
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: {
|
sv: {
|
||||||
@@ -219,12 +232,20 @@ const translations = {
|
|||||||
issues: 'Problem'
|
issues: 'Problem'
|
||||||
},
|
},
|
||||||
system: {
|
system: {
|
||||||
title: 'Systeminformation',
|
title: 'Systemövervakning',
|
||||||
|
description: 'Realtid systemhälsa och konfigurationsövervakning',
|
||||||
serverInfo: 'Serverinformation',
|
serverInfo: 'Serverinformation',
|
||||||
databaseInfo: 'Databasinformation',
|
databaseInfo: 'Databasinformation',
|
||||||
version: 'Version',
|
version: 'Version',
|
||||||
|
environment: 'Miljö',
|
||||||
uptime: 'Drifttid',
|
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: {
|
common: {
|
||||||
loading: 'Laddar...',
|
loading: 'Laddar...',
|
||||||
@@ -253,7 +274,12 @@ const translations = {
|
|||||||
username: 'Användarnamn',
|
username: 'Användarnamn',
|
||||||
password: 'Lösenord',
|
password: 'Lösenord',
|
||||||
loginButton: 'Logga in',
|
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'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user