refact
This commit is contained in:
7
src/nuget-host/Views/Account/AccessDenied.cshtml
Normal file
7
src/nuget-host/Views/Account/AccessDenied.cshtml
Normal file
@ -0,0 +1,7 @@
|
||||
|
||||
<div class="container">
|
||||
<div class="lead">
|
||||
<h1>Access Denied</h1>
|
||||
<p>You do not have access to that resource.</p>
|
||||
</div>
|
||||
</div>
|
34
src/nuget-host/Views/Account/LoggedOut.cshtml
Normal file
34
src/nuget-host/Views/Account/LoggedOut.cshtml
Normal file
@ -0,0 +1,34 @@
|
||||
@model LoggedOutViewModel
|
||||
|
||||
@{
|
||||
// set this so the layout rendering sees an anonymous user
|
||||
ViewData["signed-out"] = true;
|
||||
}
|
||||
|
||||
<div class="logged-out-page">
|
||||
<h1>
|
||||
Logout
|
||||
<small>You are now logged out</small>
|
||||
</h1>
|
||||
|
||||
@if (Model.PostLogoutRedirectUri != null)
|
||||
{
|
||||
<div>
|
||||
Click <a class="PostLogoutRedirectUri" href="@Model.PostLogoutRedirectUri">here</a> to return to the
|
||||
<span>@Model.ClientName</span> application.
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (Model.SignOutIframeUrl != null)
|
||||
{
|
||||
<iframe width="0" height="0" class="signout" src="@Model.SignOutIframeUrl"></iframe>
|
||||
}
|
||||
</div>
|
||||
|
||||
@section scripts
|
||||
{
|
||||
@if (Model.AutomaticRedirectAfterSignOut)
|
||||
{
|
||||
<script src="~/js/signout-redirect.js"></script>
|
||||
}
|
||||
}
|
87
src/nuget-host/Views/Account/Login.cshtml
Normal file
87
src/nuget-host/Views/Account/Login.cshtml
Normal file
@ -0,0 +1,87 @@
|
||||
@model LoginViewModel
|
||||
|
||||
<div class="login-page">
|
||||
<div class="lead">
|
||||
<h1>Login</h1>
|
||||
<p>Choose how to login</p>
|
||||
</div>
|
||||
|
||||
<partial name="_ValidationSummary" />
|
||||
|
||||
<div class="row">
|
||||
|
||||
@if (Model.EnableLocalLogin)
|
||||
{
|
||||
<div class="col-sm-6">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h2>Local Account</h2>
|
||||
</div>
|
||||
|
||||
<div class="card-body">
|
||||
<form asp-route="Login">
|
||||
<input type="hidden" asp-for="ReturnUrl" />
|
||||
|
||||
<div class="form-group">
|
||||
<label asp-for="Username"></label>
|
||||
<input class="form-control" placeholder="Username" asp-for="Username" autofocus>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="Password"></label>
|
||||
<input type="password" class="form-control" placeholder="Password" asp-for="Password" autocomplete="off">
|
||||
</div>
|
||||
@if (Model.AllowRememberLogin)
|
||||
{
|
||||
<div class="form-group">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" asp-for="RememberLogin">
|
||||
<label class="form-check-label" asp-for="RememberLogin">
|
||||
Remember My Login
|
||||
</label>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
<button class="btn btn-primary" name="button" value="login">Login</button>
|
||||
<button class="btn btn-secondary" name="button" value="cancel">Cancel</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (Model.VisibleExternalProviders.Any())
|
||||
{
|
||||
<div class="col-sm-6">
|
||||
<div class="card">
|
||||
<div class="card-header">
|
||||
<h2>External Account</h2>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<ul class="list-inline">
|
||||
@foreach (var provider in Model.VisibleExternalProviders)
|
||||
{
|
||||
<li class="list-inline-item">
|
||||
<a class="btn btn-secondary"
|
||||
asp-controller="External"
|
||||
asp-action="Challenge"
|
||||
asp-route-scheme="@provider.AuthenticationScheme"
|
||||
asp-route-returnUrl="@Model.ReturnUrl">
|
||||
@provider.DisplayName
|
||||
</a>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
}
|
||||
|
||||
@if (!Model.EnableLocalLogin && !Model.VisibleExternalProviders.Any())
|
||||
{
|
||||
<div class="alert alert-warning">
|
||||
<strong>Invalid login request</strong>
|
||||
There are no login schemes configured for this request.
|
||||
</div>
|
||||
}
|
||||
</div>
|
||||
</div>
|
15
src/nuget-host/Views/Account/Logout.cshtml
Normal file
15
src/nuget-host/Views/Account/Logout.cshtml
Normal file
@ -0,0 +1,15 @@
|
||||
@model LogoutViewModel
|
||||
|
||||
<div class="logout-page">
|
||||
<div class="lead">
|
||||
<h1>Logout</h1>
|
||||
<p>Would you like to logut of IdentityServer?</p>
|
||||
</div>
|
||||
|
||||
<form asp-action="Logout">
|
||||
<input type="hidden" name="logoutId" value="@Model.LogoutId" />
|
||||
<div class="form-group">
|
||||
<button class="btn btn-primary">Yes</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
49
src/nuget-host/Views/Account/Register.cshtml
Normal file
49
src/nuget-host/Views/Account/Register.cshtml
Normal file
@ -0,0 +1,49 @@
|
||||
@model RegisterViewModel
|
||||
@{
|
||||
ViewData["Title"] = "Register";
|
||||
}
|
||||
|
||||
<h1>@ViewData["Title"].</h1>
|
||||
|
||||
<form asp-controller="Account" asp-action="Register" asp-route-returnurl="@ViewData["ReturnUrl"]" method="post" class="form-horizontal" role="form">
|
||||
<h4>Create a new account.</h4>
|
||||
<hr />
|
||||
<div asp-validation-summary="All" class="text-danger"></div>
|
||||
<div class="form-group">
|
||||
<label asp-for="FullName" class="col-md-2 control-label"></label>
|
||||
<div class="col-md-10">
|
||||
<input asp-for="FullName" class="form-control" />
|
||||
<span asp-validation-for="FullName" class="text-danger"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="Email" class="col-md-2 control-label"></label>
|
||||
<div class="col-md-10">
|
||||
<input asp-for="Email" class="form-control" />
|
||||
<span asp-validation-for="Email" class="text-danger"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="Password" class="col-md-2 control-label"></label>
|
||||
<div class="col-md-10">
|
||||
<input asp-for="Password" class="form-control" />
|
||||
<span asp-validation-for="Password" class="text-danger"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="ConfirmPassword" class="col-md-2 control-label"></label>
|
||||
<div class="col-md-10">
|
||||
<input asp-for="ConfirmPassword" class="form-control" />
|
||||
<span asp-validation-for="ConfirmPassword" class="text-danger"></span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<div class="col-md-offset-2 col-md-10">
|
||||
<button type="submit" class="btn btn-default">Register</button>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
@section Scripts {
|
||||
@{ await Html.RenderPartialAsync("_ValidationScriptsPartial"); }
|
||||
}
|
35
src/nuget-host/Views/ApiKeys/Create.cshtml
Normal file
35
src/nuget-host/Views/ApiKeys/Create.cshtml
Normal file
@ -0,0 +1,35 @@
|
||||
|
||||
@model nuget_host.Models.ApiKeys.CreateModel
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Create";
|
||||
}
|
||||
|
||||
<h2>Create</h2>
|
||||
|
||||
<h4>ApiKey</h4>
|
||||
<hr />
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<form method="post" asp-controller="ApiKeys">
|
||||
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
|
||||
<div class="form-group">
|
||||
<label asp-for="UserId" class="control-label"></label>
|
||||
<select asp-for="UserId" class ="form-control" asp-items="ViewBag.UserId"></select>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="Name" class="control-label"></label>
|
||||
<input asp-for="Name" class="form-control" />
|
||||
<span asp-validation-for="Name" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="submit" value="Create" class="btn btn-default" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<a asp-action="Index">Back to List</a>
|
||||
</div>
|
||||
|
46
src/nuget-host/Views/ApiKeys/Delete.cshtml
Normal file
46
src/nuget-host/Views/ApiKeys/Delete.cshtml
Normal file
@ -0,0 +1,46 @@
|
||||
|
||||
@model nuget_host.Models.ApiKeys.DeleteModel
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Delete";
|
||||
}
|
||||
|
||||
<h2>Delete</h2>
|
||||
|
||||
<h3>Are you sure you want to delete this?</h3>
|
||||
<div>
|
||||
<h4>ApiKey</h4>
|
||||
<hr />
|
||||
<dl class="dl-horizontal">
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.ApiKey.User)
|
||||
</dt>
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.ApiKey.User.Id)
|
||||
</dd>
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.ApiKey.Name)
|
||||
</dt>
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.ApiKey.Name)
|
||||
</dd>
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.ApiKey.CreationDate)
|
||||
</dt>
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.ApiKey.CreationDate)
|
||||
</dd>
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.ApiKey.ValidityPeriodInDays)
|
||||
</dt>
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.ApiKey.ValidityPeriodInDays)
|
||||
</dd>
|
||||
</dl>
|
||||
|
||||
<form method="post">
|
||||
<input type="hidden" asp-for="ApiKey.Id" />
|
||||
<input type="submit" value="Delete" class="btn btn-default" /> |
|
||||
<a asp-action="Index">Back to List</a>
|
||||
</form>
|
||||
</div>
|
49
src/nuget-host/Views/ApiKeys/Details.cshtml
Normal file
49
src/nuget-host/Views/ApiKeys/Details.cshtml
Normal file
@ -0,0 +1,49 @@
|
||||
|
||||
@model nuget_host.Models.ApiKeys.DetailModel
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Details";
|
||||
}
|
||||
|
||||
<h2>Details</h2>
|
||||
|
||||
<div>
|
||||
<h4>ApiKey</h4>
|
||||
<hr />
|
||||
<dl class="dl-horizontal">
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.ApiKey.User)
|
||||
</dt>
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.ApiKey.User.Id)
|
||||
</dd>
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.ApiKey.Name)
|
||||
</dt>
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.ApiKey.Name)
|
||||
</dd>
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.ApiKey.CreationDate)
|
||||
</dt>
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.ApiKey.CreationDate)
|
||||
</dd>
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.ApiKey.ValidityPeriodInDays)
|
||||
</dt>
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.ApiKey.ValidityPeriodInDays)
|
||||
</dd>
|
||||
<dt>
|
||||
@Html.DisplayNameFor(model => model.ProtectedValue)
|
||||
</dt>
|
||||
<dd>
|
||||
@Html.DisplayFor(model => model.ProtectedValue)
|
||||
</dd>
|
||||
</dl>
|
||||
</div>
|
||||
<div>
|
||||
<a asp-controller="ApiKeys" asp-action="Edit" asp-route-id="@Model.ApiKey.Id">Edit</a> |
|
||||
<a asp-controller="ApiKeys" asp-action="Index">Back to List</a>
|
||||
</div>
|
42
src/nuget-host/Views/ApiKeys/Edit.cshtml
Normal file
42
src/nuget-host/Views/ApiKeys/Edit.cshtml
Normal file
@ -0,0 +1,42 @@
|
||||
|
||||
@model nuget_host.Models.ApiKeys.EditModel
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Edit";
|
||||
}
|
||||
|
||||
<h2>Edit</h2>
|
||||
|
||||
<h4>ApiKey</h4>
|
||||
<hr />
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<form method="post">
|
||||
<div asp-validation-summary="ModelOnly" class="text-danger"></div>
|
||||
<input type="hidden" asp-for="ApiKey.Id" />
|
||||
<div class="form-group">
|
||||
<label asp-for="ApiKey.UserId" class="control-label"></label>
|
||||
<select asp-for="ApiKey.UserId" class="form-control" asp-items="ViewBag.UserId"></select>
|
||||
<span asp-validation-for="ApiKey.UserId" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="ApiKey.Name" class="control-label"></label>
|
||||
<input asp-for="ApiKey.Name" class="form-control" />
|
||||
<span asp-validation-for="ApiKey.Name" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label asp-for="ApiKey.ValidityPeriodInDays" class="control-label"></label>
|
||||
<input asp-for="ApiKey.ValidityPeriodInDays" class="form-control" />
|
||||
<span asp-validation-for="ApiKey.ValidityPeriodInDays" class="text-danger"></span>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input type="submit" value="Save" class="btn btn-default" />
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<a asp-action="Index">Back to List</a>
|
||||
</div>
|
||||
|
54
src/nuget-host/Views/ApiKeys/Index.cshtml
Normal file
54
src/nuget-host/Views/ApiKeys/Index.cshtml
Normal file
@ -0,0 +1,54 @@
|
||||
|
||||
@model nuget_host.Models.ApiKeys.IndexModel
|
||||
|
||||
@{
|
||||
ViewData["Title"] = "Index";
|
||||
}
|
||||
|
||||
<h2>Index</h2>
|
||||
|
||||
<p>
|
||||
<a asp-controller="ApiKeys" asp-action="Create">Create New</a>
|
||||
</p>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.ApiKey[0].User)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.ApiKey[0].Name)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.ApiKey[0].CreationDate)
|
||||
</th>
|
||||
<th>
|
||||
@Html.DisplayNameFor(model => model.ApiKey[0].ValidityPeriodInDays)
|
||||
</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach (var item in Model.ApiKey) {
|
||||
<tr>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.User.Id)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.Name)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.CreationDate)
|
||||
</td>
|
||||
<td>
|
||||
@Html.DisplayFor(modelItem => item.ValidityPeriodInDays)
|
||||
</td>
|
||||
<td>
|
||||
<a asp-controller="ApiKeys" asp-action="Edit" asp-route-id="@item.Id">Edit</a> |
|
||||
<a asp-controller="ApiKeys" asp-action="Details" asp-route-id="@item.Id">Details</a> |
|
||||
<a asp-controller="ApiKeys" asp-action="Delete" asp-route-id="@item.Id">Delete</a>
|
||||
</td>
|
||||
</tr>
|
||||
}
|
||||
</tbody>
|
||||
</table>
|
7
src/nuget-host/Views/Home/About.cshtml
Normal file
7
src/nuget-host/Views/Home/About.cshtml
Normal file
@ -0,0 +1,7 @@
|
||||
@{
|
||||
ViewData["Title"] = "About";
|
||||
}
|
||||
<h2>@ViewData["Title"]</h2>
|
||||
<h3>@ViewData["Message"]</h3>
|
||||
|
||||
<p>Use this area to provide additional information.</p>
|
17
src/nuget-host/Views/Home/Contact.cshtml
Normal file
17
src/nuget-host/Views/Home/Contact.cshtml
Normal file
@ -0,0 +1,17 @@
|
||||
@{
|
||||
ViewData["Title"] = "Contact";
|
||||
}
|
||||
<h2>@ViewData["Title"]</h2>
|
||||
<h3>@ViewData["Message"]</h3>
|
||||
|
||||
<address>
|
||||
One Microsoft Way<br />
|
||||
Redmond, WA 98052-6399<br />
|
||||
<abbr title="Phone">P:</abbr>
|
||||
425.555.0100
|
||||
</address>
|
||||
|
||||
<address>
|
||||
<strong>Support:</strong> <a href="mailto:Support@example.com">Support@example.com</a><br />
|
||||
<strong>Marketing:</strong> <a href="mailto:Marketing@example.com">Marketing@example.com</a>
|
||||
</address>
|
12
src/nuget-host/Views/Home/Index.cshtml
Normal file
12
src/nuget-host/Views/Home/Index.cshtml
Normal file
@ -0,0 +1,12 @@
|
||||
@{
|
||||
ViewData["Title"] = "Home Page";
|
||||
}
|
||||
|
||||
<div class="text-center">
|
||||
<h1 class="display-4">Welcome</h1>
|
||||
<p>Learn about <a href="https://docs.microsoft.com/aspnet/core">building Web apps with ASP.NET Core</a>.</p>
|
||||
<h1>
|
||||
<img src="~/icon.jpg">
|
||||
Welcome to Nuget host
|
||||
</h1>
|
||||
</div>
|
6
src/nuget-host/Views/Home/Privacy.cshtml
Normal file
6
src/nuget-host/Views/Home/Privacy.cshtml
Normal file
@ -0,0 +1,6 @@
|
||||
@{
|
||||
ViewData["Title"] = "Privacy Policy";
|
||||
}
|
||||
<h1>@ViewData["Title"]</h1>
|
||||
|
||||
<p>Use this page to detail your site's privacy policy.</p>
|
11
src/nuget-host/Views/Shared/Redirect.cshtml
Normal file
11
src/nuget-host/Views/Shared/Redirect.cshtml
Normal file
@ -0,0 +1,11 @@
|
||||
@model RedirectViewModel
|
||||
|
||||
<div class="redirect-page">
|
||||
<div class="lead">
|
||||
<h1>You are now being returned to the application</h1>
|
||||
<p>Once complete, you may close this tab.</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<meta http-equiv="refresh" content="0;url=@Model.RedirectUrl" data-url="@Model.RedirectUrl">
|
||||
<script src="~/js/signin-redirect.js"></script>
|
49
src/nuget-host/Views/Shared/_Layout.cshtml
Normal file
49
src/nuget-host/Views/Shared/_Layout.cshtml
Normal file
@ -0,0 +1,49 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="utf-8" />
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
||||
<title>@ViewData["Title"] - nuget host</title>
|
||||
<link rel="stylesheet" href="~/lib/bootstrap/dist/css/bootstrap.min.css" />
|
||||
<link rel="stylesheet" href="~/css/site.css" />
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<nav class="navbar navbar-expand-sm navbar-toggleable-sm navbar-light bg-white border-bottom box-shadow mb-3">
|
||||
<div class="container">
|
||||
<a class="navbar-brand" asp-area="" asp-controller="Home" asp-action="Index">mvc_ident</a>
|
||||
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target=".navbar-collapse" aria-controls="navbarSupportedContent"
|
||||
aria-expanded="false" aria-label="Toggle navigation">
|
||||
<span class="navbar-toggler-icon"></span>
|
||||
</button>
|
||||
<div class="navbar-collapse collapse d-sm-inline-flex justify-content-between">
|
||||
<ul class="navbar-nav flex-grow-1">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Index">Home</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
|
||||
</li>
|
||||
</ul>
|
||||
<partial name="_LoginPartial" />
|
||||
</div>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<div class="container">
|
||||
<main role="main" class="pb-3">
|
||||
@RenderBody()
|
||||
</main>
|
||||
</div>
|
||||
|
||||
<footer class="border-top footer text-muted">
|
||||
<div class="container">
|
||||
© 2021 - mvc_ident - <a asp-area="" asp-controller="Home" asp-action="Privacy">Privacy</a>
|
||||
</div>
|
||||
</footer>
|
||||
<script src="~/lib/jquery/dist/jquery.min.js"></script>
|
||||
<script src="~/lib/bootstrap/dist/js/bootstrap.bundle.min.js"></script>
|
||||
<script src="~/js/site.js" asp-append-version="true"></script>
|
||||
@await RenderSectionAsync("Scripts", required: false)
|
||||
</body>
|
||||
</html>
|
26
src/nuget-host/Views/Shared/_LoginPartial.cshtml
Normal file
26
src/nuget-host/Views/Shared/_LoginPartial.cshtml
Normal file
@ -0,0 +1,26 @@
|
||||
@using Microsoft.AspNetCore.Identity
|
||||
@inject SignInManager<ApplicationUser> SignInManager
|
||||
@inject UserManager<ApplicationUser> UserManager
|
||||
|
||||
<ul class="navbar-nav">
|
||||
@if (SignInManager.IsSignedIn(User))
|
||||
{
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="Identity" asp-page="/Account/Manage/Index" title="Manage">Hello @User.Identity.Name!</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<form class="form-inline" asp-area="Identity" asp-page="/Account/Logout" asp-route-returnUrl="@Url.Action("Index", "Home", new { area = "" })">
|
||||
<button type="submit" class="nav-link btn btn-link text-dark">Logout</button>
|
||||
</form>
|
||||
</li>
|
||||
}
|
||||
else
|
||||
{
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="Identity" asp-page="/Account/Register">Register</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
<a class="nav-link text-dark" asp-area="Identity" asp-page="/Account/Login">Login</a>
|
||||
</li>
|
||||
}
|
||||
</ul>
|
32
src/nuget-host/Views/Shared/_Nav.cshtml
Normal file
32
src/nuget-host/Views/Shared/_Nav.cshtml
Normal file
@ -0,0 +1,32 @@
|
||||
|
||||
@{
|
||||
string name = null;
|
||||
if (!true.Equals(ViewData["signed-out"]))
|
||||
{
|
||||
name = User.Identity.Name;
|
||||
}
|
||||
}
|
||||
|
||||
<div class="nav-page">
|
||||
<nav class="navbar navbar-expand-lg navbar-dark bg-dark">
|
||||
|
||||
<a href="~/" class="navbar-brand">
|
||||
<img src="~/icon.png" class="icon-banner">
|
||||
Nuget host
|
||||
</a>
|
||||
|
||||
@if (!string.IsNullOrWhiteSpace(name))
|
||||
{
|
||||
<ul class="navbar-nav mr-auto">
|
||||
<li class="nav-item dropdown">
|
||||
<a href="#" class="nav-link dropdown-toggle" data-toggle="dropdown">@name <b class="caret"></b></a>
|
||||
|
||||
<div class="dropdown-menu">
|
||||
<a class="dropdown-item" asp-action="Logout" asp-controller="Account">Logout</a>
|
||||
</div>
|
||||
</li>
|
||||
</ul>
|
||||
}
|
||||
|
||||
</nav>
|
||||
</div>
|
18
src/nuget-host/Views/Shared/_ValidationScriptsPartial.cshtml
Normal file
18
src/nuget-host/Views/Shared/_ValidationScriptsPartial.cshtml
Normal file
@ -0,0 +1,18 @@
|
||||
<environment include="Development">
|
||||
<script src="~/lib/jquery-validation/dist/jquery.validate.js"></script>
|
||||
<script src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.js"></script>
|
||||
</environment>
|
||||
<environment exclude="Development">
|
||||
<script src="https://ajax.aspnetcdn.com/ajax/jquery.validate/1.14.0/jquery.validate.min.js"
|
||||
asp-fallback-src="~/lib/jquery-validation/dist/jquery.validate.min.js"
|
||||
asp-fallback-test="window.jQuery && window.jQuery.validator"
|
||||
crossorigin="anonymous"
|
||||
integrity="sha384-Fnqn3nxp3506LP/7Y3j/25BlWeA3PXTyT1l78LjECcPaKCV12TsZP7yyMxOe/G/k">
|
||||
</script>
|
||||
<script src="https://ajax.aspnetcdn.com/ajax/jquery.validation.unobtrusive/3.2.6/jquery.validate.unobtrusive.min.js"
|
||||
asp-fallback-src="~/lib/jquery-validation-unobtrusive/jquery.validate.unobtrusive.min.js"
|
||||
asp-fallback-test="window.jQuery && window.jQuery.validator && window.jQuery.validator.unobtrusive"
|
||||
crossorigin="anonymous"
|
||||
integrity="sha384-JrXK+k53HACyavUKOsL+NkmSesD2P+73eDMrbTtTk0h4RmOF8hF8apPlkp26JlyH">
|
||||
</script>
|
||||
</environment>
|
7
src/nuget-host/Views/Shared/_ValidationSummary.cshtml
Normal file
7
src/nuget-host/Views/Shared/_ValidationSummary.cshtml
Normal file
@ -0,0 +1,7 @@
|
||||
@if (ViewContext.ModelState.IsValid == false)
|
||||
{
|
||||
<div class="alert alert-danger">
|
||||
<strong>Error</strong>
|
||||
<div asp-validation-summary="All" class="danger"></div>
|
||||
</div>
|
||||
}
|
2
src/nuget-host/Views/_ViewImports.cshtml
Normal file
2
src/nuget-host/Views/_ViewImports.cshtml
Normal file
@ -0,0 +1,2 @@
|
||||
@using nuget_host.Models
|
||||
@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
|
3
src/nuget-host/Views/_ViewStart.cshtml
Normal file
3
src/nuget-host/Views/_ViewStart.cshtml
Normal file
@ -0,0 +1,3 @@
|
||||
@{
|
||||
Layout = "_Layout";
|
||||
}
|
Reference in New Issue
Block a user