mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-10-21 23:28:17 +00:00
@@ -47,7 +47,13 @@ func Index(w http.ResponseWriter, r *http.Request) error {
|
||||
|
||||
// Return an HTML form for the User to login.
|
||||
func Login(w http.ResponseWriter, r *http.Request) error {
|
||||
return RenderTemplate(w, "login.html", nil)
|
||||
var settings = database.SettingsMust()
|
||||
|
||||
data := struct {
|
||||
Settings *Settings
|
||||
}{settings}
|
||||
|
||||
return RenderTemplate(w, "login.html", &data)
|
||||
}
|
||||
|
||||
// Terminate the User session.
|
||||
@@ -70,6 +76,15 @@ func Reset(w http.ResponseWriter, r *http.Request) error {
|
||||
return RenderTemplate(w, "reset.html", &struct{ Error string }{""})
|
||||
}
|
||||
|
||||
// Return an HTML form for the User to signup.
|
||||
func SignUp(w http.ResponseWriter, r *http.Request) error {
|
||||
if !database.SettingsMust().OpenInvitations {
|
||||
http.Redirect(w, r, "/login", http.StatusSeeOther)
|
||||
return nil
|
||||
}
|
||||
return RenderTemplate(w, "signup.html", nil)
|
||||
}
|
||||
|
||||
// Return an HTML form to register for a new account. This
|
||||
// page must be visited from a Signup email that contains
|
||||
// a hash to verify the Email address is correct.
|
||||
@@ -144,6 +159,15 @@ func ResetPost(w http.ResponseWriter, r *http.Request) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func SignUpPost(w http.ResponseWriter, r *http.Request) error {
|
||||
if !database.SettingsMust().OpenInvitations {
|
||||
http.Redirect(w, r, "/login", http.StatusSeeOther)
|
||||
return nil
|
||||
}
|
||||
|
||||
return UserInvite(w, r)
|
||||
}
|
||||
|
||||
func RegisterPost(w http.ResponseWriter, r *http.Request) error {
|
||||
// verify the token and extract the username
|
||||
token := r.FormValue("token")
|
||||
|
Reference in New Issue
Block a user