mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-21 17:12:43 +00:00
fix: library login fails
This commit is contained in:
@@ -15,6 +15,6 @@
|
|||||||
|
|
||||||
<div class="centered-message-container">
|
<div class="centered-message-container">
|
||||||
<p>
|
<p>
|
||||||
{{ 'auth.messages' + '.' + PROVIDER_TYPE + '.' + 'authorizing' | translate }}
|
{{ 'auth.messages.authorizing' | translate }}
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -16,25 +16,27 @@ import {Component} from '@angular/core';
|
|||||||
import {NavController} from '@ionic/angular';
|
import {NavController} from '@ionic/angular';
|
||||||
import {Router} from '@angular/router';
|
import {Router} from '@angular/router';
|
||||||
import {AuthActions, IAuthAction} from 'ionic-appauth';
|
import {AuthActions, IAuthAction} from 'ionic-appauth';
|
||||||
import {SCAuthorizationProviderType} from '@openstapps/core';
|
|
||||||
import {AuthHelperService} from '../../auth-helper.service';
|
import {AuthHelperService} from '../../auth-helper.service';
|
||||||
import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
|
import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
|
||||||
import {Observable} from 'rxjs';
|
import {Observable} from 'rxjs';
|
||||||
import {IPAIAAuthAction} from '../../paia/paia-auth-action';
|
import {IPAIAAuthAction} from '../../paia/paia-auth-action';
|
||||||
|
import {DefaultAuthService} from '../../default-auth.service';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
templateUrl: 'auth-callback-page.component.html',
|
templateUrl: 'auth-callback-page.component.html',
|
||||||
styleUrls: ['auth-callback-page.component.scss'],
|
styleUrls: ['auth-callback-page.component.scss'],
|
||||||
})
|
})
|
||||||
export class AuthCallbackPageComponent {
|
export class AuthCallbackPageComponent {
|
||||||
PROVIDER_TYPE: SCAuthorizationProviderType = 'default';
|
constructor(
|
||||||
|
private navCtrl: NavController,
|
||||||
constructor(private navCtrl: NavController, private router: Router, private authHelper: AuthHelperService) {
|
private router: Router,
|
||||||
const provider = this.authHelper.getProvider(this.PROVIDER_TYPE);
|
private authHelper: AuthHelperService,
|
||||||
const events: Observable<IPAIAAuthAction | IAuthAction> = provider.events$;
|
private auth: DefaultAuthService,
|
||||||
|
) {
|
||||||
|
const events: Observable<IPAIAAuthAction | IAuthAction> = this.auth.events$;
|
||||||
|
|
||||||
events.pipe(takeUntilDestroyed()).subscribe((action: IAuthAction) => this.postCallback(action));
|
events.pipe(takeUntilDestroyed()).subscribe((action: IAuthAction) => this.postCallback(action));
|
||||||
provider.authorizationCallback(window.location.origin + this.router.url);
|
this.auth.authorizationCallback(window.location.origin + this.router.url);
|
||||||
}
|
}
|
||||||
|
|
||||||
async postCallback(action: IAuthAction) {
|
async postCallback(action: IAuthAction) {
|
||||||
|
|||||||
@@ -17,7 +17,8 @@ import {RouterModule, Routes} from '@angular/router';
|
|||||||
import {NgModule} from '@angular/core';
|
import {NgModule} from '@angular/core';
|
||||||
import {authPaths} from './auth-paths';
|
import {authPaths} from './auth-paths';
|
||||||
import {AuthCallbackPageComponent} from './auth-callback/page/auth-callback-page.component';
|
import {AuthCallbackPageComponent} from './auth-callback/page/auth-callback-page.component';
|
||||||
import {PAIAAuthCallbackPageComponent} from './paia/auth-callback/page/paiaauth-callback-page.component';
|
import {DefaultAuthService} from './default-auth.service';
|
||||||
|
import {PAIAAuthService} from './paia/paia-auth.service';
|
||||||
|
|
||||||
const authRoutes: Routes = [
|
const authRoutes: Routes = [
|
||||||
{
|
{
|
||||||
@@ -26,7 +27,8 @@ const authRoutes: Routes = [
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
path: authPaths.paia.redirect_path,
|
path: authPaths.paia.redirect_path,
|
||||||
component: PAIAAuthCallbackPageComponent,
|
component: AuthCallbackPageComponent,
|
||||||
|
providers: [{provide: DefaultAuthService, useExisting: PAIAAuthService}],
|
||||||
},
|
},
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|||||||
@@ -10,12 +10,11 @@ import {HttpClient} from '@angular/common/http';
|
|||||||
import {AuthRoutingModule} from './auth-routing.module';
|
import {AuthRoutingModule} from './auth-routing.module';
|
||||||
import {TranslateModule} from '@ngx-translate/core';
|
import {TranslateModule} from '@ngx-translate/core';
|
||||||
import {AuthCallbackPageComponent} from './auth-callback/page/auth-callback-page.component';
|
import {AuthCallbackPageComponent} from './auth-callback/page/auth-callback-page.component';
|
||||||
import {PAIAAuthCallbackPageComponent} from './paia/auth-callback/page/paiaauth-callback-page.component';
|
|
||||||
import {DefaultAuthService} from './default-auth.service';
|
import {DefaultAuthService} from './default-auth.service';
|
||||||
import {PAIAAuthService} from './paia/paia-auth.service';
|
import {PAIAAuthService} from './paia/paia-auth.service';
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
declarations: [AuthCallbackPageComponent, PAIAAuthCallbackPageComponent],
|
declarations: [AuthCallbackPageComponent],
|
||||||
imports: [CommonModule, AuthRoutingModule, TranslateModule],
|
imports: [CommonModule, AuthRoutingModule, TranslateModule],
|
||||||
providers: [
|
providers: [
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -1,33 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2022 StApps
|
|
||||||
* This program is free software: you can redistribute it and/or modify it
|
|
||||||
* under the terms of the GNU General Public License as published by the Free
|
|
||||||
* Software Foundation, version 3.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
|
||||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
|
||||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
|
||||||
* more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License along with
|
|
||||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import {Component} from '@angular/core';
|
|
||||||
import {AuthCallbackPageComponent} from '../../../auth-callback/page/auth-callback-page.component';
|
|
||||||
import {SCAuthorizationProviderType} from '@openstapps/core';
|
|
||||||
import {NavController} from '@ionic/angular';
|
|
||||||
import {Router} from '@angular/router';
|
|
||||||
import {AuthHelperService} from '../../../auth-helper.service';
|
|
||||||
|
|
||||||
@Component({
|
|
||||||
templateUrl: '../../../auth-callback/page/auth-callback-page.component.html',
|
|
||||||
styleUrls: ['../../../auth-callback/page/auth-callback-page.component.scss'],
|
|
||||||
})
|
|
||||||
export class PAIAAuthCallbackPageComponent extends AuthCallbackPageComponent {
|
|
||||||
PROVIDER_TYPE = 'paia' as SCAuthorizationProviderType;
|
|
||||||
|
|
||||||
constructor(navCtrl: NavController, router: Router, authHelper: AuthHelperService) {
|
|
||||||
super(navCtrl, router, authHelper);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -47,8 +47,8 @@
|
|||||||
"auth": {
|
"auth": {
|
||||||
"messages": {
|
"messages": {
|
||||||
"encourage_login": "Für mehr einloggen",
|
"encourage_login": "Für mehr einloggen",
|
||||||
"default": {
|
|
||||||
"authorizing": "Autorisierung läuft...",
|
"authorizing": "Autorisierung läuft...",
|
||||||
|
"default": {
|
||||||
"logged_in_success": "Erfolgreich eingeloggt.",
|
"logged_in_success": "Erfolgreich eingeloggt.",
|
||||||
"logged_out_success": "Erfolgreich ausgeloggt.",
|
"logged_out_success": "Erfolgreich ausgeloggt.",
|
||||||
"log_out_alert": {
|
"log_out_alert": {
|
||||||
@@ -57,7 +57,6 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"paia": {
|
"paia": {
|
||||||
"authorizing": "Autorisierung (Bibliothek) läuft...",
|
|
||||||
"logged_in_success": "Erfolgreich ins Bibliothekskonto eingeloggt.",
|
"logged_in_success": "Erfolgreich ins Bibliothekskonto eingeloggt.",
|
||||||
"logged_out_success": "Erfolgreich aus dem Bibliothekskonto ausgeloggt.",
|
"logged_out_success": "Erfolgreich aus dem Bibliothekskonto ausgeloggt.",
|
||||||
"log_out_alert": {
|
"log_out_alert": {
|
||||||
|
|||||||
@@ -47,8 +47,8 @@
|
|||||||
"auth": {
|
"auth": {
|
||||||
"messages": {
|
"messages": {
|
||||||
"encourage_login": "Log in for more",
|
"encourage_login": "Log in for more",
|
||||||
"default": {
|
|
||||||
"authorizing": "Authorizing...",
|
"authorizing": "Authorizing...",
|
||||||
|
"default": {
|
||||||
"logged_in_success": "Successfully logged in.",
|
"logged_in_success": "Successfully logged in.",
|
||||||
"logged_out_success": "Successfully logged out.",
|
"logged_out_success": "Successfully logged out.",
|
||||||
"log_out_alert": {
|
"log_out_alert": {
|
||||||
@@ -57,7 +57,6 @@
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
"paia": {
|
"paia": {
|
||||||
"authorizing": "Authorizing (library)...",
|
|
||||||
"logged_in_success": "Successfully logged in to library.",
|
"logged_in_success": "Successfully logged in to library.",
|
||||||
"logged_out_success": "Successfully logged out from library.",
|
"logged_out_success": "Successfully logged out from library.",
|
||||||
"log_out_alert": {
|
"log_out_alert": {
|
||||||
|
|||||||
Reference in New Issue
Block a user