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

Model for the My Account page. This class is decorated with the Authorize attribute. More...

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

Public Member Functions

 MyAccountModel (IConfiguration configuration)
 Initializes a new instance of the MyAccountModel class. More...
 
IActionResult OnGet ()
 The action that occurs when the user visits the MyAccount page. More...
 
IActionResult OnPost ()
 Updates the user's information if all requirements are met. More...
 

Properties

string Username = "" [get, set]
 The username entered by the user. More...
 
string FullName = "" [get, set]
 The full name entered by the user. More...
 
string Email = "" [get, set]
 The email entered by the user. More...
 
string Password = "" [get, set]
 The password entered by the user. More...
 
string ConfirmPassword = "" [get, set]
 The password confirmation entered by the user. More...
 
string? ProfilePic [get, set]
 The profile picture entered by the user. More...
 
bool OptNewsletter = false [get, set]
 Whether the user wants to subscribe to the newsletter. More...
 

Static Private Member Functions

static partial Regex RegexUsername ()
 Returns a regex that matches a username. More...
 
static partial Regex RegexFullName ()
 Returns a regex that matches a full name. More...
 

Private Attributes

readonly IConfiguration configuration
 The IConfiguration instance. More...
 

Detailed Description

Model for the My Account page. This class is decorated with the Authorize attribute.

Constructor & Destructor Documentation

◆ MyAccountModel()

BetterFinds.Pages.MyAccountModel.MyAccountModel ( IConfiguration  configuration)

Initializes a new instance of the MyAccountModel class.

Parameters
configurationThe IConfiguration instance.

Member Function Documentation

◆ OnGet()

IActionResult BetterFinds.Pages.MyAccountModel.OnGet ( )
inline

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

Gets the user's information from the database and displays it, as well as the number of auctions and bids they have. If the user got redirected from updating their account, displays a success message.

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

◆ OnPost()

IActionResult BetterFinds.Pages.MyAccountModel.OnPost ( )
inline

Updates the user's information if all requirements are met.

  • Username must be unique and between 3 and 32 alphanumeric characters.
  • Full name must be between 3 and 64 alphabetic characters.
  • Email must unique and be between 5 and 320 characters.
  • Password must be between 8 and 64 characters.
  • Password and ConfirmPassword must match.
  • Profile picture must be 256 characters or fewer.
  • OptNewsletter is an optional checkbox.

If all requirements are met, the user's information is updated in the database and they are redirected to the MyAccount page with a success message.

Returns
A task that represents the action of updating the user's information.

◆ RegexFullName()

static partial Regex BetterFinds.Pages.MyAccountModel.RegexFullName ( )
staticprivate

Returns a regex that matches a full name.

A full name contains only alphabetical characters and spaces.

Returns
A regex that matches a full name.

◆ RegexUsername()

static partial Regex BetterFinds.Pages.MyAccountModel.RegexUsername ( )
staticprivate

Returns a regex that matches a username.

A username contains only alphanumeric characters.

Returns
A regex that matches a username.

Member Data Documentation

◆ configuration

readonly IConfiguration BetterFinds.Pages.MyAccountModel.configuration
private

The IConfiguration instance.

Property Documentation

◆ ConfirmPassword

string BetterFinds.Pages.MyAccountModel.ConfirmPassword = ""
getset

The password confirmation entered by the user.

◆ Email

string BetterFinds.Pages.MyAccountModel.Email = ""
getset

The email entered by the user.

◆ FullName

string BetterFinds.Pages.MyAccountModel.FullName = ""
getset

The full name entered by the user.

◆ OptNewsletter

bool BetterFinds.Pages.MyAccountModel.OptNewsletter = false
getset

Whether the user wants to subscribe to the newsletter.

◆ Password

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

The password entered by the user.

◆ ProfilePic

string? BetterFinds.Pages.MyAccountModel.ProfilePic
getset

The profile picture entered by the user.

◆ Username

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

The username entered by the user.


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