Class OneTimeCode
- Namespace
- Dynamicweb.Security.UserManagement
- Assembly
- Dynamicweb.Core.dll
Represents the functionality to work with one-time codes.
public sealed class OneTimeCode
- Inheritance
-
OneTimeCode
- Inherited Members
Properties
Code
The one-time code.
public string Code { get; }
Property Value
Expiration
The date and time when the code expires.
public DateTimeOffset Expiration { get; }
Property Value
Methods
Create()
Creates a new instance of the OneTimeCode generating a new code.
public static OneTimeCode Create()
Returns
- OneTimeCode
The instance of the OneTimeCode with randomly generated code.
Create(int)
Creates a new instance of the OneTimeCode generating a new code.
public static OneTimeCode Create(int codeLifetime)
Parameters
codeLifetimeintThe code lifetime in seconds.
Returns
- OneTimeCode
The instance of the OneTimeCode with randomly generated code.
EncryptCode()
public string EncryptCode()
Returns
GetCodeLifetime()
Gets the code lifetime in seconds.
public static int GetCodeLifetime()
Returns
- int
The code lifetime in seconds.
ValidateCode(string?)
Checks if the codeToVerify is valid and not outdated.
public bool ValidateCode(string? codeToVerify)
Parameters
Returns
- bool
Trueif the code is valid and not outdated, otherwiseFalse.