diff options
Diffstat (limited to 'code/api/Pages')
| -rw-r--r-- | code/api/Pages/Home.cshtml | 12 | ||||
| -rw-r--r-- | code/api/Pages/Home.cshtml.cs | 10 | ||||
| -rw-r--r-- | code/api/Pages/Index.cshtml | 5 | ||||
| -rw-r--r-- | code/api/Pages/Index.cshtml.cs | 8 | ||||
| -rw-r--r-- | code/api/Pages/Login.cshtml | 28 | ||||
| -rw-r--r-- | code/api/Pages/Login.cshtml.cs | 12 | ||||
| -rw-r--r-- | code/api/Pages/_Layout.cshtml | 16 | ||||
| -rw-r--r-- | code/api/Pages/_ViewImports.cshtml | 3 | ||||
| -rw-r--r-- | code/api/Pages/_ViewStart.cshtml | 3 |
9 files changed, 97 insertions, 0 deletions
diff --git a/code/api/Pages/Home.cshtml b/code/api/Pages/Home.cshtml new file mode 100644 index 0000000..457ba2f --- /dev/null +++ b/code/api/Pages/Home.cshtml @@ -0,0 +1,12 @@ +@page +@model I2R.Storage.Api.Pages.Home + +@{ + ViewData["Title"] = "Home"; +} + +<h1>Welcome</h1> + +<pre> +Id: @(HttpContext.User.FindFirst("AppClaims.USER_ID").Value) +</pre>
\ No newline at end of file diff --git a/code/api/Pages/Home.cshtml.cs b/code/api/Pages/Home.cshtml.cs new file mode 100644 index 0000000..0fa9aca --- /dev/null +++ b/code/api/Pages/Home.cshtml.cs @@ -0,0 +1,10 @@ +using Microsoft.AspNetCore.Mvc.RazorPages; + +namespace I2R.Storage.Api.Pages; + +public class Home : PageModel +{ + public void OnGet() { + + } +}
\ No newline at end of file diff --git a/code/api/Pages/Index.cshtml b/code/api/Pages/Index.cshtml new file mode 100644 index 0000000..4015b8e --- /dev/null +++ b/code/api/Pages/Index.cshtml @@ -0,0 +1,5 @@ +@page +@model I2R.Storage.Api.Pages.Index +@{ + ViewData["Title"] = "Home"; +} diff --git a/code/api/Pages/Index.cshtml.cs b/code/api/Pages/Index.cshtml.cs new file mode 100644 index 0000000..8129a9b --- /dev/null +++ b/code/api/Pages/Index.cshtml.cs @@ -0,0 +1,8 @@ +namespace I2R.Storage.Api.Pages; + +public class Index : PageModel +{ + public ActionResult OnGet() { + return User.Identity.IsAuthenticated ? Redirect("/home") : Redirect("/login"); + } +}
\ No newline at end of file diff --git a/code/api/Pages/Login.cshtml b/code/api/Pages/Login.cshtml new file mode 100644 index 0000000..d68e96b --- /dev/null +++ b/code/api/Pages/Login.cshtml @@ -0,0 +1,28 @@ +@page +@model I2R.Storage.Api.Pages.Login +@{ + ViewData["Title"] = "Login"; +} + +@section Head { + <link rel="stylesheet" href="~/styles/page-specific/login.css" asp-append-version="true"> +} + +<form id="login-form"> + <fieldset> + <legend>Login</legend> + <div class="error"> + <div class="title"></div> + <div class="subtitle"></div> + </div> + <label for="username">Username</label> + <input type="text" required="required" id="username" name="username"> + <label for="password">Password</label> + <input type="password" required="required" id="password" name="password"> + <input type="submit" value="Login"> + </fieldset> +</form> + +@section Scripts { + <script src="~/scripts/page-specific/login.js" asp-append-version="true"></script> +}
\ No newline at end of file diff --git a/code/api/Pages/Login.cshtml.cs b/code/api/Pages/Login.cshtml.cs new file mode 100644 index 0000000..7d97ff1 --- /dev/null +++ b/code/api/Pages/Login.cshtml.cs @@ -0,0 +1,12 @@ +namespace I2R.Storage.Api.Pages; + +public class Login : PageModel +{ + public ActionResult OnGet() { + if (User.Identity.IsAuthenticated) { + return Redirect("/home"); + } + + return Page(); + } +}
\ No newline at end of file diff --git a/code/api/Pages/_Layout.cshtml b/code/api/Pages/_Layout.cshtml new file mode 100644 index 0000000..022e41e --- /dev/null +++ b/code/api/Pages/_Layout.cshtml @@ -0,0 +1,16 @@ +<!doctype html> +<html lang="en"> +<head> + <meta charset="UTF-8"> + <meta name="viewport" content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0"> + <meta http-equiv="X-UA-Compatible" content="ie=edge"> + <link rel="stylesheet" href="~/styles/base.css" asp-append-version="true"> + @await RenderSectionAsync("Head", false) + <title>@ViewData["Title"] - Storage</title> +</head> +<body> +@RenderBody() +<script src="~/scripts/base.js" asp-append-version="true"></script> +@await RenderSectionAsync("Scripts", false) +</body> +</html>
\ No newline at end of file diff --git a/code/api/Pages/_ViewImports.cshtml b/code/api/Pages/_ViewImports.cshtml new file mode 100644 index 0000000..c4934c1 --- /dev/null +++ b/code/api/Pages/_ViewImports.cshtml @@ -0,0 +1,3 @@ +@using I2R.Storage.Api +@namespace I2R.Storage.Api.Pages +@addTagHelper *, Microsoft.AspNetCore.Mvc.TagHelpers
\ No newline at end of file diff --git a/code/api/Pages/_ViewStart.cshtml b/code/api/Pages/_ViewStart.cshtml new file mode 100644 index 0000000..1af6e49 --- /dev/null +++ b/code/api/Pages/_ViewStart.cshtml @@ -0,0 +1,3 @@ +@{ + Layout = "_Layout"; +}
\ No newline at end of file |
