mirror of https://github.com/statping/statping
setup form fix
parent
918035455a
commit
507c42f07e
|
@ -12,6 +12,7 @@
|
|||
- Modified notifiers to use dereferenced services and failures
|
||||
- Added core.Example() function for testing
|
||||
- Added Custom oAuth Authentication method
|
||||
- Fixed setup form not creating user from values inputted in form
|
||||
|
||||
# 0.90.55 (06-18-2020)
|
||||
- Added 404 page
|
||||
|
|
|
@ -4,6 +4,7 @@ import (
|
|||
"fmt"
|
||||
"github.com/gorilla/mux"
|
||||
"github.com/statping/statping/types/core"
|
||||
"github.com/statping/statping/types/errors"
|
||||
"github.com/statping/statping/types/null"
|
||||
"github.com/statping/statping/types/users"
|
||||
"golang.org/x/oauth2"
|
||||
|
@ -31,6 +32,8 @@ func oauthHandler(w http.ResponseWriter, r *http.Request) {
|
|||
oauth, err = slackOAuth(r)
|
||||
case "custom":
|
||||
oauth, err = customOAuth(r)
|
||||
default:
|
||||
err = errors.New("unknown oauth provider")
|
||||
}
|
||||
|
||||
if err != nil {
|
||||
|
|
|
@ -31,10 +31,8 @@ func processSetupHandler(w http.ResponseWriter, r *http.Request) {
|
|||
project := r.PostForm.Get("project")
|
||||
description := r.PostForm.Get("description")
|
||||
domain := r.PostForm.Get("domain")
|
||||
newsletter := r.PostForm.Get("newsletter")
|
||||
sendNews, _ := strconv.ParseBool(newsletter)
|
||||
reports := r.PostForm.Get("send_reports")
|
||||
sendReports, _ := strconv.ParseBool(reports)
|
||||
sendNews, _ := strconv.ParseBool(r.PostForm.Get("newsletter"))
|
||||
sendReports, _ := strconv.ParseBool(r.PostForm.Get("send_reports"))
|
||||
|
||||
log.WithFields(utils.ToFields(core.App, confgs)).Debugln("new configs posted")
|
||||
|
||||
|
|
|
@ -43,6 +43,9 @@ func LoadConfigForm(r *http.Request) (*DbConfig, error) {
|
|||
p.Set("DESCRIPTION", description)
|
||||
p.Set("LANGUAGE", language)
|
||||
p.Set("ALLOW_REPORTS", reports)
|
||||
p.Set("ADMIN_USER", username)
|
||||
p.Set("ADMIN_PASSWORD", password)
|
||||
p.Set("ADMIN_EMAIL", email)
|
||||
|
||||
confg := &DbConfig{
|
||||
DbConn: dbConn,
|
||||
|
|
|
@ -75,10 +75,9 @@ func initModels(db database.Database) {
|
|||
}
|
||||
|
||||
func CreateAdminUser(c *DbConfig) error {
|
||||
log.Infoln(fmt.Sprintf("Default Admininstrator user does not exist, creating now! (admin/admin)"))
|
||||
|
||||
adminUser := utils.Params.GetString("ADMIN_USER")
|
||||
adminPass := utils.Params.GetString("ADMIN_PASSWORD")
|
||||
adminEmail := utils.Params.GetString("ADMIN_EMAIL")
|
||||
|
||||
if adminUser == "" || adminPass == "" {
|
||||
adminUser = "admin"
|
||||
|
@ -88,7 +87,7 @@ func CreateAdminUser(c *DbConfig) error {
|
|||
admin := &users.User{
|
||||
Username: adminUser,
|
||||
Password: adminPass,
|
||||
Email: "info@admin.com",
|
||||
Email: adminEmail,
|
||||
Admin: null.NewNullBool(true),
|
||||
}
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ func InitEnvs() {
|
|||
Params.SetDefault("BASE_PATH", "")
|
||||
Params.SetDefault("ADMIN_USER", "admin")
|
||||
Params.SetDefault("ADMIN_PASSWORD", "admin")
|
||||
Params.SetDefault("ADMIN_EMAIL", "info@admin.com")
|
||||
Params.SetDefault("MAX_OPEN_CONN", 25)
|
||||
Params.SetDefault("MAX_IDLE_CONN", 25)
|
||||
Params.SetDefault("MAX_LIFE_CONN", 5*time.Minute)
|
||||
|
|
Loading…
Reference in New Issue