Fixed various bugs with the new Login system (prevent to send twice the login request with some providers)
This commit is contained in:
parent
2b89f646ee
commit
baf4314a33
|
@ -10,6 +10,7 @@ import { OrcidLoginComponent } from '@app/ui/auth/login/orcid-login/orcid-login.
|
||||||
import { TwitterLoginComponent } from '@app/ui/auth/login/twitter-login/twitter-login.component';
|
import { TwitterLoginComponent } from '@app/ui/auth/login/twitter-login/twitter-login.component';
|
||||||
import { ConfigurableProvidersService } from '@app/ui/auth/login/utilities/configurableProviders.service';
|
import { ConfigurableProvidersService } from '@app/ui/auth/login/utilities/configurableProviders.service';
|
||||||
import { LoginService } from '@app/ui/auth/login/utilities/login.service';
|
import { LoginService } from '@app/ui/auth/login/utilities/login.service';
|
||||||
|
import { Oauth2DialogModule } from '@app/ui/misc/oauth2-dialog/oauth2-dialog.module';
|
||||||
import { CommonFormsModule } from '@common/forms/common-forms.module';
|
import { CommonFormsModule } from '@common/forms/common-forms.module';
|
||||||
import { CommonUiModule } from '@common/ui/common-ui.module';
|
import { CommonUiModule } from '@common/ui/common-ui.module';
|
||||||
import { MergeLoginService } from './utilities/merge-login.service';
|
import { MergeLoginService } from './utilities/merge-login.service';
|
||||||
|
@ -19,7 +20,8 @@ import { ZenodoLoginComponent } from './zenodo-login/zenodo-login.component';
|
||||||
imports: [
|
imports: [
|
||||||
CommonUiModule,
|
CommonUiModule,
|
||||||
CommonFormsModule,
|
CommonFormsModule,
|
||||||
LoginRoutingModule
|
LoginRoutingModule,
|
||||||
|
Oauth2DialogModule
|
||||||
],
|
],
|
||||||
declarations: [
|
declarations: [
|
||||||
LoginComponent,
|
LoginComponent,
|
||||||
|
|
|
@ -9,18 +9,19 @@ import { TwitterLoginComponent } from './twitter-login/twitter-login.component';
|
||||||
import { OpenAireLoginComponent } from "./openaire-login/openaire-login.component";
|
import { OpenAireLoginComponent } from "./openaire-login/openaire-login.component";
|
||||||
import { ConfigurableLoginComponent } from "./configurable-login/configurable-login.component";
|
import { ConfigurableLoginComponent } from "./configurable-login/configurable-login.component";
|
||||||
import { ZenodoLoginComponent } from './zenodo-login/zenodo-login.component';
|
import { ZenodoLoginComponent } from './zenodo-login/zenodo-login.component';
|
||||||
|
import { Oauth2DialogComponent } from '@app/ui/misc/oauth2-dialog/oauth2-dialog.component';
|
||||||
|
|
||||||
const routes: Routes = [
|
const routes: Routes = [
|
||||||
{ path: '', component: LoginComponent },
|
{ path: '', component: LoginComponent },
|
||||||
{ path: 'linkedin', component: LinkedInLoginComponent },
|
{ path: 'linkedin', component: Oauth2DialogComponent },
|
||||||
{ path: 'twitter', component: TwitterLoginComponent },
|
{ path: 'twitter', component: Oauth2DialogComponent },
|
||||||
{ path: 'external/orcid', component: OrcidLoginComponent },
|
{ path: 'external/orcid', component: Oauth2DialogComponent },
|
||||||
{ path: 'external/b2access', component: B2AccessLoginComponent },
|
{ path: 'external/b2access', component: Oauth2DialogComponent },
|
||||||
{ path: 'confirmation/:token', component: EmailConfirmation },
|
{ path: 'confirmation/:token', component: EmailConfirmation },
|
||||||
{ path: 'confirmation', component: EmailConfirmation },
|
{ path: 'confirmation', component: EmailConfirmation },
|
||||||
{ path: 'openaire', component: OpenAireLoginComponent},
|
{ path: 'openaire', component: Oauth2DialogComponent},
|
||||||
{ path: 'configurable/:id', component: ConfigurableLoginComponent},
|
{ path: 'configurable/:id', component: ConfigurableLoginComponent},
|
||||||
{ path: 'external/zenodo', component: ZenodoLoginComponent }
|
{ path: 'external/zenodo', component: Oauth2DialogComponent }
|
||||||
];
|
];
|
||||||
|
|
||||||
@NgModule({
|
@NgModule({
|
||||||
|
|
|
@ -527,13 +527,15 @@ export class DmpOverviewComponent extends BaseComponent implements OnInit {
|
||||||
this.oauth2DialogService.login(url)
|
this.oauth2DialogService.login(url)
|
||||||
.pipe(takeUntil(this._destroyed))
|
.pipe(takeUntil(this._destroyed))
|
||||||
.subscribe(result => {
|
.subscribe(result => {
|
||||||
if (result.oauthCode !== undefined && result.oauthCode !== null) {
|
if (result !== undefined) {
|
||||||
this.userService.registerDOIToken(result.oauthCode, this.configurationService.app + 'oauth2')
|
if (result.oauthCode !== undefined && result.oauthCode !== null) {
|
||||||
.pipe(takeUntil(this._destroyed))
|
this.userService.registerDOIToken(result.oauthCode, this.configurationService.app + 'oauth2')
|
||||||
.subscribe(() => {
|
.pipe(takeUntil(this._destroyed))
|
||||||
this.hasDOIToken = true;
|
.subscribe(() => {
|
||||||
this.showConfirmationDOIDialog(dmp);
|
this.hasDOIToken = true;
|
||||||
});
|
this.showConfirmationDOIDialog(dmp);
|
||||||
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
|
@ -41,6 +41,7 @@ export class Oauth2DialogService extends BaseService{
|
||||||
oauthVerifier = oauthObject.oauth_verifier;
|
oauthVerifier = oauthObject.oauth_verifier;
|
||||||
}
|
}
|
||||||
this.code.next({oauthCode: oauthCode, oauthState: oauthState, oauthToken: oauthToken, oauthVerifier: oauthVerifier});
|
this.code.next({oauthCode: oauthCode, oauthState: oauthState, oauthToken: oauthToken, oauthVerifier: oauthVerifier});
|
||||||
|
this.code.next(undefined);
|
||||||
sub.unsubscribe();
|
sub.unsubscribe();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -237,10 +237,12 @@ export class UserProfileComponent extends BaseComponent implements OnInit, OnDes
|
||||||
this.oauth2DialogService.login(url)
|
this.oauth2DialogService.login(url)
|
||||||
.pipe(takeUntil(this._destroyed))
|
.pipe(takeUntil(this._destroyed))
|
||||||
.subscribe(result => {
|
.subscribe(result => {
|
||||||
if (result.oauthCode !== undefined && result.oauthCode !== null) {
|
if (result !== undefined) {
|
||||||
this.userService.registerDOIToken(result.oauthCode, this.configurationService.app + 'oauth2')
|
if (result.oauthCode !== undefined && result.oauthCode !== null) {
|
||||||
.pipe(takeUntil(this._destroyed))
|
this.userService.registerDOIToken(result.oauthCode, this.configurationService.app + 'oauth2')
|
||||||
.subscribe(() => this.router.navigate(['/reload']).then(() => this.router.navigate(['/profile'])));
|
.pipe(takeUntil(this._destroyed))
|
||||||
|
.subscribe(() => this.router.navigate(['/reload']).then(() => this.router.navigate(['/profile'])));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -265,7 +267,8 @@ export class UserProfileComponent extends BaseComponent implements OnInit, OnDes
|
||||||
});
|
});
|
||||||
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {
|
dialogRef.afterClosed().pipe(takeUntil(this._destroyed)).subscribe(result => {
|
||||||
if (result) {
|
if (result) {
|
||||||
this.mergeEmailConfirmation.sendConfirmationEmail(result);
|
this.mergeEmailConfirmation.sendConfirmationEmail(result).pipe(takeUntil(this._destroyed))
|
||||||
|
.subscribe(res => {}, err => {});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue