Fix a bunch of minor bugs (#4983)

This commit is contained in:
Nicolas Dorier
2023-05-19 08:41:21 +09:00
committed by GitHub
parent acf003b1b4
commit 3d57b944ca
9 changed files with 12 additions and 23 deletions

View File

@@ -889,8 +889,11 @@ namespace BTCPayServer.Controllers
var userId = GetUserId();
if (userId == null)
return Challenge(AuthenticationSchemes.Cookie);
storeId = model.StoreId;
var store = CurrentStore ?? await _Repo.FindStore(storeId, userId);
var store = model.StoreId switch
{
null => CurrentStore,
string id => await _Repo.FindStore(storeId, userId)
};
if (store == null)
return Challenge(AuthenticationSchemes.Cookie);
var tokenRequest = new TokenRequest()
@@ -908,7 +911,7 @@ namespace BTCPayServer.Controllers
Id = tokenRequest.PairingCode,
Label = model.Label,
});
await _TokenRepository.PairWithStoreAsync(tokenRequest.PairingCode, storeId);
await _TokenRepository.PairWithStoreAsync(tokenRequest.PairingCode, store.Id);
pairingCode = tokenRequest.PairingCode;
}
else