summaryrefslogtreecommitdiff
path: root/Views/Account
diff options
context:
space:
mode:
authorSergey Chebotar <s.chebotar@gmail.com>2023-03-06 07:41:35 +0300
committerSergey Chebotar <s.chebotar@gmail.com>2023-03-06 07:41:35 +0300
commit0c4d13caed53b2702eef41461d0c8a4b25df48f6 (patch)
tree6fb6d2d54cedce1c204fb30b75f4d470fbf7ee83 /Views/Account
parentcdd58a8f518d037658518c233e74beea22d03906 (diff)
Base authorization/authentification
Diffstat (limited to 'Views/Account')
-rw-r--r--Views/Account/Create.cshtml35
-rw-r--r--Views/Account/List.cshtml54
-rw-r--r--Views/Account/Login.cshtml31
3 files changed, 120 insertions, 0 deletions
diff --git a/Views/Account/Create.cshtml b/Views/Account/Create.cshtml
new file mode 100644
index 0000000..2fff64a
--- /dev/null
+++ b/Views/Account/Create.cshtml
@@ -0,0 +1,35 @@
+@using Microsoft.AspNetCore.Identity
+@model IdentityUser
+
+<!DOCTYPE html>
+<html>
+
+<head>
+ <title>User Acccounts</title>
+ <link href="/lib/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
+</head>
+
+<body>
+ <h5 class="bg-primary text-white text-center p-2">Create User</h5>
+ <form method="post">
+ <div asp-validation-summary="All" class="text-danger"></div>
+ <div class="form-group">
+ <label>User Name</label>
+ <input name="UserName" class="form-control" value="@Model.UserName" />
+ </div>
+ <div class="form-group">
+ <label>Email</label>
+ <input name="Email" class="form-control" value="@Model.Email" />
+ </div>
+ <div class="form-group">
+ <label>Password</label>
+ <input name="Password" class="form-control" value="" />
+ </div>
+ <div class="py-2">
+ <button type="submit" class="btn btn-primary">Submit</button>
+ <a class="btn btn-secondary" asp-page="list">Back</a>
+ </div>
+ </form>
+</body>
+
+</html> \ No newline at end of file
diff --git a/Views/Account/List.cshtml b/Views/Account/List.cshtml
new file mode 100644
index 0000000..7f17543
--- /dev/null
+++ b/Views/Account/List.cshtml
@@ -0,0 +1,54 @@
+@using Microsoft.AspNetCore.Identity
+@model IQueryable<IdentityUser>
+
+<!DOCTYPE html>
+<html>
+
+<head>
+ <title>Users</title>
+ <link href="/lib/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
+</head>
+
+<body>
+ <div class="m-2">
+ <h5 class="bg-info text-white text-center p-2">User Administration</h5>
+ <table class="table table-sm table-bordered">
+ <tr>
+ <th>ID</th>
+ <th>Name</th>
+ <th>Email</th>
+ <th></th>
+ </tr>
+ @if (Model.Count() == 0)
+ {
+ <tr>
+ <td colspan="4" class="text-center">No User Accounts</td>
+ </tr>
+ }
+ else
+ {
+ foreach (IdentityUser user in Model)
+ {
+ <tr>
+ <td>@user.Id</td>
+ <td>@user.UserName</td>
+ <td>@user.Email</td>
+ <td class="text-center">
+ <form asp-page="List" method="post">
+ <input type="hidden" name="Id" value="@user.Id" />
+ <a class="btn btn-sm btn-warning" asp-page="Editor" asp-route-id="@user.Id"
+ asp-route-mode="edit">Edit</a>
+ <button type="submit" class="btn btn-sm btn-danger">
+ Delete
+ </button>
+ </form>
+ </td>
+ </tr>
+ }
+ }
+ </table>
+ <a class="btn btn-primary" asp-page="create">Create</a>
+ </div>
+</body>
+
+</html> \ No newline at end of file
diff --git a/Views/Account/Login.cshtml b/Views/Account/Login.cshtml
new file mode 100644
index 0000000..893155c
--- /dev/null
+++ b/Views/Account/Login.cshtml
@@ -0,0 +1,31 @@
+@model MyDarling.Models.LoginModel
+<!DOCTYPE html>
+<html>
+
+<head>
+ <meta name="viewport" content="width=device-width" />
+ <title>Login Page</title>
+ <link href="/lib/bootstrap/css/bootstrap.min.css" rel="stylesheet" />
+</head>
+
+<body>
+ <div class="m-1 p-1">
+ <div class="text-danger" asp-validation-summary="All"></div>
+ <form asp-action="Login" asp-controller="Account" method="post">
+ <input type="hidden" asp-for="ReturnUrl" />
+ <div class="form-group">
+ <label asp-for="Name"></label>
+ <div asp-validation-for="Name" class="text-danger"></div>
+ <input name="Name" class="form-control" value="@Model.Name"/>
+ </div>
+ <div class="form-group">
+ <label asp-for="Password"></label>
+ <div asp-validation-for="Password" class="text-danger"></div>
+ <input name="Password" type="password" class="form-control" value="@Model.Password"/>
+ </div>
+ <button class="btn btn-primary mt-2" type="submit">Log In</button>
+ </form>
+ </div>
+</body>
+
+</html> \ No newline at end of file