connect user compoonent: update method to check if user is subscribed, avoiid double messages, make sure it redirects properly after login and subscribe

This commit is contained in:
argirok 2022-07-27 16:57:46 +03:00
parent 6799cb3f3f
commit 84762753b9
2 changed files with 7 additions and 3 deletions

View File

@ -52,7 +52,7 @@
<button (click)="login()" class=" uk-button uk-button-primary">Login</button>
</div>
</form-->
<div *ngIf="errorCode == '1' || (!loggedIn && errorCode != '3')" class="uk-alert uk-alert-warning">
<div *ngIf="errorCode == '1' || (!loggedIn && errorCode != '3' && errorCode != '6')" class="uk-alert uk-alert-warning">
The requested page requires authentication.
<span *ngIf="!loggedIn">Please <a class="uk-link" (click)="logIn()"> sign in</a> to continue.
</span>

View File

@ -52,7 +52,7 @@ export class UserComponent {
this.errorCode = params["errorCode"];
this.redirectUrl = params["redirectUrl"];
this.errorMessage = "";
if (this.loggedIn && (this.errorCode == '1' || this.errorCode == '3')) {
if (this.loggedIn && (this.errorCode == '1' || this.errorCode == '3' || this.errorCode == '7')) {
this.redirect();
} else {
this.loading = false;
@ -70,7 +70,11 @@ export class UserComponent {
});
}
redirect() {
redirect(redirectUrl = null) {
//if parameters are not read yet, force them to use the function parameter
if(!this.redirectUrl && redirectUrl){
this.redirectUrl = redirectUrl
}
if (this.redirectUrl && this.redirectUrl != "") {
this.redirectUrl = decodeURIComponent(this.redirectUrl);
this.userManagementsService.setRedirectUrl(this.redirectUrl);