Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 5 additions & 11 deletions eFormAPI/eFormAPI.Web/Services/AdminService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,8 @@ public async Task<OperationResult> 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"));
Expand All @@ -145,8 +146,7 @@ public async Task<OperationResult> 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"));
}
Expand Down Expand Up @@ -297,10 +297,7 @@ public async Task<OperationResult> EnableTwoFactorAuthForce()
{
try
{
await _appSettings.UpdateDb((options) =>
{
options.IsTwoFactorForced = true;
}, _dbContext);
await _appSettings.UpdateDb((options) => { options.IsTwoFactorForced = true; }, _dbContext);
}
catch (Exception)
{
Expand All @@ -314,10 +311,7 @@ public async Task<OperationResult> DisableTwoFactorAuthForce()
{
try
{
await _appSettings.UpdateDb((options) =>
{
options.IsTwoFactorForced = false;
}, _dbContext);
await _appSettings.UpdateDb((options) => { options.IsTwoFactorForced = false; }, _dbContext);
}
catch (Exception)
{
Expand Down
2 changes: 1 addition & 1 deletion eFormAPI/eFormAPI.Web/eFormAPI.Web.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="2.1.4" />
<PackageReference Include="SharpZipLib.NETStandard" Version="1.0.7" />
<PackageReference Include="SixLabors.ImageSharp" Version="1.0.0-beta0005" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="4.0.1" />
<PackageReference Include="Swashbuckle.AspNetCore" Version="1.0.0" />
<PackageReference Include="McMaster.NETCore.Plugins" Version="0.2.1" />
<PackageReference Include="OtpSharp.Core" Version="1.0.0" />
<PackageReference Include="Microsoft.AspNetCore.Identity.EntityFrameworkCore" Version="2.2.0" />
Expand Down
8 changes: 4 additions & 4 deletions eform-client/src/app/common/services/auth/locale.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -70,16 +70,16 @@ 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) {
return 'c=' + locale + '|uic=' + locale;
}

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, '/');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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<void>('get-navigation-menu', null);
window.location.reload();
}), error => {
this.spinnerStatus = false;
});
Expand Down