Add Custom Identity User and Modify Registration/login#16
Merged
JoeProgrammer88 merged 8 commits intomainfrom Oct 3, 2025
Merged
Add Custom Identity User and Modify Registration/login#16JoeProgrammer88 merged 8 commits intomainfrom
JoeProgrammer88 merged 8 commits intomainfrom
Conversation
The `DefaultConnection` string in the `ConnectionStrings` section of the `appsettings.json` file was updated. The database name was changed
…ntity management Updated ApplicationDbContext to use ApplicationUser instead of IdentityUser, enabling a custom user model. Modified Program.cs to configure identity services with ApplicationUser and ApplicationDbContext. Updated _LoginPartial.cshtml to use SignInManager and UserManager with ApplicationUser.
Introduced `FirstName` and `LastName` properties to the `ApplicationUser` model. Added constraints to enforce a maximum length of 50 characters and marked these fields as required. Created migrations `20251003175158_CustomizeUser` and `20251003175653_AddedNameLength` to update the database schema: - Added `FirstName` and `LastName` columns to the `AspNetUsers` table. - Updated column definitions to enforce length constraints. Updated `ApplicationDbContextModelSnapshot` and related designer files to reflect these changes. Adopted modern EF Core conventions and annotations for improved maintainability.
Enhanced the registration form and logic to include new fields: - Added `Username`, `FirstName`, and `LastName` input fields in `Register.cshtml` with validation and labels. - Changed `Email` input's `autocomplete` attribute to `email`. - Introduced new properties (`Username`, `FirstName`, `LastName`) in `Register.cshtml.cs` with appropriate validation attributes. - Updated user creation logic to: - Use `Username` instead of `Email` for `SetUserNameAsync`. - Populate `FirstName` and `LastName` during registration.
The default identity system made Email and Username the same during registration. The login expected an email as the username. This has issue has been addressed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request configures registration and login functionality using ASP.NET Core Identity, including customized registration and login pages, and integrates the custom
ApplicationUsermodel with additional properties. The changes also updated the Entity Framework context to support the new user model.Authentication and Registration Pages:
Login.cshtmlandLogin.cshtml.cs) that supports local and external authentication, including username/password login, "remember me" functionality, and error handling. [1] [2]Register.cshtmlandRegister.cshtml.cs) that collects email, username, first name, last name, and password, validates input, and supports external authentication. Registration sends a confirmation email and supports immediate sign-in or confirmation flow. [1] [2]Custom User Model Integration:
ApplicationDbContextto inherit fromIdentityDbContext<ApplicationUser>, and configured theFirstNameandLastNameproperties to be required and have a maximum length of 50 characters.