mirror of
https://github.com/bitwarden/server.git
synced 2025-07-05 18:12:48 -05:00
Auth/PM-6198 - Registration with Email Verification - Add email clicked endpoint (#4520)
* PM-6198 - RegistrationEmailVerificationTokenable - add new static validate token method * PM-6198 - Rename RegistrationStart to Registration as we now have to add another anonymous reference event. * PM-6198 - rest of work * PM-6198 - Unit test new account controller method. * PM-6198 - Integration test new account controller endpoint
This commit is contained in:
@ -0,0 +1,17 @@
|
||||
#nullable enable
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
using Bit.Core.Utilities;
|
||||
|
||||
namespace Bit.Core.Auth.Models.Api.Request.Accounts;
|
||||
|
||||
public class RegisterVerificationEmailClickedRequestModel
|
||||
{
|
||||
[Required]
|
||||
[StrictEmailAddress]
|
||||
[StringLength(256)]
|
||||
public string Email { get; set; }
|
||||
|
||||
[Required]
|
||||
public string EmailVerificationToken { get; set; }
|
||||
|
||||
}
|
@ -55,4 +55,12 @@ public class RegistrationEmailVerificationTokenable : ExpiringTokenable
|
||||
&& !string.IsNullOrWhiteSpace(Email);
|
||||
|
||||
|
||||
public static bool ValidateToken(IDataProtectorTokenFactory<RegistrationEmailVerificationTokenable> dataProtectorTokenFactory, string token, string userEmail)
|
||||
{
|
||||
return dataProtectorTokenFactory.TryUnprotect(token, out var tokenable)
|
||||
&& tokenable.Valid
|
||||
&& tokenable.TokenIsValid(userEmail);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user