Skip to content

Commit ddb4a80

Browse files
Redesign credential screen
1 parent 8064718 commit ddb4a80

File tree

6 files changed

+93
-21
lines changed

6 files changed

+93
-21
lines changed

Modules/Authentication.Web/Controllers/BaseController.cs

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
using GenHTTP.Api.Content;
22
using GenHTTP.Api.Content.Templating;
33

4+
using GenHTTP.Modules.Authentication.Web.ViewModels;
45
using GenHTTP.Modules.IO;
56
using GenHTTP.Modules.Razor;
67

@@ -10,9 +11,9 @@ namespace GenHTTP.Modules.Authentication.Web.Controllers
1011
public class BaseController
1112
{
1213

13-
protected IHandlerBuilder RenderAccountEntry(string title)
14+
protected IHandlerBuilder RenderAccountEntry(string title, string buttonCaption)
1415
{
15-
return ModRazor.Page(Resource.FromAssembly("EnterAccount.cshtml"), (r, h) => new BasicModel(r, h))
16+
return ModRazor.Page(Resource.FromAssembly("EnterAccount.cshtml"), (r, h) => new ViewModel<EnterAccountModel>(r, h, new(buttonCaption)))
1617
.AddStyle("{web-auth-resources}/style.css")
1718
.Title(title);
1819
}

Modules/Authentication.Web/Controllers/LoginController.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public LoginController(Func<IRequest, string, string, ValueTask<IUser?>> perform
2424
public IHandlerBuilder Index()
2525
{
2626
// ToDo: already logged in
27-
return RenderAccountEntry("Login");
27+
return RenderAccountEntry("Login", "Login");
2828
}
2929

3030
[ControllerAction(RequestMethod.POST)]
@@ -40,7 +40,7 @@ public async Task<IHandlerBuilder> Index(string user, string password, IRequest
4040
}
4141
else
4242
{
43-
return RenderAccountEntry("Login");
43+
return RenderAccountEntry("Login", "Login");
4444
}
4545
}
4646

Modules/Authentication.Web/Controllers/SetupController.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public SetupController(Func<IRequest, string, string, ValueTask> performSetup)
2525

2626
public IHandlerBuilder Index()
2727
{
28-
return RenderAccountEntry("Setup");
28+
return RenderAccountEntry("Setup", "Create Account");
2929
}
3030

3131
[ControllerAction(RequestMethod.POST)]
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,52 @@
1-
.center {
2-
margin: auto;
3-
width: 50%;
4-
border: 3px solid green;
5-
padding: 10px;
1+
.container {
2+
width: 100%;
3+
height: 100%;
4+
display: flex;
5+
align-items: center;
6+
justify-content: center;
7+
}
8+
9+
.icon {
10+
width: 15px;
11+
height: 100%;
12+
position: absolute;
13+
right: 0px;
14+
top: 0px;
15+
z-index: 99;
16+
}
17+
18+
.inputs {
19+
position: relative;
20+
display: flex;
21+
flex-flow: column wrap;
22+
gap: 20px;
23+
margin-left: 10px;
24+
}
25+
26+
.user_cont, .pass_cont {
27+
position: relative;
28+
}
29+
30+
.inputs input {
31+
width: 100%;
32+
border: none;
33+
outline: none;
34+
background-color: #DEDEDE;
35+
padding: 7px 6px;
36+
border-radius: 10px;
37+
}
38+
39+
button {
40+
width: 100%;
41+
border: none;
42+
outline: none;
43+
padding: 5px 8px;
44+
border-radius: 10px;
45+
transition: all 0.1s ease;
46+
background-color: #DEDEDE;
47+
}
48+
49+
button:hover {
50+
transform: translateY(-1px);
51+
cursor: pointer;
652
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
namespace GenHTTP.Modules.Authentication.Web.ViewModels
2+
{
3+
4+
public record EnterAccountModel
5+
(
6+
7+
string ButtonCaption
8+
9+
);
10+
11+
}
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,27 @@
1-
<div class="center">
1+
<form id="credentials" method="post" action=".">
22

3-
<form id="credentials" method="post" action=".">
3+
<div class="container">
4+
5+
<div class="inputs">
6+
7+
<div class="user_cont">
8+
<input type="text" id="user" name="user" placeholder="username" />
9+
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="#333333" class="icon w-6 h-6">
10+
<path stroke-linecap="round" d="M16.5 12a4.5 4.5 0 11-9 0 4.5 4.5 0 019 0zm0 0c0 1.657 1.007 3 2.25 3S21 13.657 21 12a9 9 0 10-2.636 6.364M16.5 12V8.25" />
11+
</svg>
12+
</div>
13+
14+
<div class="pass_cont">
15+
<input type="password" name="password" id="password" placeholder="password" />
16+
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="#333333" class="icon w-6 h-6">
17+
<path stroke-linecap="round" stroke-linejoin="round" d="M16.5 10.5V6.75a4.5 4.5 0 10-9 0v3.75m-.75 11.25h10.5a2.25 2.25 0 002.25-2.25v-6.75a2.25 2.25 0 00-2.25-2.25H6.75a2.25 2.25 0 00-2.25 2.25v6.75a2.25 2.25 0 002.25 2.25z" />
18+
</svg>
19+
</div>
20+
21+
<button>@Model.Data.ButtonCaption</button>
22+
23+
</div>
24+
25+
</div>
426

5-
<input type="text" id="user" name="user" placeholder="Username" />
6-
7-
<input type="password" name="password" id="password" />
8-
9-
<input type="submit" value="Send" />
10-
11-
</form>
12-
13-
</div>
27+
</form>

0 commit comments

Comments
 (0)