mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-31 04:04:21 -04:00
22 lines
476 B
C#
22 lines
476 B
C#
using System;
|
|
using IdentityModel;
|
|
using Microsoft.AspNetCore.Identity;
|
|
|
|
namespace Kyoo.Models
|
|
{
|
|
public class User : IdentityUser
|
|
{
|
|
public string OTAC { get; set; }
|
|
public DateTime? OTACExpires { get; set; }
|
|
|
|
public string GenerateOTAC(TimeSpan validFor)
|
|
{
|
|
string otac = CryptoRandom.CreateUniqueId();
|
|
string hashed = otac; // TODO should add a good hashing here.
|
|
|
|
OTAC = hashed;
|
|
OTACExpires = DateTime.UtcNow.Add(validFor);
|
|
return otac;
|
|
}
|
|
}
|
|
} |