更新用户和管理员角色控制器路由,移除多余SQL脚本,优化登录页面样式
This commit is contained in:
parent
276adfe154
commit
64b7c4bd57
@ -5,34 +5,33 @@
|
|||||||
ViewData["Title"] = "登录";
|
ViewData["Title"] = "登录";
|
||||||
}
|
}
|
||||||
|
|
||||||
<h1>@ViewData["Title"]</h1>
|
<h1 class="text-center">@ViewData["Title"]</h1>
|
||||||
<div class="row">
|
<div class="container">
|
||||||
<div class="col-md-4">
|
<div class="row justify-content-center">
|
||||||
|
<div class="col-md-6">
|
||||||
<section>
|
<section>
|
||||||
<form id="account" method="post">
|
<form id="account" method="post" class="card p-4">
|
||||||
<h2>使用本地账户登录。</h2>
|
<h2 class="text-center">使用本地账户登录。</h2>
|
||||||
<hr />
|
<hr />
|
||||||
<div asp-validation-summary="ModelOnly" class="text-danger" role="alert"></div>
|
<div asp-validation-summary="ModelOnly" class="text-danger" role="alert"></div>
|
||||||
<div class="form-floating mb-3">
|
<div class="form-outline mb-4">
|
||||||
<input asp-for="Input.Email" class="form-control" autocomplete="username" aria-required="true" placeholder="name@example.com" />
|
<input asp-for="Input.Email" type="email" id="email" class="form-control" autocomplete="username" aria-required="true" placeholder="name@example.com" />
|
||||||
<label asp-for="Input.Email" class="form-label">电子邮件</label>
|
<label asp-for="Input.Email" class="form-label">电子邮件</label>
|
||||||
<span asp-validation-for="Input.Email" class="text-danger"></span>
|
<span asp-validation-for="Input.Email" class="text-danger"></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="form-floating mb-3">
|
<div class="form-outline mb-4">
|
||||||
<input asp-for="Input.Password" class="form-control" autocomplete="current-password" aria-required="true" placeholder="password" />
|
<input asp-for="Input.Password" type="password" id="password" class="form-control" autocomplete="current-password" aria-required="true" placeholder="password" />
|
||||||
<label asp-for="Input.Password" class="form-label">密码</label>
|
<label asp-for="Input.Password" class="form-label">密码</label>
|
||||||
<span asp-validation-for="Input.Password" class="text-danger"></span>
|
<span asp-validation-for="Input.Password" class="text-danger"></span>
|
||||||
</div>
|
</div>
|
||||||
<div class="checkbox mb-3">
|
<div class="form-check mb-4">
|
||||||
<label asp-for="Input.RememberMe" class="form-label">
|
|
||||||
<input class="form-check-input" asp-for="Input.RememberMe" />
|
<input class="form-check-input" asp-for="Input.RememberMe" />
|
||||||
记住我
|
<label class="form-check-label" asp-for="Input.RememberMe">记住我</label>
|
||||||
</label>
|
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div class="d-grid gap-2">
|
||||||
<button id="login-submit" type="submit" class="w-100 btn btn-lg btn-primary">登录</button>
|
<button id="login-submit" type="submit" class="btn btn-primary btn-block">登录</button>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div class="text-center mt-3">
|
||||||
<p>
|
<p>
|
||||||
<a id="forgot-password" asp-page="./ForgotPassword">忘记密码?</a>
|
<a id="forgot-password" asp-page="./ForgotPassword">忘记密码?</a>
|
||||||
</p>
|
</p>
|
||||||
@ -46,33 +45,33 @@
|
|||||||
</form>
|
</form>
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
<div class="col-md-6 col-md-offset-2">
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="row justify-content-end">
|
||||||
|
<div class="col-md-6">
|
||||||
<section>
|
<section>
|
||||||
<h3>使用其他服务登录。</h3>
|
<h3 class="text-center">使用其他服务登录。</h3>
|
||||||
<hr />
|
<hr />
|
||||||
@{
|
@if ((Model.ExternalLogins?.Count ?? 0) == 0)
|
||||||
if ((Model.ExternalLogins?.Count ?? 0) == 0)
|
|
||||||
{
|
{
|
||||||
<div>
|
<div>
|
||||||
<p>
|
<p class="text-center">
|
||||||
没有配置外部身份验证服务。请参阅<a href="https://go.microsoft.com/fwlink/?LinkID=532715">关于设置此ASP.NET应用程序以支持通过外部服务登录的文章</a>。
|
没有配置外部身份验证服务。请参阅<a href="https://go.microsoft.com/fwlink/?LinkID=532715">关于设置此ASP.NET应用程序以支持通过外部服务登录的文章</a>。
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
<form id="external-account" asp-page="./ExternalLogin" asp-route-returnUrl="@Model.ReturnUrl" method="post" class="form-horizontal">
|
<form id="external-account" asp-page="./ExternalLogin" asp-route-returnUrl="@Model.ReturnUrl" method="post" class="card p-4">
|
||||||
<div>
|
<div class="d-grid gap-2">
|
||||||
<p>
|
|
||||||
@foreach (var provider in Model.ExternalLogins!)
|
@foreach (var provider in Model.ExternalLogins!)
|
||||||
{
|
{
|
||||||
<button type="submit" class="btn btn-primary" name="provider" value="@provider.Name" title="Log in using your @provider.DisplayName account">@provider.DisplayName</button>
|
<button type="submit" class="btn btn-primary" name="provider" value="@provider.Name" title="使用您的 @provider.DisplayName 账户登录">@provider.DisplayName</button>
|
||||||
}
|
}
|
||||||
</p>
|
|
||||||
</div>
|
</div>
|
||||||
</form>
|
</form>
|
||||||
}
|
}
|
||||||
}
|
|
||||||
</section>
|
</section>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -7,7 +7,7 @@ using Microsoft.AspNetCore.Mvc;
|
|||||||
namespace AGSS.Controllers.Admin;
|
namespace AGSS.Controllers.Admin;
|
||||||
|
|
||||||
[Authorize(Roles = "Admin")]
|
[Authorize(Roles = "Admin")]
|
||||||
[Route("api/v1/Admin/[controller]")]
|
[Route("api/v1/[controller]/[action]")]
|
||||||
public class AdminRoleControllers:ControllerBase
|
public class AdminRoleControllers:ControllerBase
|
||||||
{
|
{
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ using Microsoft.AspNetCore.Mvc;
|
|||||||
namespace AGSS.Controllers.User;
|
namespace AGSS.Controllers.User;
|
||||||
|
|
||||||
[Authorize]
|
[Authorize]
|
||||||
[Route("api/v1/[controller]")]
|
[Route("api/v1/[controller]/[action]")]
|
||||||
public class UserControllers:ControllerBase
|
public class UserControllers:ControllerBase
|
||||||
{
|
{
|
||||||
|
|
||||||
|
1
Areas/Identity/Pages/Account/Register.cshtml
Normal file
1
Areas/Identity/Pages/Account/Register.cshtml
Normal file
@ -0,0 +1 @@
|
|||||||
|
<input asp-for="Input.Email" type="email" class="form-control validate form-outline" autocomplete="username" aria-required="true" placeholder="name@example.com" />
|
101
script.sql
101
script.sql
@ -1,103 +1,6 @@
|
|||||||
CREATE TABLE IF NOT EXISTS "__EFMigrationsHistory" (
|
START TRANSACTION;
|
||||||
"MigrationId" character varying(150) NOT NULL,
|
|
||||||
"ProductVersion" character varying(32) NOT NULL,
|
|
||||||
CONSTRAINT "PK___EFMigrationsHistory" PRIMARY KEY ("MigrationId")
|
|
||||||
);
|
|
||||||
|
|
||||||
START TRANSACTION;
|
|
||||||
CREATE TABLE "AspNetRoles" (
|
|
||||||
"Id" text NOT NULL,
|
|
||||||
"Name" character varying(256),
|
|
||||||
"NormalizedName" character varying(256),
|
|
||||||
"ConcurrencyStamp" text,
|
|
||||||
CONSTRAINT "PK_AspNetRoles" PRIMARY KEY ("Id")
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE "AspNetUsers" (
|
|
||||||
"Id" text NOT NULL,
|
|
||||||
"Sex" text,
|
|
||||||
"Description" character varying(100),
|
|
||||||
"Config" character varying(200),
|
|
||||||
"JobCode" character varying(10),
|
|
||||||
"JobName" character varying(10),
|
|
||||||
"Birthday" character varying(20),
|
|
||||||
"UserName" character varying(256),
|
|
||||||
"NormalizedUserName" character varying(256),
|
|
||||||
"Email" character varying(256),
|
|
||||||
"NormalizedEmail" character varying(256),
|
|
||||||
"EmailConfirmed" boolean NOT NULL,
|
|
||||||
"PasswordHash" text,
|
|
||||||
"SecurityStamp" text,
|
|
||||||
"ConcurrencyStamp" text,
|
|
||||||
"PhoneNumber" text,
|
|
||||||
"PhoneNumberConfirmed" boolean NOT NULL,
|
|
||||||
"TwoFactorEnabled" boolean NOT NULL,
|
|
||||||
"LockoutEnd" timestamp with time zone,
|
|
||||||
"LockoutEnabled" boolean NOT NULL,
|
|
||||||
"AccessFailedCount" integer NOT NULL,
|
|
||||||
CONSTRAINT "PK_AspNetUsers" PRIMARY KEY ("Id")
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE "AspNetRoleClaims" (
|
|
||||||
"Id" integer GENERATED BY DEFAULT AS IDENTITY,
|
|
||||||
"RoleId" text NOT NULL,
|
|
||||||
"ClaimType" text,
|
|
||||||
"ClaimValue" text,
|
|
||||||
CONSTRAINT "PK_AspNetRoleClaims" PRIMARY KEY ("Id"),
|
|
||||||
CONSTRAINT "FK_AspNetRoleClaims_AspNetRoles_RoleId" FOREIGN KEY ("RoleId") REFERENCES "AspNetRoles" ("Id") ON DELETE CASCADE
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE "AspNetUserClaims" (
|
|
||||||
"Id" integer GENERATED BY DEFAULT AS IDENTITY,
|
|
||||||
"UserId" text NOT NULL,
|
|
||||||
"ClaimType" text,
|
|
||||||
"ClaimValue" text,
|
|
||||||
CONSTRAINT "PK_AspNetUserClaims" PRIMARY KEY ("Id"),
|
|
||||||
CONSTRAINT "FK_AspNetUserClaims_AspNetUsers_UserId" FOREIGN KEY ("UserId") REFERENCES "AspNetUsers" ("Id") ON DELETE CASCADE
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE "AspNetUserLogins" (
|
|
||||||
"LoginProvider" text NOT NULL,
|
|
||||||
"ProviderKey" text NOT NULL,
|
|
||||||
"ProviderDisplayName" text,
|
|
||||||
"UserId" text NOT NULL,
|
|
||||||
CONSTRAINT "PK_AspNetUserLogins" PRIMARY KEY ("LoginProvider", "ProviderKey"),
|
|
||||||
CONSTRAINT "FK_AspNetUserLogins_AspNetUsers_UserId" FOREIGN KEY ("UserId") REFERENCES "AspNetUsers" ("Id") ON DELETE CASCADE
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE "AspNetUserRoles" (
|
|
||||||
"UserId" text NOT NULL,
|
|
||||||
"RoleId" text NOT NULL,
|
|
||||||
CONSTRAINT "PK_AspNetUserRoles" PRIMARY KEY ("UserId", "RoleId"),
|
|
||||||
CONSTRAINT "FK_AspNetUserRoles_AspNetRoles_RoleId" FOREIGN KEY ("RoleId") REFERENCES "AspNetRoles" ("Id") ON DELETE CASCADE,
|
|
||||||
CONSTRAINT "FK_AspNetUserRoles_AspNetUsers_UserId" FOREIGN KEY ("UserId") REFERENCES "AspNetUsers" ("Id") ON DELETE CASCADE
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE TABLE "AspNetUserTokens" (
|
|
||||||
"UserId" text NOT NULL,
|
|
||||||
"LoginProvider" text NOT NULL,
|
|
||||||
"Name" text NOT NULL,
|
|
||||||
"Value" text,
|
|
||||||
CONSTRAINT "PK_AspNetUserTokens" PRIMARY KEY ("UserId", "LoginProvider", "Name"),
|
|
||||||
CONSTRAINT "FK_AspNetUserTokens_AspNetUsers_UserId" FOREIGN KEY ("UserId") REFERENCES "AspNetUsers" ("Id") ON DELETE CASCADE
|
|
||||||
);
|
|
||||||
|
|
||||||
CREATE INDEX "IX_AspNetRoleClaims_RoleId" ON "AspNetRoleClaims" ("RoleId");
|
|
||||||
|
|
||||||
CREATE UNIQUE INDEX "RoleNameIndex" ON "AspNetRoles" ("NormalizedName");
|
|
||||||
|
|
||||||
CREATE INDEX "IX_AspNetUserClaims_UserId" ON "AspNetUserClaims" ("UserId");
|
|
||||||
|
|
||||||
CREATE INDEX "IX_AspNetUserLogins_UserId" ON "AspNetUserLogins" ("UserId");
|
|
||||||
|
|
||||||
CREATE INDEX "IX_AspNetUserRoles_RoleId" ON "AspNetUserRoles" ("RoleId");
|
|
||||||
|
|
||||||
CREATE INDEX "EmailIndex" ON "AspNetUsers" ("NormalizedEmail");
|
|
||||||
|
|
||||||
CREATE UNIQUE INDEX "UserNameIndex" ON "AspNetUsers" ("NormalizedUserName");
|
|
||||||
|
|
||||||
INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")
|
INSERT INTO "__EFMigrationsHistory" ("MigrationId", "ProductVersion")
|
||||||
VALUES ('20250708111442_user', '9.0.6');
|
VALUES ('20250709054553_userrole', '9.0.6');
|
||||||
|
|
||||||
COMMIT;
|
COMMIT;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user