feat: Add verification code expiration time
This commit is contained in:
parent
b0d2568d50
commit
c9d124603f
|
|
@ -20,6 +20,7 @@ public class User
|
|||
public string Type { get; set; } = UserType.Client;
|
||||
public string Role { get; set; } = UserRole.User;
|
||||
public string? VerificationCode { get; set; }
|
||||
public DateTime? VerificationCodeExpireAt { get; set; }
|
||||
public bool Verified { get; set; }
|
||||
public string RegionCode { get; set; } = "CN";
|
||||
public string? AffiliateId { get; set; }
|
||||
|
|
|
|||
|
|
@ -17,6 +17,7 @@ public class UserDocument : MongoBase
|
|||
public string Type { get; set; } = UserType.Client;
|
||||
public string Role { get; set; } = null!;
|
||||
public string? VerificationCode { get; set; }
|
||||
public DateTime? VerificationCodeExpireAt { get; set; }
|
||||
public bool Verified { get; set; }
|
||||
public string? RegionCode { get; set; }
|
||||
public string? AffiliateId { get; set; }
|
||||
|
|
@ -48,6 +49,7 @@ public class UserDocument : MongoBase
|
|||
EmployeeId = EmployeeId,
|
||||
IsDisabled = IsDisabled,
|
||||
VerificationCode = VerificationCode,
|
||||
VerificationCodeExpireAt = VerificationCodeExpireAt,
|
||||
Verified = Verified,
|
||||
RegionCode = RegionCode,
|
||||
Permissions = Permissions,
|
||||
|
|
|
|||
|
|
@ -132,6 +132,7 @@ public partial class MongoRepository
|
|||
{
|
||||
var filter = Builders<UserDocument>.Filter.Eq(x => x.Id, userId);
|
||||
var update = Builders<UserDocument>.Update.Set(x => x.VerificationCode, verficationCode)
|
||||
.Set(x => x.VerificationCodeExpireAt, DateTime.UtcNow.AddMinutes(5))
|
||||
.Set(x => x.UpdatedTime, DateTime.UtcNow);
|
||||
_dc.Users.UpdateOne(filter, update);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue