mirror of
https://github.com/btcpayserver/btcpayserver.git
synced 2025-03-10 17:26:05 +01:00
* Users list: Cleanups * Policies: Flip registration settings * Policies: Add RequireUserApproval setting * Add approval to user * Require approval on login and for API key * API handling * AccountController cleanups * Test fix * Apply suggestions from code review Co-authored-by: Nicolas Dorier <nicolas.dorier@gmail.com> * Add missing imports * Communicate login requirements to user on account creation * Add login requirements to basic auth handler * Cleanups and test fix * Encapsulate approval logic in user service and log approval changes * Send follow up "Account approved" email Closes #5656. * Add notification for admins * Fix creating a user via the admin view * Update list: Unify flags into status column, add approve action * Adjust "Resend email" wording * Incorporate feedback from code review * Remove duplicate test server policy reset --------- Co-authored-by: Nicolas Dorier <nicolas.dorier@gmail.com>
51 lines
1.9 KiB
C#
51 lines
1.9 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using Microsoft.AspNetCore.Identity;
|
|
using Microsoft.EntityFrameworkCore;
|
|
using Microsoft.EntityFrameworkCore.Infrastructure;
|
|
using Newtonsoft.Json.Linq;
|
|
|
|
namespace BTCPayServer.Data
|
|
{
|
|
// Add profile data for application users by adding properties to the ApplicationUser class
|
|
public class ApplicationUser : IdentityUser, IHasBlob<UserBlob>
|
|
{
|
|
public bool RequiresEmailConfirmation { get; set; }
|
|
public bool RequiresApproval { get; set; }
|
|
public bool Approved { get; set; }
|
|
public List<StoredFile> StoredFiles { get; set; }
|
|
[Obsolete("U2F support has been replace with FIDO2")]
|
|
public List<U2FDevice> U2FDevices { get; set; }
|
|
public List<APIKeyData> APIKeys { get; set; }
|
|
public DateTimeOffset? Created { get; set; }
|
|
public string DisabledNotifications { get; set; }
|
|
|
|
public List<NotificationData> Notifications { get; set; }
|
|
public List<UserStore> UserStores { get; set; }
|
|
public List<Fido2Credential> Fido2Credentials { get; set; }
|
|
|
|
[Obsolete("Use Blob2 instead")]
|
|
public byte[] Blob { get; set; }
|
|
public string Blob2 { get; set; }
|
|
|
|
public List<IdentityUserRole<string>> UserRoles { get; set; }
|
|
|
|
public static void OnModelCreating(ModelBuilder builder, DatabaseFacade databaseFacade)
|
|
{
|
|
builder.Entity<ApplicationUser>()
|
|
.HasMany<IdentityUserRole<string>>(user => user.UserRoles)
|
|
.WithOne().HasForeignKey(role => role.UserId);
|
|
if (databaseFacade.IsNpgsql())
|
|
{
|
|
builder.Entity<ApplicationUser>()
|
|
.Property(o => o.Blob2)
|
|
.HasColumnType("JSONB");
|
|
}
|
|
}
|
|
}
|
|
|
|
public class UserBlob
|
|
{
|
|
public bool ShowInvoiceStatusChangeHint { get; set; }
|
|
}
|
|
}
|