Claim Logic

This commit is contained in:
Andre Beging
2022-04-11 15:51:11 +02:00
parent 1b2c6c4062
commit 5026196b46
9 changed files with 137 additions and 47 deletions

View File

@@ -98,6 +98,7 @@ namespace FoodsharingSiegen.Server.Auth
{
Name = "Andre",
Mail = "fs@beging.de",
GroupsList = new List<UserGroup> { UserGroup.Ambassador },
Type = UserType.Admin,
Created = DateTime.UtcNow,
EncryptedPassword = "qSIxTZo7J8M="
@@ -117,7 +118,15 @@ namespace FoodsharingSiegen.Server.Auth
{
var serializedToken = AuthHelper.CreateToken(_user);
await _localStorageService.SetItem(StorageKeys.TokenKey, serializedToken);
if (_user.ForceLogout)
{
_user.ForceLogout = false;
await Context.SaveChangesAsync();
}
Context.Entry(_user).State = EntityState.Detached;
return new OperationResult();
}