mirror of
https://github.com/bitwarden/server
synced 2026-02-24 16:42:52 +00:00
some helper functions for users and orgs
This commit is contained in:
@@ -1,6 +1,8 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Bit.Core;
|
||||
using Bit.Core.Models.Table;
|
||||
using Bit.Core.Utilities;
|
||||
|
||||
namespace Bit.Admin.Models
|
||||
{
|
||||
@@ -8,9 +10,11 @@ namespace Bit.Admin.Models
|
||||
{
|
||||
public OrganizationEditModel() { }
|
||||
|
||||
public OrganizationEditModel(Organization org)
|
||||
public OrganizationEditModel(Organization org, GlobalSettings globalSettings)
|
||||
{
|
||||
Organization = org;
|
||||
BraintreeMerchantId = globalSettings.Braintree.MerchantId;
|
||||
|
||||
Name = org.Name;
|
||||
BusinessName = org.BusinessName;
|
||||
BusinessAddress1 = org.BusinessAddress1;
|
||||
@@ -39,6 +43,9 @@ namespace Bit.Admin.Models
|
||||
}
|
||||
|
||||
public Organization Organization { get; set; }
|
||||
public string RandomLicenseKey => CoreHelpers.SecureRandomString(20);
|
||||
public string FourteenDayExpirationDate => DateTime.Now.AddDays(14).ToString("yyyy-MM-ddTHH:mm");
|
||||
public string BraintreeMerchantId { get; set; }
|
||||
|
||||
[Required]
|
||||
[Display(Name = "Name")]
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Bit.Core;
|
||||
using Bit.Core.Models.Table;
|
||||
using Bit.Core.Utilities;
|
||||
|
||||
namespace Bit.Admin.Models
|
||||
{
|
||||
@@ -8,9 +10,11 @@ namespace Bit.Admin.Models
|
||||
{
|
||||
public UserEditModel() { }
|
||||
|
||||
public UserEditModel(User user)
|
||||
public UserEditModel(User user, GlobalSettings globalSettings)
|
||||
{
|
||||
User = user;
|
||||
BraintreeMerchantId = globalSettings.Braintree.MerchantId;
|
||||
|
||||
Name = user.Name;
|
||||
Email = user.Email;
|
||||
EmailVerified = user.EmailVerified;
|
||||
@@ -24,6 +28,9 @@ namespace Bit.Admin.Models
|
||||
}
|
||||
|
||||
public User User { get; set; }
|
||||
public string RandomLicenseKey => CoreHelpers.SecureRandomString(20);
|
||||
public string OneYearExpirationDate => DateTime.Now.AddYears(1).ToString("yyyy-MM-ddTHH:mm");
|
||||
public string BraintreeMerchantId { get; set; }
|
||||
|
||||
[Display(Name = "Name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
Reference in New Issue
Block a user