Skip to content

Commit

Permalink
added first and last name to applicationuser
Browse files Browse the repository at this point in the history
  • Loading branch information
kephalienterprises committed Apr 30, 2021
1 parent df4c678 commit 6493789
Show file tree
Hide file tree
Showing 34 changed files with 1,173 additions and 85 deletions.
Binary file modified .vs/AshburtonCocWebsite/v16/.suo
Binary file not shown.
14 changes: 14 additions & 0 deletions Areas/Identity/Data/ApplicationUser.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Microsoft.AspNetCore.Identity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;

namespace AshburtonCocWebsite.Areas.Identity.Data
{
public class ApplicationUser : IdentityUser
{
public string FirstName { get; set; }
public string LastName { get; set; }
}
}
5 changes: 3 additions & 2 deletions Areas/Identity/Pages/Account/ConfirmEmail.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.WebUtilities;
using AshburtonCocWebsite.Areas.Identity.Data;

namespace AshburtonCocWebsite.Areas.Identity.Pages.Account
{
[AllowAnonymous]
public class ConfirmEmailModel : PageModel
{
private readonly UserManager<IdentityUser> _userManager;
private readonly UserManager<ApplicationUser> _userManager;

public ConfirmEmailModel(UserManager<IdentityUser> userManager)
public ConfirmEmailModel(UserManager<ApplicationUser> userManager)
{
_userManager = userManager;
}
Expand Down
7 changes: 4 additions & 3 deletions Areas/Identity/Pages/Account/ConfirmEmailChange.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using AshburtonCocWebsite.Areas.Identity.Data;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
Expand All @@ -14,10 +15,10 @@ namespace AshburtonCocWebsite.Areas.Identity.Pages.Account
[AllowAnonymous]
public class ConfirmEmailChangeModel : PageModel
{
private readonly UserManager<IdentityUser> _userManager;
private readonly SignInManager<IdentityUser> _signInManager;
private readonly UserManager<ApplicationUser> _userManager;
private readonly SignInManager<ApplicationUser> _signInManager;

public ConfirmEmailChangeModel(UserManager<IdentityUser> userManager, SignInManager<IdentityUser> signInManager)
public ConfirmEmailChangeModel(UserManager<ApplicationUser> userManager, SignInManager<ApplicationUser> signInManager)
{
_userManager = userManager;
_signInManager = signInManager;
Expand Down
11 changes: 6 additions & 5 deletions Areas/Identity/Pages/Account/ExternalLogin.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using System.Text;
using System.Text.Encodings.Web;
using System.Threading.Tasks;
using AshburtonCocWebsite.Areas.Identity.Data;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Identity.UI.Services;
Expand All @@ -19,14 +20,14 @@ namespace AshburtonCocWebsite.Areas.Identity.Pages.Account
[AllowAnonymous]
public class ExternalLoginModel : PageModel
{
private readonly SignInManager<IdentityUser> _signInManager;
private readonly UserManager<IdentityUser> _userManager;
private readonly SignInManager<ApplicationUser> _signInManager;
private readonly UserManager<ApplicationUser> _userManager;
private readonly IEmailSender _emailSender;
private readonly ILogger<ExternalLoginModel> _logger;

public ExternalLoginModel(
SignInManager<IdentityUser> signInManager,
UserManager<IdentityUser> userManager,
SignInManager<ApplicationUser> signInManager,
UserManager<ApplicationUser> userManager,
ILogger<ExternalLoginModel> logger,
IEmailSender emailSender)
{
Expand Down Expand Up @@ -121,7 +122,7 @@ public async Task<IActionResult> OnPostConfirmationAsync(string returnUrl = null

if (ModelState.IsValid)
{
var user = new IdentityUser { UserName = Input.Email, Email = Input.Email };
var user = new ApplicationUser { UserName = Input.Email, Email = Input.Email };

var result = await _userManager.CreateAsync(user);
if (result.Succeeded)
Expand Down
5 changes: 3 additions & 2 deletions Areas/Identity/Pages/Account/ForgotPassword.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,17 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.WebUtilities;
using AshburtonCocWebsite.Areas.Identity.Data;

namespace AshburtonCocWebsite.Areas.Identity.Pages.Account
{
[AllowAnonymous]
public class ForgotPasswordModel : PageModel
{
private readonly UserManager<IdentityUser> _userManager;
private readonly UserManager<ApplicationUser> _userManager;
private readonly IEmailSender _emailSender;

public ForgotPasswordModel(UserManager<IdentityUser> userManager, IEmailSender emailSender)
public ForgotPasswordModel(UserManager<ApplicationUser> userManager, IEmailSender emailSender)
{
_userManager = userManager;
_emailSender = emailSender;
Expand Down
9 changes: 5 additions & 4 deletions Areas/Identity/Pages/Account/Login.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,20 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;
using AshburtonCocWebsite.Areas.Identity.Data;

namespace AshburtonCocWebsite.Areas.Identity.Pages.Account
{
[AllowAnonymous]
public class LoginModel : PageModel
{
private readonly UserManager<IdentityUser> _userManager;
private readonly SignInManager<IdentityUser> _signInManager;
private readonly UserManager<ApplicationUser> _userManager;
private readonly SignInManager<ApplicationUser> _signInManager;
private readonly ILogger<LoginModel> _logger;

public LoginModel(SignInManager<IdentityUser> signInManager,
public LoginModel(SignInManager<ApplicationUser> signInManager,
ILogger<LoginModel> logger,
UserManager<IdentityUser> userManager)
UserManager<ApplicationUser> userManager)
{
_userManager = userManager;
_signInManager = signInManager;
Expand Down
5 changes: 3 additions & 2 deletions Areas/Identity/Pages/Account/LoginWith2fa.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
using AshburtonCocWebsite.Areas.Identity.Data;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
Expand All @@ -14,10 +15,10 @@ namespace AshburtonCocWebsite.Areas.Identity.Pages.Account
[AllowAnonymous]
public class LoginWith2faModel : PageModel
{
private readonly SignInManager<IdentityUser> _signInManager;
private readonly SignInManager<ApplicationUser> _signInManager;
private readonly ILogger<LoginWith2faModel> _logger;

public LoginWith2faModel(SignInManager<IdentityUser> signInManager, ILogger<LoginWith2faModel> logger)
public LoginWith2faModel(SignInManager<ApplicationUser> signInManager, ILogger<LoginWith2faModel> logger)
{
_signInManager = signInManager;
_logger = logger;
Expand Down
5 changes: 3 additions & 2 deletions Areas/Identity/Pages/Account/LoginWithRecoveryCode.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
using AshburtonCocWebsite.Areas.Identity.Data;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
Expand All @@ -14,10 +15,10 @@ namespace AshburtonCocWebsite.Areas.Identity.Pages.Account
[AllowAnonymous]
public class LoginWithRecoveryCodeModel : PageModel
{
private readonly SignInManager<IdentityUser> _signInManager;
private readonly SignInManager<ApplicationUser> _signInManager;
private readonly ILogger<LoginWithRecoveryCodeModel> _logger;

public LoginWithRecoveryCodeModel(SignInManager<IdentityUser> signInManager, ILogger<LoginWithRecoveryCodeModel> logger)
public LoginWithRecoveryCodeModel(SignInManager<ApplicationUser> signInManager, ILogger<LoginWithRecoveryCodeModel> logger)
{
_signInManager = signInManager;
_logger = logger;
Expand Down
5 changes: 3 additions & 2 deletions Areas/Identity/Pages/Account/Logout.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,17 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;
using AshburtonCocWebsite.Areas.Identity.Data;

namespace AshburtonCocWebsite.Areas.Identity.Pages.Account
{
[AllowAnonymous]
public class LogoutModel : PageModel
{
private readonly SignInManager<IdentityUser> _signInManager;
private readonly SignInManager<ApplicationUser> _signInManager;
private readonly ILogger<LogoutModel> _logger;

public LogoutModel(SignInManager<IdentityUser> signInManager, ILogger<LogoutModel> logger)
public LogoutModel(SignInManager<ApplicationUser> signInManager, ILogger<LogoutModel> logger)
{
_signInManager = signInManager;
_logger = logger;
Expand Down
9 changes: 5 additions & 4 deletions Areas/Identity/Pages/Account/Manage/ChangePassword.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Threading.Tasks;
using AshburtonCocWebsite.Areas.Identity.Data;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
Expand All @@ -11,13 +12,13 @@ namespace AshburtonCocWebsite.Areas.Identity.Pages.Account.Manage
{
public class ChangePasswordModel : PageModel
{
private readonly UserManager<IdentityUser> _userManager;
private readonly SignInManager<IdentityUser> _signInManager;
private readonly UserManager<ApplicationUser> _userManager;
private readonly SignInManager<ApplicationUser> _signInManager;
private readonly ILogger<ChangePasswordModel> _logger;

public ChangePasswordModel(
UserManager<IdentityUser> userManager,
SignInManager<IdentityUser> signInManager,
UserManager<ApplicationUser> userManager,
SignInManager<ApplicationUser> signInManager,
ILogger<ChangePasswordModel> logger)
{
_userManager = userManager;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using System;
using System.ComponentModel.DataAnnotations;
using System.Threading.Tasks;
using AshburtonCocWebsite.Areas.Identity.Data;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
Expand All @@ -10,13 +11,13 @@ namespace AshburtonCocWebsite.Areas.Identity.Pages.Account.Manage
{
public class DeletePersonalDataModel : PageModel
{
private readonly UserManager<IdentityUser> _userManager;
private readonly SignInManager<IdentityUser> _signInManager;
private readonly UserManager<ApplicationUser> _userManager;
private readonly SignInManager<ApplicationUser> _signInManager;
private readonly ILogger<DeletePersonalDataModel> _logger;

public DeletePersonalDataModel(
UserManager<IdentityUser> userManager,
SignInManager<IdentityUser> signInManager,
UserManager<ApplicationUser> userManager,
SignInManager<ApplicationUser> signInManager,
ILogger<DeletePersonalDataModel> logger)
{
_userManager = userManager;
Expand Down
5 changes: 3 additions & 2 deletions Areas/Identity/Pages/Account/Manage/Disable2fa.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using AshburtonCocWebsite.Areas.Identity.Data;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
Expand All @@ -11,11 +12,11 @@ namespace AshburtonCocWebsite.Areas.Identity.Pages.Account.Manage
{
public class Disable2faModel : PageModel
{
private readonly UserManager<IdentityUser> _userManager;
private readonly UserManager<ApplicationUser> _userManager;
private readonly ILogger<Disable2faModel> _logger;

public Disable2faModel(
UserManager<IdentityUser> userManager,
UserManager<ApplicationUser> userManager,
ILogger<Disable2faModel> logger)
{
_userManager = userManager;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using System.Text;
using System.Text.Json;
using System.Threading.Tasks;
using AshburtonCocWebsite.Areas.Identity.Data;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
Expand All @@ -13,11 +14,11 @@ namespace AshburtonCocWebsite.Areas.Identity.Pages.Account.Manage
{
public class DownloadPersonalDataModel : PageModel
{
private readonly UserManager<IdentityUser> _userManager;
private readonly UserManager<ApplicationUser> _userManager;
private readonly ILogger<DownloadPersonalDataModel> _logger;

public DownloadPersonalDataModel(
UserManager<IdentityUser> userManager,
UserManager<ApplicationUser> userManager,
ILogger<DownloadPersonalDataModel> logger)
{
_userManager = userManager;
Expand All @@ -36,7 +37,7 @@ public async Task<IActionResult> OnPostAsync()

// Only include personal data for download
var personalData = new Dictionary<string, string>();
var personalDataProps = typeof(IdentityUser).GetProperties().Where(
var personalDataProps = typeof(ApplicationUser).GetProperties().Where(
prop => Attribute.IsDefined(prop, typeof(PersonalDataAttribute)));
foreach (var p in personalDataProps)
{
Expand Down
11 changes: 6 additions & 5 deletions Areas/Identity/Pages/Account/Manage/Email.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,19 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.AspNetCore.WebUtilities;
using AshburtonCocWebsite.Areas.Identity.Data;

namespace AshburtonCocWebsite.Areas.Identity.Pages.Account.Manage
{
public partial class EmailModel : PageModel
{
private readonly UserManager<IdentityUser> _userManager;
private readonly SignInManager<IdentityUser> _signInManager;
private readonly UserManager<ApplicationUser> _userManager;
private readonly SignInManager<ApplicationUser> _signInManager;
private readonly IEmailSender _emailSender;

public EmailModel(
UserManager<IdentityUser> userManager,
SignInManager<IdentityUser> signInManager,
UserManager<ApplicationUser> userManager,
SignInManager<ApplicationUser> signInManager,
IEmailSender emailSender)
{
_userManager = userManager;
Expand Down Expand Up @@ -49,7 +50,7 @@ public class InputModel
public string NewEmail { get; set; }
}

private async Task LoadAsync(IdentityUser user)
private async Task LoadAsync(ApplicationUser user)
{
var email = await _userManager.GetEmailAsync(user);
Email = email;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,20 @@
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using Microsoft.Extensions.Logging;
using AshburtonCocWebsite.Areas.Identity.Data;

namespace AshburtonCocWebsite.Areas.Identity.Pages.Account.Manage
{
public class EnableAuthenticatorModel : PageModel
{
private readonly UserManager<IdentityUser> _userManager;
private readonly UserManager<ApplicationUser> _userManager;
private readonly ILogger<EnableAuthenticatorModel> _logger;
private readonly UrlEncoder _urlEncoder;

private const string AuthenticatorUriFormat = "otpauth://totp/{0}:{1}?secret={2}&issuer={0}&digits=6";

public EnableAuthenticatorModel(
UserManager<IdentityUser> userManager,
UserManager<ApplicationUser> userManager,
ILogger<EnableAuthenticatorModel> logger,
UrlEncoder urlEncoder)
{
Expand Down Expand Up @@ -111,7 +112,7 @@ public async Task<IActionResult> OnPostAsync()
}
}

private async Task LoadSharedKeyAndQrCodeUriAsync(IdentityUser user)
private async Task LoadSharedKeyAndQrCodeUriAsync(ApplicationUser user)
{
// Load the authenticator key & QR code URI to display on the form
var unformattedKey = await _userManager.GetAuthenticatorKeyAsync(user);
Expand Down
9 changes: 5 additions & 4 deletions Areas/Identity/Pages/Account/Manage/ExternalLogins.cshtml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using AshburtonCocWebsite.Areas.Identity.Data;
using Microsoft.AspNetCore.Authentication;
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Mvc;
Expand All @@ -11,12 +12,12 @@ namespace AshburtonCocWebsite.Areas.Identity.Pages.Account.Manage
{
public class ExternalLoginsModel : PageModel
{
private readonly UserManager<IdentityUser> _userManager;
private readonly SignInManager<IdentityUser> _signInManager;
private readonly UserManager<ApplicationUser> _userManager;
private readonly SignInManager<ApplicationUser> _signInManager;

public ExternalLoginsModel(
UserManager<IdentityUser> userManager,
SignInManager<IdentityUser> signInManager)
UserManager<ApplicationUser> userManager,
SignInManager<ApplicationUser> signInManager)
{
_userManager = userManager;
_signInManager = signInManager;
Expand Down
Loading

0 comments on commit 6493789

Please sign in to comment.