Showing
3 changed files
with
8 additions
and
6 deletions
... | ... | @@ -215,6 +215,7 @@ public class AuthController extends BaseController { |
215 | 215 | User user = userService.findUserById(TenantId.SYS_TENANT_ID, credentials.getUserId()); |
216 | 216 | UserPrincipal principal = new UserPrincipal(UserPrincipal.Type.USER_NAME, user.getEmail()); |
217 | 217 | SecurityUser securityUser = new SecurityUser(user, credentials.isEnabled(), principal); |
218 | + userService.setUserCredentialsEnabled(user.getTenantId(), user.getId(), true); | |
218 | 219 | String baseUrl = systemSecurityService.getBaseUrl(user.getTenantId(), user.getCustomerId(), request); |
219 | 220 | String loginUrl = String.format("%s/login", baseUrl); |
220 | 221 | String email = user.getEmail(); | ... | ... |
... | ... | @@ -19,13 +19,13 @@ |
19 | 19 | <button mat-raised-button color="primary" |
20 | 20 | [disabled]="(isLoading$ | async)" |
21 | 21 | (click)="onEntityAction($event, 'disableAccount')" |
22 | - [fxShow]="!isEdit && isUserCredentialsEnabled()"> | |
22 | + [fxShow]="!isEdit && isUserCredentialPresent() && isUserCredentialsEnabled()"> | |
23 | 23 | {{'user.disable-account' | translate }} |
24 | 24 | </button> |
25 | 25 | <button mat-raised-button color="primary" |
26 | 26 | [disabled]="(isLoading$ | async)" |
27 | 27 | (click)="onEntityAction($event, 'enableAccount')" |
28 | - [fxShow]="!isEdit && !isUserCredentialsEnabled()"> | |
28 | + [fxShow]="!isEdit && isUserCredentialPresent() && !isUserCredentialsEnabled()"> | |
29 | 29 | {{'user.enable-account' | translate }} |
30 | 30 | </button> |
31 | 31 | <button mat-raised-button color="primary" | ... | ... |
... | ... | @@ -56,11 +56,12 @@ export class UserComponent extends EntityComponent<User> { |
56 | 56 | } |
57 | 57 | |
58 | 58 | isUserCredentialsEnabled(): boolean { |
59 | - if (!this.entity || !this.entity.additionalInfo || isUndefined(this.entity.additionalInfo.userCredentialsEnabled)) { | |
60 | - return true; | |
61 | - } else { | |
62 | 59 | return this.entity.additionalInfo.userCredentialsEnabled === true; |
63 | - } | |
60 | + } | |
61 | + | |
62 | + isUserCredentialPresent(): boolean { | |
63 | + return !(!this.entity || !this.entity.additionalInfo || isUndefined(this.entity.additionalInfo.userCredentialsEnabled)); | |
64 | + | |
64 | 65 | } |
65 | 66 | |
66 | 67 | buildForm(entity: User): FormGroup { | ... | ... |