|
|
@@ -902,7 +902,7 @@ func setTokenCookie(id int, role string, w http.ResponseWriter) error { |
|
|
|
cookie := http.Cookie{Name: "skouter", |
|
|
|
Value: tokenStr, |
|
|
|
Path: "/", |
|
|
|
Expires: time.Now().Add(time.Hour * 24)} |
|
|
|
Expires: time.Now().Add(time.Hour * 1)} |
|
|
|
http.SetCookie(w, &cookie) |
|
|
|
|
|
|
|
return nil |
|
|
@@ -1165,9 +1165,11 @@ func queryUser(db *sql.DB, id int) (User, error) { |
|
|
|
return user, err |
|
|
|
} |
|
|
|
|
|
|
|
user.Branch, err = queryBranch(db, user.Branch.Id) |
|
|
|
if err != nil { |
|
|
|
return user, err |
|
|
|
if user.Branch.Id > 0 { |
|
|
|
user.Branch, err = queryBranch(db, user.Branch.Id) |
|
|
|
if err != nil { |
|
|
|
return user, err |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
return user, nil |
|
|
@@ -3027,6 +3029,7 @@ func createSubscription(cid string) (*stripe.Subscription, error) { |
|
|
|
func subscribe(w http.ResponseWriter, db *sql.DB, r *http.Request) { |
|
|
|
claims, err := getClaims(r) |
|
|
|
user, err := queryUser(db, claims.Id) |
|
|
|
|
|
|
|
if err != nil { |
|
|
|
w.WriteHeader(422) |
|
|
|
return |
|
|
|