Improve and fixed zenodo account association
This commit is contained in:
parent
d2192f2be0
commit
20466bf693
|
@ -132,7 +132,9 @@ public class UserManager {
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
this.updateDOIToken(ZenodoAccessType.REFRESH_TOKEN, principal.getZenodoRefresh(), this.environment.getProperty("zenodo.login.redirect_uri"), principal);
|
this.updateDOIToken(ZenodoAccessType.REFRESH_TOKEN, principal.getZenodoRefresh(), this.environment.getProperty("zenodo.login.redirect_uri"), principal);
|
||||||
|
return true;
|
||||||
}catch (IOException e) {
|
}catch (IOException e) {
|
||||||
|
this.deleteDOIToken(principal);
|
||||||
throw new ExpiredTokenException("Zenodo Token is expired.");
|
throw new ExpiredTokenException("Zenodo Token is expired.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,7 +19,7 @@ export class Oauth2DialogService extends BaseService{
|
||||||
}
|
}
|
||||||
|
|
||||||
public login(url: string): Observable<string> {
|
public login(url: string): Observable<string> {
|
||||||
const windows = window.open(this.configurationService.app + 'oauth2?url=' + encodeURIComponent(url) ,'', 'height=500px,width=500px');
|
const windows = window.open(this.configurationService.app + 'oauth2?url=' + encodeURIComponent(url) ,'', `height=500px,width=500px,top=${(window.screen.height / 2) - 200}px,left=${(window.screen.width / 2) - 200}px`);
|
||||||
const sub = interval(300).pipe(takeUntil(this._destroyed)).subscribe(() => {
|
const sub = interval(300).pipe(takeUntil(this._destroyed)).subscribe(() => {
|
||||||
if (windows.closed) {
|
if (windows.closed) {
|
||||||
const oauthCode = localStorage.getItem('oauthCode');
|
const oauthCode = localStorage.getItem('oauthCode');
|
||||||
|
|
|
@ -110,12 +110,12 @@
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-4" *ngIf="!hasZenodo()">
|
<div class="col-md-4" *ngIf="!hasZenodo()">
|
||||||
<button mat-raised-button type="button" (click)="loginToZenodo()" class="confirm">{{'USER-PROFILE.ZENODO.LOGIN' | translate}}</button>
|
<button mat-raised-button type="button" (click)="loginToZenodo()" class="confirm" color="primary">{{'USER-PROFILE.ZENODO.LOGIN' | translate}}</button>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-4" *ngIf="hasZenodo()">
|
<div class="col-md-4" *ngIf="hasZenodo()">
|
||||||
<div><label class="zenodo-email">{{ 'USER-PROFILE.ZENODO.DESCRIPTION' | translate}}</label></div>
|
<div><label class="zenodo-email">{{ 'USER-PROFILE.ZENODO.DESCRIPTION' | translate}}</label></div>
|
||||||
<label class="zenodo-email">{{zenodoEmail}}</label>
|
<label class="zenodo-email">{{zenodoEmail}}</label>
|
||||||
<div><button mat-raised-button type="button" (click)="RemoveZenodo()" class="confirm">{{'USER-PROFILE.ZENODO.LOGOUT' | translate}}</button></div>
|
<div><button mat-raised-button type="button" (click)="RemoveZenodo()" class="confirm unlinkBtn" >{{'USER-PROFILE.ZENODO.LOGOUT' | translate}}</button></div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -29,3 +29,8 @@
|
||||||
.zenodo-email {
|
.zenodo-email {
|
||||||
color: black;
|
color: black;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.unlinkBtn {
|
||||||
|
background-color: FireBrick;
|
||||||
|
color: white;
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in New Issue