mirror of
https://github.com/bitwarden/server.git
synced 2025-07-02 16:42:50 -05:00

* Allow for auth request validation for sending two factor emails * Refactored 2fa send email and identity to cater for passwordless * Refactored 2fa send email and identity to cater for passwordless Signed-off-by: gbubemismith <gsmithwalter@gmail.com> * Inform that we track issues outside of Github (#2331) * Inform that we track issues outside of Github * Use checkboxes for info acknowledgement Signed-off-by: gbubemismith <gsmithwalter@gmail.com> * Refactored 2fa send email and identity to cater for passwordless * ran dotnet format Signed-off-by: gbubemismith <gsmithwalter@gmail.com> Co-authored-by: addison <addisonbeck1@gmail.com>
21 lines
748 B
C#
21 lines
748 B
C#
using System.ComponentModel.DataAnnotations;
|
|
|
|
namespace Bit.Api.Models.Request.Accounts;
|
|
|
|
public class SecretVerificationRequestModel : IValidatableObject
|
|
{
|
|
[StringLength(300)]
|
|
public string MasterPasswordHash { get; set; }
|
|
public string OTP { get; set; }
|
|
public string AuthRequestAccessCode { get; set; }
|
|
public string Secret => !string.IsNullOrEmpty(MasterPasswordHash) ? MasterPasswordHash : OTP;
|
|
|
|
public virtual IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
|
|
{
|
|
if (string.IsNullOrEmpty(Secret) && string.IsNullOrEmpty(AuthRequestAccessCode))
|
|
{
|
|
yield return new ValidationResult("MasterPasswordHash, OTP or AccessCode must be supplied.");
|
|
}
|
|
}
|
|
}
|