Fix issue when validating providers for playground when creating a new
session
This commit is contained in:
@@ -21,10 +21,17 @@ type NewSessionResponse struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewSession(rw http.ResponseWriter, req *http.Request) {
|
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()
|
req.ParseForm()
|
||||||
|
|
||||||
userId := ""
|
userId := ""
|
||||||
if len(config.Providers) > 0 {
|
if len(config.Providers[playground.Id]) > 0 {
|
||||||
cookie, err := ReadCookie(req)
|
cookie, err := ReadCookie(req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// User it not a human
|
// 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
|
var duration time.Duration
|
||||||
if reqDur != "" {
|
if reqDur != "" {
|
||||||
d, err := time.ParseDuration(reqDur)
|
d, err := time.ParseDuration(reqDur)
|
||||||
|
|||||||
Reference in New Issue
Block a user