add user templates

This commit is contained in:
stryan 2020-11-12 14:51:48 -05:00
parent 0c347eda8e
commit 0b86f1f4bb
2 changed files with 16 additions and 10 deletions

View File

@ -29,6 +29,7 @@ type Config struct {
Mail *MailConfig
Secret string
TplPath string
UserTplPath string
Tls bool
Key string
Cert string
@ -74,6 +75,7 @@ func LoadConfig() (*Config, error) {
c.Key = viper.GetString("tls_key")
c.Cert = viper.GetString("tls_cert")
c.TplPath = viper.GetString("templates_path")
c.UserTplPath = viper.GetString("user_templates_path")
m.SmtpServer = viper.GetString("SmtpServer")
m.Username = viper.GetString("SmtpUsername")
m.Password = viper.GetString("SmtpPassword")

View File

@ -41,6 +41,10 @@ func main() {
router.HandleFunc("/reset/error", resetErrorPage).Methods("GET")
log.Printf("Registering templates from %v/\n", Conf.TplPath)
tpl = template.Must(template.ParseGlob(Conf.TplPath + "/*"))
if Conf.UserTplPath != "" {
log.Printf("Registering user templates from %v/\n", Conf.UsrTplPath)
tpl = template.Must(tpl.ParseGlob(Conf.UserTplPath + "/*"))
}
log.Println("Performing LDAP checks")
log.Println("Loading max employeeNumber for account creation")
i, err := findLDAPMaxID()