edit FE shorlink auth, no login route, deployed dicomv.aplikasi.web.id

This commit is contained in:
mario
2025-05-23 14:15:27 +07:00
parent e40d2f0e1d
commit 1a73d898f7
5 changed files with 28 additions and 9 deletions

View File

@@ -3,6 +3,7 @@ window.config = {
routerBasename: '/',
pacs_document_host: `https://${window.location.hostname}`,
pacs_document_port: 8585,
goProxyHost: `https://${window.location.hostname}:5555`,
expertise: false, //* Tambahan untuk enable expertise (CustomizableViewportOverlay)
expertise_host: `https://devone.aplikasi.web.id/one-api/mockup/pacsmwl/Workorder/get_dummy_expertise`, //* Tambahan untuk fetch data Expertise)
enableGoogleCloudAdapter: false,

View File

@@ -63,7 +63,7 @@ function injectAuth() {
// Check for auth errors (401/403) and redirect to login if needed
if (this.status === 401 || this.status === 403) {
window.sessionStorage.removeItem('ohif-auth-token');
window.location.href = '/login';
// window.location.href = '/login'; // Kalau mau pakae login tinggal uncomment
}
} catch (e) {
console.error('Error handling auth response:', e);

View File

@@ -1,6 +1,7 @@
import React, { useState, useEffect } from 'react';
import { useNavigate, useLocation } from 'react-router-dom';
import { useUserAuthentication } from '@ohif/ui';
import { Icons } from '@ohif/ui-next';
const Login = () => {
const [email, setEmail] = useState('');
@@ -83,8 +84,13 @@ const Login = () => {
return (
<div className="flex h-screen w-screen items-center justify-center bg-black">
<div className="bg-primary-dark w-96 rounded p-8 shadow-lg">
<h1 className="mb-8 text-center text-2xl font-bold text-white">Login to OHIF Viewer</h1>
<div className="bg-popover w-88 rounded p-8 shadow-lg">
<div className="mb-4 flex justify-center">
<Icons.OHIFLogo className="h-12 text-white" />
</div>
<h2 className="text-md text-center font-bold text-white">Login to</h2>
<h1 className="mb-8 text-center text-2xl font-bold text-white">Cloud DICOM Viewer</h1>
{error && <div className="mb-4 rounded bg-red-800 px-4 py-2 text-white">{error}</div>}
@@ -120,6 +126,9 @@ const Login = () => {
{isLoading ? 'Logging in...' : 'Log In'}
</button>
</div>
<p className="text-muted-foreground mt-8 text-center text-sm">
Powered by OHIF & Google Cloud DICOM Storage
</p>
</form>
</div>
</div>

View File

@@ -1,6 +1,7 @@
import React, { useState, useEffect } from 'react';
import { useNavigate, useLocation } from 'react-router-dom';
import { useUserAuthentication } from '@ohif/ui';
import { Icons } from '@ohif/ui-next';
const ShortlinkLogin = () => {
const [dob, setDob] = useState('');
@@ -22,7 +23,7 @@ const ShortlinkLogin = () => {
// No short token found, redirect to regular login
setError('No shortlink token found in URL');
setTimeout(() => {
navigate('/login', { replace: true });
navigate('/', { replace: true });
}, 3000);
}
}, [location.search, navigate]);
@@ -93,15 +94,19 @@ const ShortlinkLogin = () => {
return (
<div className="flex h-screen w-screen items-center justify-center bg-black">
<div className="bg-primary-dark w-96 rounded p-8 shadow-lg">
<h1 className="mb-8 text-center text-2xl font-bold text-white">Patient Access</h1>
<div className="bg-popover w-88 rounded p-8 shadow-lg">
<div className="mb-4 flex justify-center">
<Icons.OHIFLogo className="h-12 text-white" />
</div>
<h1 className="mb-8 text-center text-2xl font-bold text-white">Cloud DICOM Viewer</h1>
{error && <div className="mb-4 rounded bg-red-800 px-4 py-2 text-white">{error}</div>}
<form onSubmit={handleSubmit}>
<div className="mb-6">
<label className="mb-2 block text-sm font-bold text-white">
Please enter your date of birth
Masukkan tanggal lahir Anda:
</label>
<input
type="date"
@@ -119,9 +124,12 @@ const ShortlinkLogin = () => {
className="focus:shadow-outline w-full rounded bg-blue-500 py-2 px-4 font-bold text-white hover:bg-blue-700 focus:outline-none"
disabled={isLoading || !shortToken}
>
{isLoading ? 'Verifying...' : 'Access My Images'}
{isLoading ? 'Verifying...' : 'View'}
</button>
</div>
<p className="text-muted-foreground mt-8 text-center text-sm">
Powered by OHIF & Google Cloud DICOM Storage
</p>
</form>
</div>
</div>

View File

@@ -25,7 +25,8 @@ export function initializeCustomAuth(userAuthenticationService) {
window.sessionStorage.removeItem('ohif-auth-token');
// Redirect to login page with the redirect URL in query params
window.location.href = `/login?redirect=${encodeURIComponent(currentPath)}`;
// window.location.href = `/login?redirect=${encodeURIComponent(currentPath)}`;
window.location.href = '/';
// Return null to prevent rendering while redirecting
return null;