// Helper function to hotregister a guest user, log him in and build his user data into uni.Dat["_user"]. func RegLoginBuild(uni *context.Uni, solved_puzzle bool) error { db := uni.Db ev := uni.Ev guest_rules := guestRules(uni) inp := uni.Req.Form http_header := uni.Req.Header dat := uni.Dat w := uni.W block_key := []byte(uni.Secret()) guest_id, err := user_model.RegisterGuest(db, ev, guest_rules, inp, solved_puzzle) if err != nil { return err } err = user_model.Login(w, guest_id, block_key) if err != nil { return err } user, err := user_model.BuildUser(db, ev, guest_id, http_header) if err != nil { return err } dat["_user"] = user return nil }
func showTimer(uni *context.Uni, puzzle_opt map[string]interface{}) (string, error) { return user_model.ShowTimer(uni.Secret(), puzzle_opt) }
func solveTimer(uni *context.Uni, puzzle_opts map[string]interface{}) error { return user_model.SolveTimer(uni.Secret(), uni.Req.Form, puzzle_opts) }