Improve and fixed zenodo account association

This commit is contained in:
George Kalampokis 2020-04-13 16:33:45 +03:00
parent d2192f2be0
commit 20466bf693
4 changed files with 10 additions and 3 deletions

View File

@ -132,7 +132,9 @@ public class UserManager {
}
try {
this.updateDOIToken(ZenodoAccessType.REFRESH_TOKEN, principal.getZenodoRefresh(), this.environment.getProperty("zenodo.login.redirect_uri"), principal);
return true;
}catch (IOException e) {
this.deleteDOIToken(principal);
throw new ExpiredTokenException("Zenodo Token is expired.");
}
}

View File

@ -19,7 +19,7 @@ export class Oauth2DialogService extends BaseService{
}
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(() => {
if (windows.closed) {
const oauthCode = localStorage.getItem('oauthCode');

View File

@ -110,12 +110,12 @@
<div class="container">
<div class="row">
<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 class="col-md-4" *ngIf="hasZenodo()">
<div><label class="zenodo-email">{{ 'USER-PROFILE.ZENODO.DESCRIPTION' | translate}}</label></div>
<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>

View File

@ -29,3 +29,8 @@
.zenodo-email {
color: black;
}
.unlinkBtn {
background-color: FireBrick;
color: white;
}