mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-21 14:04:12 +01:00
Refactoring
This commit is contained in:
parent
98276bcb3d
commit
1b58058796
1 changed files with 8 additions and 13 deletions
|
@ -67,8 +67,13 @@ namespace BTCPayServer.Controllers
|
|||
int? pin = null;
|
||||
var websocketHelper = new WebSocketHelper(websocket);
|
||||
|
||||
async Task<bool> RequireMoreInformation()
|
||||
async Task<bool> RequireDeviceUnlocking()
|
||||
{
|
||||
if (deviceEntry == null)
|
||||
{
|
||||
await websocketHelper.Send("{ \"error\": \"need-device\"}", cancellationToken);
|
||||
return true;
|
||||
}
|
||||
if (deviceEntry.NeedsPinSent is true && pin is null)
|
||||
{
|
||||
await websocketHelper.Send("{ \"error\": \"need-pin\"}", cancellationToken);
|
||||
|
@ -95,12 +100,7 @@ namespace BTCPayServer.Controllers
|
|||
password = device.Password;
|
||||
break;
|
||||
case "ask-sign":
|
||||
if (device == null)
|
||||
{
|
||||
await websocketHelper.Send("{ \"error\": \"need-device\"}", cancellationToken);
|
||||
continue;
|
||||
}
|
||||
if (await RequireMoreInformation())
|
||||
if (await RequireDeviceUnlocking())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -163,12 +163,7 @@ namespace BTCPayServer.Controllers
|
|||
}
|
||||
break;
|
||||
case "ask-xpubs":
|
||||
if (device == null)
|
||||
{
|
||||
await websocketHelper.Send("{ \"error\": \"need-device\"}", cancellationToken);
|
||||
continue;
|
||||
}
|
||||
if (await RequireMoreInformation())
|
||||
if (await RequireDeviceUnlocking())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue