def new_openid_user(resp): session["openid"] = resp.identity_url lookup_current_user() if g.user is None: user = User() user.email = resp.email user.openid = resp.identity_url user.name = resp.fullname user.creation_ip = session["ip"] gravatar_image_update(user) generate_account_name(user) db.session.add(user) db.session.commit() g.user = user audit_user_creation(user) update_user_login_ip(g.user, session["ip"]) return redirect(oid.get_next_url())
def new_openid_user(resp): session['openid'] = resp.identity_url lookup_current_user() if g.user is None: user = User() user.email = resp.email user.openid = resp.identity_url user.name = resp.fullname user.creation_ip = session['ip'] gravatar_image_update(user) generate_account_name(user) db.session.add(user) db.session.commit() g.user = user audit_user_creation(user) update_user_login_ip(g.user, session['ip']) return redirect(oid.get_next_url())
def oauth_authorized_twitter(resp): next_url = request.args.get("next") or url_for("index") if resp is None: flash("You denied the request to sign in.") return redirect(next_url) session["oauth_token"] = (resp["oauth_token"], resp["oauth_token_secret"]) lookup_current_user() if g.user is None: user = User() user.oauth_token = resp["oauth_token"] user.oauth_secret = resp["oauth_token_secret"] user.name = resp["screen_name"] user.creation_ip = session["ip"] gravatar_image_update(user) generate_account_name(user) db.session.add(user) db.session.commit() g.user = user audit_user_creation(user) update_user_login_ip(g.user, session["ip"]) return redirect(next_url)
def oauth_authorized_twitter(resp): next_url = request.args.get('next') or url_for('index') if resp is None: flash('You denied the request to sign in.') return redirect(next_url) session['oauth_token'] = (resp['oauth_token'], resp['oauth_token_secret']) lookup_current_user() if g.user is None: user = User() user.oauth_token = resp['oauth_token'] user.oauth_secret = resp['oauth_token_secret'] user.name = resp['screen_name'] user.creation_ip = session['ip'] gravatar_image_update(user) generate_account_name(user) db.session.add(user) db.session.commit() g.user = user audit_user_creation(user) update_user_login_ip(g.user, session['ip']) return redirect(next_url)
def oauth_authorized_facebook(resp): next_url = request.args.get("next") or url_for("index") if resp is None: flash("You denied the request to sign in.") return redirect(next_url) session["oauth_token"] = (resp["access_token"], "") g.temp_oauth_token = resp["access_token"] session["fbid"] = facebook.get("/me").data["id"] lookup_current_user() if g.user is None: user = User() user.oauth_token = resp["access_token"] user.creation_ip = session["ip"] update_fb_info(user) generate_account_name(user) db.session.add(user) db.session.commit() g.user = user audit_user_creation(user) # Update name/email g.temp_oauth_token = None update_fb_info(g.user) update_user_login_ip(g.user, session["ip"]) return redirect(next_url)
def oauth_authorized_facebook(resp): next_url = request.args.get('next') or url_for('index') if resp is None: flash('You denied the request to sign in.') return redirect(next_url) session['oauth_token'] = (resp['access_token'], '') g.temp_oauth_token = resp['access_token'] session['fbid'] = facebook.get('/me').data['id'] lookup_current_user() if g.user is None: user = User() user.oauth_token = resp['access_token'] user.creation_ip = session['ip'] update_fb_info(user) generate_account_name(user) db.session.add(user) db.session.commit() g.user = user audit_user_creation(user) # Update name/email g.temp_oauth_token = None update_fb_info(g.user) update_user_login_ip(g.user, session['ip']) return redirect(next_url)