@@ -22,50 +22,52 @@ enum Login {
22
22
23
23
override func content( ) -> Node < HTML . BodyContext > {
24
24
. div(
25
- . h2( " Login " ) ,
25
+ . h2( " Login to Swift Package Index " ) ,
26
26
. 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 " )
32
34
)
33
35
}
34
36
}
35
37
}
36
38
37
39
extension Node where Context: HTML . BodyContext {
38
40
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)
50
50
)
51
51
)
52
52
}
53
-
54
- static func signupButton( ) -> Self {
53
+
54
+ static func signupButton( _ text : String ) -> Self {
55
55
. form(
56
+ . class( " signup " ) ,
56
57
. action( SiteURL . signup. relativeURL ( ) ) ,
57
58
. button(
58
- . text( " Create an account " ) ,
59
+ . text( text ) ,
59
60
. type( . submit)
60
61
)
61
62
)
62
63
}
63
64
64
- static func forgotPassword( ) -> Self {
65
+ static func forgotPassword( _ text : String ) -> Self {
65
66
. form(
67
+ . class( " forgot " ) ,
66
68
. action( SiteURL . forgotPassword. relativeURL ( ) ) ,
67
69
. button(
68
- . text( " Reset password " ) ,
70
+ . text( text ) ,
69
71
. type( . submit)
70
72
)
71
73
)
0 commit comments