website cleanup
This commit is contained in:
@@ -26,7 +26,7 @@ import {
|
||||
SIGNUP_USE_CASE_TOKEN,
|
||||
} from './AuthProviders';
|
||||
import type { AuthSessionDTO } from './dtos/AuthDto';
|
||||
import { LoginParams, SignupParams } from './dtos/AuthDto';
|
||||
import { LoginParamsDTO, SignupParamsDTO } from './dtos/AuthDto';
|
||||
import { AuthSessionPresenter } from './presenters/AuthSessionPresenter';
|
||||
import type { CommandResultDTO } from './presenters/CommandResultPresenter';
|
||||
import { CommandResultPresenter } from './presenters/CommandResultPresenter';
|
||||
@@ -67,7 +67,7 @@ export class AuthService {
|
||||
};
|
||||
}
|
||||
|
||||
async signupWithEmail(params: SignupParams): Promise<AuthSessionDTO> {
|
||||
async signupWithEmail(params: SignupParamsDTO): Promise<AuthSessionDTO> {
|
||||
this.logger.debug(`[AuthService] Attempting signup for email: ${params.email}`);
|
||||
|
||||
this.authSessionPresenter.reset();
|
||||
@@ -98,7 +98,7 @@ export class AuthService {
|
||||
};
|
||||
}
|
||||
|
||||
async loginWithEmail(params: LoginParams): Promise<AuthSessionDTO> {
|
||||
async loginWithEmail(params: LoginParamsDTO): Promise<AuthSessionDTO> {
|
||||
this.logger.debug(`[AuthService] Attempting login for email: ${params.email}`);
|
||||
|
||||
this.authSessionPresenter.reset();
|
||||
@@ -142,4 +142,51 @@ export class AuthService {
|
||||
|
||||
return this.commandResultPresenter.responseModel;
|
||||
}
|
||||
|
||||
/**
|
||||
* Start iRacing OAuth flow.
|
||||
*
|
||||
* NOTE: This is a placeholder implementation for the current alpha build.
|
||||
* A production implementation should delegate to a dedicated iRacing OAuth port
|
||||
* and persist/validate state server-side.
|
||||
*/
|
||||
async startIracingAuth(returnTo?: string): Promise<string> {
|
||||
this.logger.debug('[AuthService] Starting iRacing auth flow', { returnTo });
|
||||
|
||||
const state = Math.random().toString(36).slice(2);
|
||||
const base = 'https://example.com/iracing/auth';
|
||||
const query = new URLSearchParams();
|
||||
query.set('state', state);
|
||||
if (returnTo) {
|
||||
query.set('returnTo', returnTo);
|
||||
}
|
||||
|
||||
return `${base}?${query.toString()}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Handle iRacing OAuth callback.
|
||||
*
|
||||
* NOTE: Placeholder implementation that creates a demo session.
|
||||
*/
|
||||
async iracingCallback(code: string, state: string, returnTo?: string): Promise<AuthSessionDTO> {
|
||||
this.logger.debug('[AuthService] iRacing callback received', { hasCode: !!code, state, returnTo });
|
||||
|
||||
const userId = `iracing-${state || code}`.slice(0, 64);
|
||||
|
||||
const session = await this.identitySessionPort.createSession({
|
||||
id: userId,
|
||||
displayName: 'iRacing User',
|
||||
email: '',
|
||||
});
|
||||
|
||||
return {
|
||||
token: session.token,
|
||||
user: {
|
||||
userId,
|
||||
email: '',
|
||||
displayName: 'iRacing User',
|
||||
},
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user