Table of Contents

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

string

Expiration

The date and time when the code expires.

public DateTimeOffset Expiration { get; }

Property Value

DateTimeOffset

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.

EncryptCode()

public string EncryptCode()

Returns

string

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

codeToVerify string

The code to compare with the Code.

Returns

bool

True if the code is valid and not outdated, otherwise False.

To top