mirror of
https://github.com/bitwarden/server.git
synced 2025-07-01 08:02:49 -05:00
api for requesting installation ids
This commit is contained in:
22
src/Core/Models/Api/Request/InstallationRequestModel.cs
Normal file
22
src/Core/Models/Api/Request/InstallationRequestModel.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using Bit.Core.Models.Table;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
{
|
||||
public class InstallationRequestModel
|
||||
{
|
||||
[Required]
|
||||
[EmailAddress]
|
||||
public string Email { get; set; }
|
||||
|
||||
public Installation ToInstallation()
|
||||
{
|
||||
return new Installation
|
||||
{
|
||||
Key = Utilities.CoreHelpers.SecureRandomString(20),
|
||||
Email = Email,
|
||||
Enabled = true
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
18
src/Core/Models/Api/Response/InstallationResponseModel.cs
Normal file
18
src/Core/Models/Api/Response/InstallationResponseModel.cs
Normal file
@ -0,0 +1,18 @@
|
||||
using System;
|
||||
using Bit.Core.Models.Table;
|
||||
|
||||
namespace Bit.Core.Models.Api
|
||||
{
|
||||
public class InstallationResponseModel : ResponseModel
|
||||
{
|
||||
public InstallationResponseModel(Installation installation)
|
||||
: base("installation")
|
||||
{
|
||||
Id = installation.Id.ToString();
|
||||
Key = installation.Key;
|
||||
}
|
||||
|
||||
public string Id { get; set; }
|
||||
public string Key { get; set; }
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user