fix: Major bug cleanup pass 1
Queue Release Build / prepare (push) Successful in 19s
Deploy Web Apps / deploy (push) Successful in 8m12s
Queue Release Build / build-windows (push) Successful in 27m44s
Queue Release Build / build-linux (push) Successful in 48m1s
Queue Release Build / finalize (push) Successful in 2m42s
Queue Release Build / build-android (push) Successful in 22m7s
Queue Release Build / prepare (push) Successful in 19s
Deploy Web Apps / deploy (push) Successful in 8m12s
Queue Release Build / build-windows (push) Successful in 27m44s
Queue Release Build / build-linux (push) Successful in 48m1s
Queue Release Build / finalize (push) Successful in 2m42s
Queue Release Build / build-android (push) Successful in 22m7s
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
|
||||
import {
|
||||
Component,
|
||||
computed,
|
||||
inject,
|
||||
OnInit,
|
||||
signal
|
||||
@@ -21,7 +22,9 @@ import {
|
||||
import { AuthenticationService } from '../../application/services/authentication.service';
|
||||
import { ServerDirectoryFacade } from '../../../server-directory';
|
||||
import {
|
||||
AUTH_MODE_AUTHORIZE,
|
||||
buildLoginReturnQueryParams,
|
||||
isAuthorizeAuthMode,
|
||||
resolveSafeReturnUrl,
|
||||
waitForAuthenticationOutcome
|
||||
} from '../../domain/logic/auth-navigation.rules';
|
||||
@@ -56,6 +59,13 @@ export class LoginComponent implements OnInit {
|
||||
password = '';
|
||||
serverId: string | undefined = this.serversSvc.activeServer()?.id;
|
||||
error = signal<string | null>(null);
|
||||
readonly isAuthorizeMode = signal(false);
|
||||
readonly authorizeServerName = computed(() => {
|
||||
const sid = this.serverId || this.serversSvc.activeServer()?.id;
|
||||
const endpoint = this.servers().find((server) => server.id === sid);
|
||||
|
||||
return endpoint?.name ?? this.appI18n.instant('auth.authorize.defaultServerName');
|
||||
});
|
||||
|
||||
private readonly appI18n = inject(AppI18nService);
|
||||
private auth = inject(AuthenticationService);
|
||||
@@ -68,6 +78,19 @@ export class LoginComponent implements OnInit {
|
||||
trackById(_index: number, item: { id: string }) { return item.id; }
|
||||
|
||||
ngOnInit(): void {
|
||||
const mode = this.route.snapshot.queryParamMap.get('mode');
|
||||
const requestedServerId = this.route.snapshot.queryParamMap.get('serverId')?.trim();
|
||||
|
||||
this.isAuthorizeMode.set(isAuthorizeAuthMode(mode));
|
||||
|
||||
if (requestedServerId) {
|
||||
this.serverId = requestedServerId;
|
||||
}
|
||||
|
||||
if (this.isAuthorizeMode()) {
|
||||
return;
|
||||
}
|
||||
|
||||
this.store.select(selectCurrentUser).pipe(
|
||||
filter(Boolean),
|
||||
take(1)
|
||||
@@ -88,8 +111,24 @@ export class LoginComponent implements OnInit {
|
||||
password: this.password,
|
||||
serverId: sid }).subscribe({
|
||||
next: async (resp) => {
|
||||
if (sid)
|
||||
const serverUrl = this.auth.resolveServerUrlFor(sid);
|
||||
|
||||
if (this.isAuthorizeMode()) {
|
||||
this.store.dispatch(UsersActions.authorizeSignalServer({
|
||||
serverUrl,
|
||||
response: resp,
|
||||
provisioned: false
|
||||
}));
|
||||
|
||||
const returnUrl = resolveSafeReturnUrl(this.route.snapshot.queryParamMap.get('returnUrl'));
|
||||
|
||||
await this.router.navigateByUrl(returnUrl);
|
||||
return;
|
||||
}
|
||||
|
||||
if (sid) {
|
||||
this.serversSvc.setActiveServer(sid);
|
||||
}
|
||||
|
||||
const homeSignalServerUrl = this.serversSvc.servers().find((server) => server.id === sid)?.url
|
||||
?? this.serversSvc.activeServer()?.url;
|
||||
@@ -104,7 +143,7 @@ export class LoginComponent implements OnInit {
|
||||
homeSignalServerUrl
|
||||
};
|
||||
|
||||
this.store.dispatch(UsersActions.authenticateUser({ user }));
|
||||
this.store.dispatch(UsersActions.authenticateUser({ user, loginResponse: resp }));
|
||||
|
||||
const outcome = await firstValueFrom(waitForAuthenticationOutcome(this.actions$));
|
||||
|
||||
@@ -126,7 +165,10 @@ export class LoginComponent implements OnInit {
|
||||
/** Navigate to the registration page. */
|
||||
goRegister() {
|
||||
this.router.navigate(['/register'], {
|
||||
queryParams: buildLoginReturnQueryParams(this.router.url)
|
||||
queryParams: buildLoginReturnQueryParams(this.router.url, undefined, {
|
||||
mode: this.isAuthorizeMode() ? AUTH_MODE_AUTHORIZE : undefined,
|
||||
serverId: this.serverId
|
||||
})
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user