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