Skip to content

Commit cc08f45

Browse files
committed
Setup for styling the login form a little.
1 parent c87d083 commit cc08f45

File tree

1 file changed

+24
-22
lines changed

1 file changed

+24
-22
lines changed

Sources/App/Views/Portal/Login+View.swift

Lines changed: 24 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -22,50 +22,52 @@ enum Login {
2222

2323
override func content() -> Node<HTML.BodyContext> {
2424
.div(
25-
.h2("Login"),
25+
.h2("Login to Swift Package Index"),
2626
.loginForm(),
27-
.text(model.errorMessage),
28-
.h2("Dont have an account?"),
29-
.signupButton(),
30-
.h2("Forgot password?"),
31-
.forgotPassword()
27+
.if(model.errorMessage.isEmpty == false,
28+
.p(
29+
.text(model.errorMessage)
30+
)
31+
),
32+
.signupButton("Create an account"),
33+
.forgotPassword("Reset your password")
3234
)
3335
}
3436
}
3537
}
3638

3739
extension Node where Context: HTML.BodyContext {
3840
static func loginForm(email: String = "", password: String = "") -> Self {
39-
.div(
40-
.form(
41-
.action(SiteURL.login.relativeURL()),
42-
.method(.post),
43-
.data(named: "turbo", value: "false"),
44-
.emailField(email: email) ,
45-
.passwordField(password: password),
46-
.button(
47-
.text("Login"),
48-
.type(.submit)
49-
)
41+
.form(
42+
.action(SiteURL.login.relativeURL()),
43+
.method(.post),
44+
.data(named: "turbo", value: "false"),
45+
.emailField(email: email) ,
46+
.passwordField(password: password),
47+
.button(
48+
.text("Login"),
49+
.type(.submit)
5050
)
5151
)
5252
}
53-
54-
static func signupButton() -> Self {
53+
54+
static func signupButton(_ text: String) -> Self {
5555
.form(
56+
.class("signup"),
5657
.action(SiteURL.signup.relativeURL()),
5758
.button(
58-
.text("Create an account"),
59+
.text(text),
5960
.type(.submit)
6061
)
6162
)
6263
}
6364

64-
static func forgotPassword() -> Self {
65+
static func forgotPassword(_ text: String) -> Self {
6566
.form(
67+
.class("forgot"),
6668
.action(SiteURL.forgotPassword.relativeURL()),
6769
.button(
68-
.text("Reset password"),
70+
.text(text),
6971
.type(.submit)
7072
)
7173
)

0 commit comments

Comments
 (0)