Add ApplicationUser entity.

This commit is contained in:
2019-05-27 03:00:04 +01:00
parent 5a1010ca3a
commit 9a1e00cbee
4 changed files with 42 additions and 14 deletions

View File

@@ -0,0 +1,6 @@
using Microsoft.AspNetCore.Identity;
namespace Cicm.Database.Models
{
public class ApplicationUser : IdentityUser { }
}

View File

@@ -31,7 +31,6 @@
using Cicm.Database.Models;
using cicm_web.Areas.Identity;
using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Identity;
using Microsoft.Extensions.DependencyInjection;
[assembly: HostingStartup(typeof(IdentityHostingStartup))]
@@ -44,7 +43,7 @@ namespace cicm_web.Areas.Identity
{
builder.ConfigureServices((context, services) =>
{
services.AddDefaultIdentity<IdentityUser>()
services.AddDefaultIdentity<ApplicationUser>()
.AddEntityFrameworkStores<cicmContext>();
});
}

View File

@@ -1,7 +1,8 @@
@using Cicm.Database.Models
@using Microsoft.AspNetCore.Identity
@using Microsoft.Extensions.PlatformAbstractions
@inject SignInManager<IdentityUser> SignInManager
@inject UserManager<IdentityUser> UserManager
@inject SignInManager<ApplicationUser> SignInManager
@inject UserManager<ApplicationUser> UserManager
@{
/******************************************************************************
// Canary Islands Computer Museum Website

View File

@@ -1,8 +1,9 @@
@using Cicm.Database.Models
@using Microsoft.AspNetCore.Identity
@inject SignInManager<IdentityUser> SignInManager
@inject UserManager<IdentityUser> UserManager
@inject SignInManager<ApplicationUser> SignInManager
@inject UserManager<ApplicationUser> UserManager
@{
/******************************************************************************
/******************************************************************************
// Canary Islands Computer Museum Website
// ----------------------------------------------------------------------------
//
@@ -33,15 +34,28 @@
*******************************************************************************/
}
@if (SignInManager.IsSignedIn(User))
@if(SignInManager.IsSignedIn(User))
{
<form asp-area="Identity" asp-page="/Account/Logout" asp-route-returnUrl="@Url.Page("/Index", new { area = "" })" method="post" id="logoutForm" class="navbar-right">
<form asp-area="Identity"
asp-page="/Account/Logout"
asp-route-returnUrl="@Url.Page("/Index", new {area = ""})"
method="post"
id="logoutForm"
class="navbar-right">
<ul class="ml-auto navbar-nav">
<li>
<a asp-area="Identity" asp-page="/Account/Manage/Index" title="Manage" class=nav-link>Hello @UserManager.GetUserName(User)!</a>
<a asp-area="Identity"
asp-page="/Account/Manage/Index"
class=nav-link
title="Manage">
Hello @UserManager.GetUserName(User)!
</a>
</li>
<li>
<button type="submit" class="btn btn-link nav-link">Logout</button>
<button class="btn btn-link nav-link"
type="submit">
Logout
</button>
</li>
</ul>
</form>
@@ -61,8 +75,16 @@ else
</a>
<div aria-labelledby=accountDropdown
class=dropdown-menu>
<a asp-area="Identity" asp-page="/Account/Register" class=dropdown-item>Register</a>
<a asp-area="Identity" asp-page="/Account/Login" class=dropdown-item>Login</a>
<a asp-area="Identity"
asp-page="/Account/Register"
class=dropdown-item>
Register
</a>
<a asp-area="Identity"
asp-page="/Account/Login"
class=dropdown-item>
Login
</a>
</div>
</ul>
}