mirror of
https://github.com/bitwarden/server.git
synced 2025-06-30 23:52:50 -05:00
Handle null user in captch tokenable (#1897)
* Handle null user in captch tokenable * Update test/Core.Test/Models/Business/Tokenables/HCaptchaTokenableTests.cs Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com> Co-authored-by: Thomas Rittson <31796059+eliykat@users.noreply.github.com>
This commit is contained in:
@ -24,12 +24,17 @@ namespace Bit.Core.Models.Business.Tokenables
|
||||
|
||||
public HCaptchaTokenable(User user) : this()
|
||||
{
|
||||
Id = user.Id;
|
||||
Email = user.Email;
|
||||
Id = user?.Id ?? default;
|
||||
Email = user?.Email;
|
||||
}
|
||||
|
||||
public bool TokenIsValid(User user)
|
||||
{
|
||||
if (Id == default || Email == default || user == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return Id == user.Id &&
|
||||
Email.Equals(user.Email, StringComparison.InvariantCultureIgnoreCase);
|
||||
}
|
||||
|
Reference in New Issue
Block a user