Fix issue when validating providers for playground when creating a new

session
This commit is contained in:
marcos
2017-12-18 14:11:13 -03:00
parent 780e6c2c37
commit 533440dac5

View File

@@ -21,10 +21,17 @@ type NewSessionResponse struct {
}
func NewSession(rw http.ResponseWriter, req *http.Request) {
playground := core.PlaygroundFindByDomain(req.Host)
if playground == nil {
log.Printf("Playground for domain %s was not found!", req.Host)
rw.WriteHeader(http.StatusBadRequest)
return
}
req.ParseForm()
userId := ""
if len(config.Providers) > 0 {
if len(config.Providers[playground.Id]) > 0 {
cookie, err := ReadCookie(req)
if err != nil {
// User it not a human
@@ -53,13 +60,6 @@ func NewSession(rw http.ResponseWriter, req *http.Request) {
}
playground := core.PlaygroundFindByDomain(req.Host)
if playground == nil {
log.Printf("Playground for domain %s was not found!", req.Host)
rw.WriteHeader(http.StatusBadRequest)
return
}
var duration time.Duration
if reqDur != "" {
d, err := time.ParseDuration(reqDur)