Table of Contents

Class OneTimeCodeLoginModel

Namespace
Dynamicweb.Security.UserManagement.Authentication
Assembly
Dynamicweb.Core.dll

Represents the model used for performing a one-time code based login flow.

public sealed class OneTimeCodeLoginModel
Inheritance
OneTimeCodeLoginModel
Inherited Members

Remarks

The model encapsulates a generated OneTimeCode instance with a lifetime determined by GetCodeLifetime(). The FailedAttempts counter can be used by higher-level logic to enforce throttling, lockouts, or additional security measures.

Constructors

OneTimeCodeLoginModel(int, bool)

Represents the model used for performing a one-time code based login flow.

public OneTimeCodeLoginModel(int userId, bool rememberMe)

Parameters

userId int

The unique identifier of the user attempting to authenticate.

rememberMe bool

Indicates whether the authentication system should persist the user's session (e.g. via a long-lived cookie) to keep the user signed in across browser sessions.

Remarks

The model encapsulates a generated OneTimeCode instance with a lifetime determined by GetCodeLifetime(). The FailedAttempts counter can be used by higher-level logic to enforce throttling, lockouts, or additional security measures.

Properties

FailedAttempts

Gets or sets the number of failed one-time code input attempts for this login context.

public int FailedAttempts { get; set; }

Property Value

int

An int counting failed verification attempts. This can be leveraged to trigger security measures such as temporary lockout or additional verification challenges.

OneTimeCode

Gets the generated one-time code associated with this login attempt.

public OneTimeCode OneTimeCode { get; }

Property Value

OneTimeCode

A OneTimeCode instance created with a lifetime specified by GetCodeLifetime().

Remarks

The code should be delivered to the user through a secure channel (e.g. email, SMS, authenticator app) and validated before completing the login process.

RememberMe

Gets a value indicating whether the user's authenticated session should be persisted for future visits.

public bool RememberMe { get; }

Property Value

bool

Remarks

When RememberMe is set to true (checked) then the login cookie will be stored on the current device with an expiration based on the "Valid for" setting ("/Globalsettings/Modules/Users/AutoLoginCookie/ValideForDays") - or default to 30 days. When RememberMe is set to false (unchecked) then the login cookie will be stored for the current browser session only. The same "Valid for" setting for both frontend(Dynamicweb.Extranet cookie) and backend(Dynamicweb.Admin cookie).

UserId

Gets the unique identifier of the user.

public int UserId { get; }

Property Value

int

An int representing the user ID associated with this one-time code login attempt.

To top