mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-04 04:22:50 +00:00
fix: library login fails
This commit is contained in:
@@ -15,6 +15,6 @@
|
||||
|
||||
<div class="centered-message-container">
|
||||
<p>
|
||||
{{ 'auth.messages' + '.' + PROVIDER_TYPE + '.' + 'authorizing' | translate }}
|
||||
{{ 'auth.messages.authorizing' | translate }}
|
||||
</p>
|
||||
</div>
|
||||
|
||||
@@ -16,25 +16,27 @@ import {Component} from '@angular/core';
|
||||
import {NavController} from '@ionic/angular';
|
||||
import {Router} from '@angular/router';
|
||||
import {AuthActions, IAuthAction} from 'ionic-appauth';
|
||||
import {SCAuthorizationProviderType} from '@openstapps/core';
|
||||
import {AuthHelperService} from '../../auth-helper.service';
|
||||
import {takeUntilDestroyed} from '@angular/core/rxjs-interop';
|
||||
import {Observable} from 'rxjs';
|
||||
import {IPAIAAuthAction} from '../../paia/paia-auth-action';
|
||||
import {DefaultAuthService} from '../../default-auth.service';
|
||||
|
||||
@Component({
|
||||
templateUrl: 'auth-callback-page.component.html',
|
||||
styleUrls: ['auth-callback-page.component.scss'],
|
||||
})
|
||||
export class AuthCallbackPageComponent {
|
||||
PROVIDER_TYPE: SCAuthorizationProviderType = 'default';
|
||||
|
||||
constructor(private navCtrl: NavController, private router: Router, private authHelper: AuthHelperService) {
|
||||
const provider = this.authHelper.getProvider(this.PROVIDER_TYPE);
|
||||
const events: Observable<IPAIAAuthAction | IAuthAction> = provider.events$;
|
||||
constructor(
|
||||
private navCtrl: NavController,
|
||||
private router: Router,
|
||||
private authHelper: AuthHelperService,
|
||||
private auth: DefaultAuthService,
|
||||
) {
|
||||
const events: Observable<IPAIAAuthAction | IAuthAction> = this.auth.events$;
|
||||
|
||||
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) {
|
||||
|
||||
@@ -17,7 +17,8 @@ import {RouterModule, Routes} from '@angular/router';
|
||||
import {NgModule} from '@angular/core';
|
||||
import {authPaths} from './auth-paths';
|
||||
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 = [
|
||||
{
|
||||
@@ -26,7 +27,8 @@ const authRoutes: Routes = [
|
||||
},
|
||||
{
|
||||
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 {TranslateModule} from '@ngx-translate/core';
|
||||
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';
|
||||
|
||||
@NgModule({
|
||||
declarations: [AuthCallbackPageComponent, PAIAAuthCallbackPageComponent],
|
||||
declarations: [AuthCallbackPageComponent],
|
||||
imports: [CommonModule, AuthRoutingModule, TranslateModule],
|
||||
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": {
|
||||
"messages": {
|
||||
"encourage_login": "Für mehr einloggen",
|
||||
"authorizing": "Autorisierung läuft...",
|
||||
"default": {
|
||||
"authorizing": "Autorisierung läuft...",
|
||||
"logged_in_success": "Erfolgreich eingeloggt.",
|
||||
"logged_out_success": "Erfolgreich ausgeloggt.",
|
||||
"log_out_alert": {
|
||||
@@ -57,7 +57,6 @@
|
||||
}
|
||||
},
|
||||
"paia": {
|
||||
"authorizing": "Autorisierung (Bibliothek) läuft...",
|
||||
"logged_in_success": "Erfolgreich ins Bibliothekskonto eingeloggt.",
|
||||
"logged_out_success": "Erfolgreich aus dem Bibliothekskonto ausgeloggt.",
|
||||
"log_out_alert": {
|
||||
|
||||
@@ -47,8 +47,8 @@
|
||||
"auth": {
|
||||
"messages": {
|
||||
"encourage_login": "Log in for more",
|
||||
"authorizing": "Authorizing...",
|
||||
"default": {
|
||||
"authorizing": "Authorizing...",
|
||||
"logged_in_success": "Successfully logged in.",
|
||||
"logged_out_success": "Successfully logged out.",
|
||||
"log_out_alert": {
|
||||
@@ -57,7 +57,6 @@
|
||||
}
|
||||
},
|
||||
"paia": {
|
||||
"authorizing": "Authorizing (library)...",
|
||||
"logged_in_success": "Successfully logged in to library.",
|
||||
"logged_out_success": "Successfully logged out from library.",
|
||||
"log_out_alert": {
|
||||
|
||||
Reference in New Issue
Block a user