diff --git a/eFormAPI/eFormAPI.Web/Services/AdminService.cs b/eFormAPI/eFormAPI.Web/Services/AdminService.cs index 4f45c28c1f..6a8ca42c5a 100644 --- a/eFormAPI/eFormAPI.Web/Services/AdminService.cs +++ b/eFormAPI/eFormAPI.Web/Services/AdminService.cs @@ -134,7 +134,8 @@ public async Task UpdateUser(UserRegisterModel userRegisterMode _localizationService.GetString("UserNotFoundUserName", userRegisterModel.UserName)); } - if (!_dbContext.SecurityGroups.Any(x => x.Id == userRegisterModel.GroupId)) + var isAdmin = await _userManager.IsInRoleAsync(user, EformRole.Admin); + if (!_dbContext.SecurityGroups.Any(x => x.Id == userRegisterModel.GroupId) && !isAdmin) { return new OperationResult(false, _localizationService.GetString("SecurityGroupNotFound")); @@ -145,8 +146,7 @@ public async Task UpdateUser(UserRegisterModel userRegisterMode return new OperationResult(false, _localizationService.GetString("RoleIsRequired")); } - if (await _userManager.IsInRoleAsync(user, EformRole.Admin) - && _userService.Role != EformRole.Admin) + if (isAdmin && _userService.Role != EformRole.Admin) { return new OperationResult(false, _localizationService.GetString("YouCantViewChangeOrDeleteAdmin")); } @@ -297,10 +297,7 @@ public async Task EnableTwoFactorAuthForce() { try { - await _appSettings.UpdateDb((options) => - { - options.IsTwoFactorForced = true; - }, _dbContext); + await _appSettings.UpdateDb((options) => { options.IsTwoFactorForced = true; }, _dbContext); } catch (Exception) { @@ -314,10 +311,7 @@ public async Task DisableTwoFactorAuthForce() { try { - await _appSettings.UpdateDb((options) => - { - options.IsTwoFactorForced = false; - }, _dbContext); + await _appSettings.UpdateDb((options) => { options.IsTwoFactorForced = false; }, _dbContext); } catch (Exception) { diff --git a/eFormAPI/eFormAPI.Web/eFormAPI.Web.csproj b/eFormAPI/eFormAPI.Web/eFormAPI.Web.csproj index ce9e7d2ad9..6d48a40342 100644 --- a/eFormAPI/eFormAPI.Web/eFormAPI.Web.csproj +++ b/eFormAPI/eFormAPI.Web/eFormAPI.Web.csproj @@ -28,7 +28,7 @@ - + diff --git a/eform-client/src/app/common/services/auth/locale.service.ts b/eform-client/src/app/common/services/auth/locale.service.ts index c46842881f..461ec5dc6d 100644 --- a/eform-client/src/app/common/services/auth/locale.service.ts +++ b/eform-client/src/app/common/services/auth/locale.service.ts @@ -70,8 +70,8 @@ export class LocaleService extends BaseService { } else { culture = this.buildCookieValue('en-US'); } - this.cookieService.set('culture', culture); - this.cookieService.set('locale', locale); + this.cookieService.set('culture', culture, 9999999, '/'); + this.cookieService.set('locale', locale, 9999999, '/'); } buildCookieValue(locale: string) { @@ -79,7 +79,7 @@ export class LocaleService extends BaseService { } updateCookies(locale: string) { - this.cookieService.set('locale', locale); - this.cookieService.set('culture', this.buildCookieValue(locale)); + this.cookieService.set('locale', locale, 9999999, '/'); + this.cookieService.set('culture', this.buildCookieValue(locale), 9999999, '/'); } } diff --git a/eform-client/src/app/modules/account-management/components/profile/profile-settings/profile-settings.component.ts b/eform-client/src/app/modules/account-management/components/profile/profile-settings/profile-settings.component.ts index 15a6aae1f5..222e000153 100644 --- a/eform-client/src/app/modules/account-management/components/profile/profile-settings/profile-settings.component.ts +++ b/eform-client/src/app/modules/account-management/components/profile/profile-settings/profile-settings.component.ts @@ -86,7 +86,7 @@ export class ProfileSettingsComponent implements OnInit { this.userSettingsService.updateUserSettings(this.userSettingsModel).subscribe(((data) => { this.localeService.updateUserLocale(this.userSettingsModel.locale); this.spinnerStatus = false; - this.eventBrokerService.emit('get-navigation-menu', null); + window.location.reload(); }), error => { this.spinnerStatus = false; });