add is not authenticated case in tenant user invitation
This commit is contained in:
parent
f718af9b43
commit
e0e2c56792
|
@ -1058,6 +1058,10 @@ public class UserServiceImpl implements UserService {
|
|||
if (userInviteToTenantRequest == null)
|
||||
throw new MyNotFoundException(this.messageSource.getMessage("General_ItemNotFound", new Object[]{action.getId(), UserInviteToTenantRequestEntity.class.getSimpleName()}, LocaleContextHolder.getLocale()));
|
||||
|
||||
UserContactInfoEntity contactInfoEntity = this.queryFactory.query(UserContactInfoQuery.class).disableTracking().userIds(this.userScope.getUserId()).values(userInviteToTenantRequest.getEmail()).types(ContactInfoType.Email).first();
|
||||
if (contactInfoEntity == null){
|
||||
throw new MyValidationException(this.errors.getAnotherUserToken().getCode(), this.errors.getAnotherUserToken().getMessage());
|
||||
}
|
||||
TenantEntity tenantEntity = null;
|
||||
if (!userInviteToTenantRequest.getTenantCode().equals(this.tenantScope.getTenantCode())) {
|
||||
tenantEntity = this.queryFactory.query(TenantQuery.class).disableTracking().authorize(AuthorizationFlags.AllExceptPublic).codes(userInviteToTenantRequest.getTenantCode()).isActive(IsActive.Active).first();
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { HttpErrorResponse } from '@angular/common/http';
|
||||
import { Component, OnInit } from '@angular/core';
|
||||
import { ActivatedRoute, Router } from '@angular/router';
|
||||
import { AuthService } from '@app/core/services/auth/auth.service';
|
||||
import { SnackBarNotificationLevel } from '@app/core/services/notification/ui-notification-service';
|
||||
import { RouterUtilsService } from '@app/core/services/router/router-utils.service';
|
||||
import { UserService } from '@app/core/services/user/user.service';
|
||||
|
@ -28,6 +29,7 @@ export class UserInviteConfirmation extends BaseComponent implements OnInit {
|
|||
private router: Router,
|
||||
private language: TranslateService,
|
||||
private routerUtils: RouterUtilsService,
|
||||
private authentication: AuthService,
|
||||
private httpErrorHandlingService: HttpErrorHandlingService
|
||||
) { super(); }
|
||||
|
||||
|
@ -46,13 +48,23 @@ export class UserInviteConfirmation extends BaseComponent implements OnInit {
|
|||
onConfirm(): void {
|
||||
if (this.showForm === false) return;
|
||||
|
||||
this.userService.confirmInviteUser(this.token)
|
||||
if(this.isAuthenticated()){
|
||||
this.userService.confirmInviteUser(this.token)
|
||||
.subscribe(result => {
|
||||
if (result) {
|
||||
this.onCallbackConfirmationSuccess();
|
||||
}
|
||||
},
|
||||
error => this.onCallbackError(error));
|
||||
error => this.onCallbackError(error));
|
||||
} else {
|
||||
let returnUrl = `login/invitation/confirmation/${this.token}`;
|
||||
this.router.navigate([this.routerUtils.generateUrl('login')], {queryParams:{returnUrl: this.routerUtils.generateUrl(returnUrl)}});
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
public isAuthenticated(): boolean {
|
||||
return this.authentication.currentAccountIsAuthenticated();
|
||||
}
|
||||
|
||||
onCallbackConfirmationSuccess() {
|
||||
|
|
Loading…
Reference in New Issue