BetterFinds
Public Member Functions | Properties | Private Attributes | List of all members
BetterFinds.Pages.LoginModel Class Reference

Model for the Login page. More...

Inheritance diagram for BetterFinds.Pages.LoginModel:
Inheritance graph
[legend]
Collaboration diagram for BetterFinds.Pages.LoginModel:
Collaboration graph
[legend]

Public Member Functions

 LoginModel (IConfiguration configuration)
 Initializes a new instance of the LoginModel class. More...
 
IActionResult OnGet ()
 The action that occurs when the user visits the login page. More...
 
async Task< IActionResult > OnPostAsync ()
 The action that occurs when the user submits the login form. More...
 

Properties

string Username = "" [get, set]
 The username entered by the user. More...
 
string Password = "" [get, set]
 The password entered by the user. More...
 
bool RememberMe = false [get, set]
 Whether the user wants to stay logged in. More...
 

Private Attributes

readonly IConfiguration configuration
 The IConfiguration instance. More...
 

Detailed Description

Model for the Login page.

Constructor & Destructor Documentation

◆ LoginModel()

BetterFinds.Pages.LoginModel.LoginModel ( IConfiguration  configuration)

Initializes a new instance of the LoginModel class.

Parameters
configurationThe IConfiguration instance.

Member Function Documentation

◆ OnGet()

IActionResult BetterFinds.Pages.LoginModel.OnGet ( )
inline

The action that occurs when the user visits the login page.

Checks if the user is already logged in. If so, redirects to the index page. If the user got redirected from logout, displays a success logout message. If the user got redirected from register, enters the username they just created and displays a success register message.

Returns
A task that represents the action of loading the login page.
Returns

◆ OnPostAsync()

async Task<IActionResult> BetterFinds.Pages.LoginModel.OnPostAsync ( )
inline

The action that occurs when the user submits the login form.

Checks if the username and password are valid. If so, logs the user in and redirects to the index page. If not, displays an error message. Manually creates the cookie to store the ClientId in the session.

Returns
A task that represents the asynchronous operation of logging in.

Member Data Documentation

◆ configuration

readonly IConfiguration BetterFinds.Pages.LoginModel.configuration
private

The IConfiguration instance.

Property Documentation

◆ Password

string BetterFinds.Pages.LoginModel.Password = ""
getset

The password entered by the user.

◆ RememberMe

bool BetterFinds.Pages.LoginModel.RememberMe = false
getset

Whether the user wants to stay logged in.

◆ Username

string BetterFinds.Pages.LoginModel.Username = ""
getset

The username entered by the user.


The documentation for this class was generated from the following file: