Register link goes outside login form
This commit is contained in:
parent
84fb52ac21
commit
60b4fa773c
@ -8,7 +8,6 @@ type Login struct {
|
||||
SuccessfulSetPassword bool `json:",omitempty" xml:",omitempty"`
|
||||
Username hmc.Input
|
||||
Password hmc.Input
|
||||
RegisterLink hmc.Link
|
||||
}
|
||||
|
||||
func NewLogin(username, password string) Login {
|
||||
@ -26,10 +25,6 @@ func NewLogin(username, password string) Login {
|
||||
Required: true,
|
||||
Value: password,
|
||||
},
|
||||
RegisterLink: hmc.Link{
|
||||
Label: "Register",
|
||||
Href: "/register",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -17,6 +17,20 @@ import (
|
||||
type LoginPage struct {
|
||||
hmc.Namespace
|
||||
Form hmc.Form[props.Login]
|
||||
RegisterLink hmc.Link
|
||||
}
|
||||
|
||||
func NewLoginPage() LoginPage {
|
||||
return LoginPage{
|
||||
Namespace: hmc.NS(),
|
||||
Form: hmc.Form[props.Login]{
|
||||
Method: "POST",
|
||||
},
|
||||
RegisterLink: hmc.Link{
|
||||
Label: "Register",
|
||||
Href: "/register",
|
||||
},
|
||||
}
|
||||
}
|
||||
|
||||
func Login(s *session.Session, w rsvp.ResponseWriter, r *http.Request) rsvp.Body {
|
||||
@ -35,10 +49,8 @@ func Login(s *session.Session, w rsvp.ResponseWriter, r *http.Request) rsvp.Body
|
||||
login.SuccessfulSetPassword = flashProps.SuccessfulSetPassword
|
||||
}
|
||||
|
||||
body := LoginPage{
|
||||
Namespace: hmc.NS(),
|
||||
Form: hmc.Form[props.Login]{Method: "POST", Elements: login},
|
||||
}
|
||||
body := NewLoginPage()
|
||||
body.Form.Elements = login
|
||||
return rsvp.Body{TemplateName: "login.gotmpl", Data: body}
|
||||
}
|
||||
|
||||
@ -77,10 +89,7 @@ func LoginMiddle(username, password string, session *session.Session, r *http.Re
|
||||
}
|
||||
|
||||
func LoginPost(session *session.Session, w rsvp.ResponseWriter, r *http.Request) rsvp.Body {
|
||||
page := LoginPage{
|
||||
Namespace: hmc.NS(),
|
||||
Form: hmc.Form[props.Login]{Method: "POST"},
|
||||
}
|
||||
page := NewLoginPage()
|
||||
|
||||
err := r.ParseForm()
|
||||
if err != nil {
|
||||
|
||||
@ -35,7 +35,7 @@
|
||||
{{template "input" .Password}}
|
||||
</label>
|
||||
<div class="mb-3">
|
||||
{{template "hyperlink" .RegisterLink}}
|
||||
{{template "hyperlink" $.RegisterLink}}
|
||||
</div>
|
||||
<button class="btn btn-primary" type="submit">Login</button>
|
||||
</div>
|
||||
|
||||
Loading…
Reference in New Issue
Block a user