aboutsummaryrefslogtreecommitdiff
path: root/ExamTemplate/Web/Views/Account
diff options
context:
space:
mode:
authorSyndamia <kamen.d.mladenov@protonmail.com>2021-05-08 18:10:08 +0300
committerSyndamia <kamen.d.mladenov@protonmail.com>2021-05-08 18:10:08 +0300
commit82d270a66b8ffca28e321f29b2eb90b2412ac9a7 (patch)
treebd7e985592a0d8d5ec31b590b3c52d403e17e140 /ExamTemplate/Web/Views/Account
parenta1e46b76a1299e35b1ac8cae69e77c66d74224a6 (diff)
downloadit-kariera-exam-template-82d270a66b8ffca28e321f29b2eb90b2412ac9a7.tar
it-kariera-exam-template-82d270a66b8ffca28e321f29b2eb90b2412ac9a7.tar.gz
it-kariera-exam-template-82d270a66b8ffca28e321f29b2eb90b2412ac9a7.zip
Implemented authorization; Replaced Role with IdentityRole<Guid>; Renamed UserController to AccountController, updated links
Diffstat (limited to 'ExamTemplate/Web/Views/Account')
-rw-r--r--ExamTemplate/Web/Views/Account/Edit.cshtml20
-rw-r--r--ExamTemplate/Web/Views/Account/Login.cshtml14
-rw-r--r--ExamTemplate/Web/Views/Account/Profile.cshtml27
-rw-r--r--ExamTemplate/Web/Views/Account/Register.cshtml20
4 files changed, 81 insertions, 0 deletions
diff --git a/ExamTemplate/Web/Views/Account/Edit.cshtml b/ExamTemplate/Web/Views/Account/Edit.cshtml
new file mode 100644
index 0000000..da08d9a
--- /dev/null
+++ b/ExamTemplate/Web/Views/Account/Edit.cshtml
@@ -0,0 +1,20 @@
+@model EditUserViewModel
+@{
+ ViewData["Title"] = "Edit Profile";
+}
+
+<form asp-controller="User" asp-action="EditProfile" method="post">
+ <label asp-for="Username">Username:</label>
+ <input type="text" asp-for="Username" placeholder="@Model.Username">
+ <span asp-validation-for="Username" class="form-error"></span>
+
+ <label asp-for="FirstName">First Name:</label>
+ <input type="text" asp-for="FirstName" placeholder="@Model.FirstName">
+ <span asp-validation-for="FirstName" class="form-error"></span>
+
+ <label asp-for="LastName">Last Name:</label>
+ <input type="text" asp-for="LastName" placeholder="@Model.LastName">
+ <span asp-validation-for="LastName" class="form-error"></span>
+
+ <input type="submit" value="Update Profile">
+</form>
diff --git a/ExamTemplate/Web/Views/Account/Login.cshtml b/ExamTemplate/Web/Views/Account/Login.cshtml
new file mode 100644
index 0000000..688c547
--- /dev/null
+++ b/ExamTemplate/Web/Views/Account/Login.cshtml
@@ -0,0 +1,14 @@
+@model ExamTemplate.Web.Models.User.LoginUserViewModel
+@{
+ ViewData["Title"] = "Login";
+}
+
+<form asp-controller="Account" asp-action="Login" method="post">
+ <input type="text" asp-for="Username" placeholder="Username">
+ <span asp-validation-for="Username" class="form-error"></span>
+
+ <input type="password" asp-for="Password" placeholder="Password">
+ <span asp-validation-for="Password" class="form-error"></span>
+
+ <input type="submit">
+</form>
diff --git a/ExamTemplate/Web/Views/Account/Profile.cshtml b/ExamTemplate/Web/Views/Account/Profile.cshtml
new file mode 100644
index 0000000..c6f3e5c
--- /dev/null
+++ b/ExamTemplate/Web/Views/Account/Profile.cshtml
@@ -0,0 +1,27 @@
+@using Microsoft.AspNetCore.Identity
+
+@inject SignInManager<User> SignInManager
+@inject UserManager<User> UserManager
+
+@model UserViewModel
+@{
+ ViewData["Title"] = Model.Username + "'s Profile";
+}
+
+<p>
+ <h2>
+ @Model.FirstName @Model.LastName
+ </h2>
+ <div>
+ @Model.Username
+ </div>
+ @if (SignInManager.IsSignedIn(User))
+ {
+ @if(UserManager.GetUserName(User) == Model.Username)
+ {
+ <form asp-controller="Account" asp-action="Edit" method="get">
+ <input type="submit" value="Edit Profile">
+ </form>
+ }
+ }
+</p>
diff --git a/ExamTemplate/Web/Views/Account/Register.cshtml b/ExamTemplate/Web/Views/Account/Register.cshtml
new file mode 100644
index 0000000..d255287
--- /dev/null
+++ b/ExamTemplate/Web/Views/Account/Register.cshtml
@@ -0,0 +1,20 @@
+@model ExamTemplate.Web.Models.User.RegisterUserViewModel
+@{
+ ViewData["Title"] = "Register";
+}
+
+<form asp-controller="User" asp-action="Register" method="post">
+ <input type="text" asp-for="FirstName" placeholder="FirstName">
+ <span asp-validation-for="FirstName" class="form-error"></span>
+
+ <input type="text" asp-for="LastName" placeholder="LastName">
+ <span asp-validation-for="LastName" class="form-error"></span>
+
+ <input type="text" asp-for="Username" placeholder="Username">
+ <span asp-validation-for="Username" class="form-error"></span>
+
+ <input type="password" asp-for="Password" placeholder="Password">
+ <span asp-validation-for="Password" class="form-error"></span>
+
+ <input type="submit">
+</form>