mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-02-22 22:25:28 +01:00
throw on non-u2f specific errors
This commit is contained in:
parent
9ccb472c7a
commit
dad3039c06
3 changed files with 6 additions and 4 deletions
|
@ -23,6 +23,7 @@ using BTCPayServer.U2F.Models;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using NicolasDorier.RateLimits;
|
using NicolasDorier.RateLimits;
|
||||||
using BTCPayServer.Data;
|
using BTCPayServer.Data;
|
||||||
|
using U2F.Core.Exceptions;
|
||||||
|
|
||||||
namespace BTCPayServer.Controllers
|
namespace BTCPayServer.Controllers
|
||||||
{
|
{
|
||||||
|
@ -235,9 +236,8 @@ namespace BTCPayServer.Controllers
|
||||||
|
|
||||||
errorMessage = "Invalid login attempt.";
|
errorMessage = "Invalid login attempt.";
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (U2fException e)
|
||||||
{
|
{
|
||||||
|
|
||||||
errorMessage = e.Message;
|
errorMessage = e.Message;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -3,6 +3,7 @@ using System.Threading.Tasks;
|
||||||
using BTCPayServer.Models;
|
using BTCPayServer.Models;
|
||||||
using BTCPayServer.U2F.Models;
|
using BTCPayServer.U2F.Models;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
|
using U2F.Core.Exceptions;
|
||||||
|
|
||||||
namespace BTCPayServer.Controllers
|
namespace BTCPayServer.Controllers
|
||||||
{
|
{
|
||||||
|
@ -65,7 +66,7 @@ namespace BTCPayServer.Controllers
|
||||||
return RedirectToAction("U2FAuthentication");
|
return RedirectToAction("U2FAuthentication");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception e)
|
catch (U2fException e)
|
||||||
{
|
{
|
||||||
errorMessage = e.Message;
|
errorMessage = e.Message;
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,7 @@ using U2F.Core.Models;
|
||||||
using U2F.Core.Utils;
|
using U2F.Core.Utils;
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore.Query;
|
using Microsoft.EntityFrameworkCore.Query;
|
||||||
|
using U2F.Core.Exceptions;
|
||||||
|
|
||||||
namespace BTCPayServer.U2F
|
namespace BTCPayServer.U2F
|
||||||
{
|
{
|
||||||
|
@ -115,7 +116,7 @@ namespace BTCPayServer.U2F
|
||||||
|
|
||||||
if (duplicate)
|
if (duplicate)
|
||||||
{
|
{
|
||||||
throw new InvalidOperationException("The U2F Device has already been registered with this user");
|
throw new U2fException("The U2F Device has already been registered with this user");
|
||||||
}
|
}
|
||||||
|
|
||||||
await context.U2FDevices.AddAsync(new U2FDevice()
|
await context.U2FDevices.AddAsync(new U2FDevice()
|
||||||
|
|
Loading…
Add table
Reference in a new issue