def create_or_login(resp): id = steam_id_re.findall(resp.identity_url)[0] g.cursor.execute("SELECT id, active, ugroup FROM users WHERE steamid=%s", (id, )) user = g.cursor.fetchone() if user: if user.active: g.user = user.id g.group = user.ugroup g.cursor.execute("UPDATE users SET last_login=%s WHERE id=%s", (datetime.utcnow(), user.id)) else: raise UserError("Account Disabled. Please contact support for more information") else: allowed = steam.getGroupMembers("emporiumbeta") if int(id) not in allowed: log.warning("User %s is not allowed in beta (%s)" % (id, allowed)) raise UserError("Sorry, your not part of the beta! :(") if id in auto_admin_steamids: group = 'super' else: group = 'normal' g.user = create_user(id, group) g.group = group g.session["u"] = g.user return redirect(oid.get_next_url())
def route_login(): if g.user: return redirect(oid.get_next_url()) return oid.try_login("http://steamcommunity.com/openid")