- update: schema now sets the skills column to prevent a crash
- update: frontend to only pass the session id - update: launcher to pass the session correctly - update: validate session response now returns the session id and user id to the requester - update: auth client based on session id instead of a jwt token
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import React, {useEffect, useState} from "react";
|
||||
import axios from "axios";
|
||||
import {getServiceAddress} from "../utils/consul";
|
||||
import { Link } from "react-router-dom";
|
||||
import {Link} from "react-router-dom";
|
||||
|
||||
const LoginPage = () => {
|
||||
const [apiUrl, setApiUrl] = useState(null);
|
||||
@@ -13,7 +13,7 @@ const LoginPage = () => {
|
||||
// Fetch the API address from Consul
|
||||
const fetchApiUrl = async () => {
|
||||
try {
|
||||
const { ServiceAddress, ServicePort } = await getServiceAddress("api-service");
|
||||
const {ServiceAddress, ServicePort} = await getServiceAddress("api-service");
|
||||
setApiUrl(`http://${ServiceAddress}:${ServicePort}/api/login`);
|
||||
} catch (error) {
|
||||
setMessage("Failed to retrieve API information.");
|
||||
@@ -31,15 +31,15 @@ const LoginPage = () => {
|
||||
}
|
||||
|
||||
try {
|
||||
const response = await axios.post(apiUrl, { username, password });
|
||||
const response = await axios.post(apiUrl, {username, password});
|
||||
|
||||
// Extract token and server info from response
|
||||
const { token, session_id } = response.data;
|
||||
const {token, session_id} = response.data;
|
||||
|
||||
setMessage("Login successful! Launching game...");
|
||||
|
||||
const { ServiceAddress, ServicePort } = await getServiceAddress("packet-service");
|
||||
window.location.href = `osirose-launcher://launch?otp=${encodeURIComponent(token)}&session=${encodeURIComponent(session_id)}&ip=${encodeURIComponent(ServiceAddress)}&port=${encodeURIComponent(ServicePort)}&username=${encodeURIComponent(username)}`;
|
||||
const {ServiceAddress, ServicePort} = await getServiceAddress("packet-service");
|
||||
window.location.href = `osirose-launcher://launch?session=${encodeURIComponent(session_id)}&ip=${encodeURIComponent(ServiceAddress)}&port=${encodeURIComponent(ServicePort)}&username=${encodeURIComponent(username)}`;
|
||||
} catch (error) {
|
||||
setMessage("Login failed: " + error.response?.data?.error || error.message);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user