1
0
Fork 0
This commit is contained in:
Aaron Lindsay 2016-12-26 08:38:32 -05:00
parent c8232050da
commit 49893ffdb6
2 changed files with 2 additions and 6 deletions

View File

@ -16,23 +16,19 @@ import (
var serveFcgi bool
var baseDir string
var tmpDir string
var port int
var smtpServer string
var smtpPort int
var smtpUsername string
var smtpPassword string
var reminderEmail string
func init() {
flag.StringVar(&baseDir, "base", "./", "Base directory for server")
flag.StringVar(&tmpDir, "tmp", "/tmp", "Directory to create temporary files in")
flag.IntVar(&port, "port", 80, "Port to serve API/files on")
flag.StringVar(&smtpServer, "smtp.server", "smtp.example.com", "SMTP server to send reminder emails from.")
flag.IntVar(&smtpPort, "smtp.port", 587, "SMTP server port to connect to")
flag.StringVar(&smtpUsername, "smtp.username", "moneygo", "SMTP username")
flag.StringVar(&smtpPassword, "smtp.password", "password", "SMTP password")
flag.StringVar(&reminderEmail, "email", "moneygo@example.com", "Email address to send reminder emails as.")
flag.BoolVar(&serveFcgi, "fcgi", false, "Serve via fcgi rather than http.")
flag.Parse()

View File

@ -25,7 +25,7 @@ func (s *Session) Write(w http.ResponseWriter) error {
func GetSession(r *http.Request) (*Session, error) {
var s Session
session, _ := cookie_store.Get(r, "moneygo")
session, _ := cookie_store.Get(r, "lunch")
_, ok := session.Values["session-secret"]
if !ok {
return nil, fmt.Errorf("session-secret cookie not set")
@ -49,7 +49,7 @@ func DeleteSessionIfExists(r *http.Request) {
func NewSession(w http.ResponseWriter, r *http.Request, userid int64) (*Session, error) {
s := Session{}
session, _ := cookie_store.Get(r, "moneygo")
session, _ := cookie_store.Get(r, "lunch")
session.Values["session-secret"] = string(securecookie.GenerateRandomKey(64))
s.SessionSecret = session.Values["session-secret"].(string)