Model for the Register page.
More...
Model for the Register page.
◆ RegisterModel()
| BetterFinds.Pages.RegisterModel.RegisterModel |
( |
IConfiguration |
configuration | ) |
|
Initializes a new instance of the RegisterModel class.
- Parameters
-
| configuration | The IConfiguration instance. |
◆ OnGet()
| IActionResult BetterFinds.Pages.RegisterModel.OnGet |
( |
| ) |
|
|
inline |
Redirects authenticated user to index page, otherwise loads page.
Checks if the user is logged in using the current session, if any. If the user is logged in redirects him to the index page. Otherwise, loads the register page.
- Returns
- A task that represents the page redirection or loading.
◆ OnPost()
| IActionResult BetterFinds.Pages.RegisterModel.OnPost |
( |
| ) |
|
|
inline |
Creates a new account if all requirements are met.
-
Username must be unique, and between 3 and 32 alphanumeric characters.
-
Password must be between 8 and 64 characters.
-
Password must match ConfirmPassword.
-
Email must be unique, and between 5 and 320 characters.
-
Full name must be between 3 and 64 alphabetical characters and spaces.
-
Profile picture must be 256 characters or fewer.
-
OptNewsletter is an optional checkbox.
If the requirements are met, the user is added to the database and redirected to the login page, with a success message and the username pre-filled. Otherwise, the user is redirected to the register page with an error message.
- Returns
- A task that represents the creation of an account.
◆ RegexFullName()
| static partial Regex BetterFinds.Pages.RegisterModel.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.RegisterModel.RegexUsername |
( |
| ) |
|
|
staticprivate |
Returns a regex that matches a username.
A username contains only alphanumeric characters.
- Returns
- A regex that matches a username.
◆ configuration
| readonly IConfiguration BetterFinds.Pages.RegisterModel.configuration |
|
private |
The IConfiguration instance.
◆ ConfirmPassword
| string BetterFinds.Pages.RegisterModel.ConfirmPassword = "" |
|
getset |
The password confirmation of the user.
◆ Email
| string BetterFinds.Pages.RegisterModel.Email = "" |
|
getset |
◆ FullName
| string BetterFinds.Pages.RegisterModel.FullName = "" |
|
getset |
The full name of the user.
◆ OptNewsletter
| bool BetterFinds.Pages.RegisterModel.OptNewsletter = false |
|
getset |
Whether the user wants to receive the newsletter.
◆ Password
| string BetterFinds.Pages.RegisterModel.Password = "" |
|
getset |
The password of the user.
◆ ProfilePic
| string? BetterFinds.Pages.RegisterModel.ProfilePic |
|
getset |
The profile picture of the user.
◆ Username
| string BetterFinds.Pages.RegisterModel.Username = "" |
|
getset |
The username of the user.
The documentation for this class was generated from the following file:
- BetterFinds/Pages/Register.cshtml.cs