User: Add name and image URL (#6008)

* User: Add name and image URL

More personalization options, prerequisite for btcpayserver/app#3.

Additionally:
- Remove ambigious and read-only username from manage view.
- Improve email verification conditions and display.
- Greenfield: Update current user. Prerequisite for btcpayserver/app#13.

* Refactor UpdateCurrentUser

* Replace new columns by UserBlob

* Update email check and add test case for mailbox addresses

---------

Co-authored-by: nicolas.dorier <nicolas.dorier@gmail.com>
This commit is contained in:
d11n
2024-06-26 10:39:22 +02:00
committed by GitHub
parent 1ba7b67e70
commit bf66b54c9a
24 changed files with 632 additions and 71 deletions

View File

@@ -1,7 +1,9 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using BTCPayServer.Data;
using BTCPayServer.Services.Stores;
using Microsoft.AspNetCore.Http;
namespace BTCPayServer.Models.ServerViewModels
{
@@ -10,8 +12,12 @@ namespace BTCPayServer.Models.ServerViewModels
public class UserViewModel
{
public string Id { get; set; }
public string Name { get; set; }
public string Email { get; set; }
public string Name { get; set; }
[Display(Name = "Image")]
public IFormFile ImageFile { get; set; }
public string ImageUrl { get; set; }
public bool? EmailConfirmed { get; set; }
public bool? Approved { get; set; }
public bool Disabled { get; set; }
@@ -20,13 +26,13 @@ namespace BTCPayServer.Models.ServerViewModels
public IEnumerable<string> Roles { get; set; }
public IEnumerable<UserStore> Stores { get; set; }
}
public List<UserViewModel> Users { get; set; } = new List<UserViewModel>();
public List<UserViewModel> Users { get; set; } = [];
public override int CurrentPageCount => Users.Count;
public Dictionary<string, string> Roles { get; set; }
}
public class RolesViewModel : BasePagingViewModel
{
public List<StoreRepository.StoreRole> Roles { get; set; } = new List<StoreRepository.StoreRole>();
public List<StoreRepository.StoreRole> Roles { get; set; } = [];
public string DefaultRole { get; set; }
public override int CurrentPageCount => Roles.Count;
}