• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python util.get_next_url函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中util.get_next_url函数的典型用法代码示例。如果您正苦于以下问题:Python get_next_url函数的具体用法?Python get_next_url怎么用?Python get_next_url使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了get_next_url函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: yahoo_authorized

def yahoo_authorized(resp):
  if resp is None:
    flask.flash(u'You denied the request to sign in.')
    return flask.redirect(util.get_next_url())

  flask.session['oauth_token'] = (
      resp['oauth_token'],
      resp['oauth_token_secret'],
    )

  try:
    yahoo_guid = yahoo.get(
        '/v1/me/guid', data={'format': 'json', 'realm': 'yahooapis.com'}
      ).data['guid']['value']

    profile = yahoo.get(
        '/v1/user/%s/profile' % yahoo_guid,
        data={'format': 'json', 'realm': 'yahooapis.com'}
      ).data['profile']
  except:
    flask.flash(
        'Something went wrong with Yahoo! sign in. Please try again.',
        category='danger',
      )
    return flask.redirect(util.get_next_url())
  user_db = retrieve_user_from_yahoo(profile)
  return signin_user_db(user_db)
开发者ID:anthonykeane,项目名称:gae-init-auth,代码行数:27,代码来源:auth.py


示例2: signin_twitter

def signin_twitter():
  flask.session.pop('oauth_token', None)
  try:
    return twitter.authorize(
        callback=flask.url_for('twitter_authorized', next=util.get_next_url()),
      )
  except:
    flask.flash(
        'Something went terribly wrong with Twitter sign in. Please try again.',
        category='danger',
      )
    return flask.redirect(flask.url_for('signin', next=util.get_next_url()))
开发者ID:imxdmeo,项目名称:gae-init-auth,代码行数:12,代码来源:auth.py


示例3: signin

def signin():
  next_url = util.get_next_url()
  form = None
  if config.CONFIG_DB.has_email_authentication:
    form = form_with_recaptcha(SignInForm())
    save_request_params()
    if form.validate_on_submit():
      result = get_user_db_from_email(form.email.data, form.password.data)
      if result:
        cache.reset_auth_attempt()
        return signin_user_db(result)
      if result is None:
        form.email.errors.append('Email or Password do not match')
      if result is False:
        return flask.redirect(flask.url_for('welcome'))
    if not form.errors:
      form.next_url.data = next_url

  if form and form.errors:
    cache.bump_auth_attempt()

  return flask.render_template(
    'auth/auth.html',
    title='Sign in',
    html_class='auth',
    next_url=next_url,
    form=form,
    form_type='signin' if config.CONFIG_DB.has_email_authentication else '',
    **urls_for_oauth(next_url)
  )
开发者ID:pombredanne,项目名称:github-stats,代码行数:30,代码来源:auth.py


示例4: signin

def signin():
  next_url = util.get_next_url()
  if flask.url_for('signin') in next_url:
    next_url = flask.url_for('welcome')

  bitbucket_signin_url = flask.url_for('signin_bitbucket', next=next_url)
  dropbox_signin_url = flask.url_for('signin_dropbox', next=next_url)
  facebook_signin_url = flask.url_for('signin_facebook', next=next_url)
  github_signin_url = flask.url_for('signin_github', next=next_url)
  google_signin_url = flask.url_for('signin_google', next=next_url)
  linkedin_signin_url = flask.url_for('signin_linkedin', next=next_url)
  twitter_signin_url = flask.url_for('signin_twitter', next=next_url)
  vk_signin_url = flask.url_for('signin_vk', next=next_url)
  windowslive_signin_url = flask.url_for('signin_windowslive', next=next_url)

  return flask.render_template(
      'signin.html',
      title='Please sign in',
      html_class='signin',
      bitbucket_signin_url=bitbucket_signin_url,
      dropbox_signin_url=dropbox_signin_url,
      facebook_signin_url=facebook_signin_url,
      github_signin_url=github_signin_url,
      google_signin_url=google_signin_url,
      linkedin_signin_url=linkedin_signin_url,
      twitter_signin_url=twitter_signin_url,
      vk_signin_url=vk_signin_url,
      windowslive_signin_url=windowslive_signin_url,
      next_url=next_url,
    )
开发者ID:imxdmeo,项目名称:gae-init-auth,代码行数:30,代码来源:auth.py


示例5: login

def login():
    next_url = util.get_next_url()
    if flask.url_for("auth.login") in next_url:
        next_url = flask.url_for("pages.index")

    google_login_url = flask.url_for("auth.login_google", next=next_url)
    twitter_login_url = flask.url_for("auth.login_twitter", next=next_url)
    facebook_login_url = flask.url_for("auth.login_facebook", next=next_url)
    vk_login_url = flask.url_for("auth.login_vk", next=next_url)
    yandex_login_url = flask.url_for("auth.login_yandex", next=next_url)
    mailru_login_url = flask.url_for("auth.login_mailru", next=next_url)
    odnoklassniki_login_url = flask.url_for("auth.login_odnoklassniki", next=next_url)

    return flask.render_template(
        "auth/login.html",
        title="Login",
        html_class="login",
        google_login_url=google_login_url,
        twitter_login_url=twitter_login_url,
        facebook_login_url=facebook_login_url,
        vk_login_url=vk_login_url,
        yandex_login_url=yandex_login_url,
        mailru_login_url=mailru_login_url,
        odnoklassniki_login_url=odnoklassniki_login_url,
        next_url=next_url,
    )
开发者ID:gmist,项目名称:3dhero.ru,代码行数:26,代码来源:auth_views.py


示例6: signin_user_db

def signin_user_db(user_db):
    if not user_db:
        return flask.redirect(flask.url_for('welcome'))
    flask_user_db = FlaskUser(user_db)
    if login.login_user(flask_user_db):
        user_db.put_async()
        flask.flash('Hello %s, welcome to %s!!!' % (
            user_db.name, config.CONFIG_DB.brand_name,
        ), category='success')
        return flask.redirect(util.get_next_url())
    else:
        flask.flash('Sorry, but you could not sign in.', category='danger')
        return flask.redirect(flask.url_for('welcome'))


#def get_or_create_google_plus_user(google_id, access_token, expires_at, refresh_token, **params):
#    user = model.User.retrieve_one_by('username', google_id['name'])
#    if user is None:
#        user = current_user_db()
#        user.google_display_name = google_id['name']
#        user.google_plus_id = google_id['id']
#        if google_id.has_key('picture'):
#            user.google_public_profile_url = google_id['picture']
#        user.access_token = access_token
#        user.expires_at = expires_at
#        user.refresh_token = refresh_token
#
#    user.put()
#    return user
开发者ID:gbozee,项目名称:Green-Football-Zone,代码行数:29,代码来源:auth.py


示例7: signup

def signup():
  next_url = util.get_next_url()
  form = None
  if config.CONFIG_DB.has_email_authentication:
    form = form_with_recaptcha(SignUpForm())
    save_request_params()
    if form.validate_on_submit():
      user_db = model.User.get_by('email', form.email.data)
      if user_db:
        form.email.errors.append('This email is already taken.')

      if not form.errors:
        user_db = create_user_db(
          None,
          util.create_name_from_email(form.email.data),
          form.email.data,
          form.email.data,
        )
        user_db.put()
        task.activate_user_notification(user_db)
        cache.bump_auth_attempt()
        return flask.redirect(flask.url_for('welcome'))

  if form and form.errors:
    cache.bump_auth_attempt()

  title = 'Sign up' if config.CONFIG_DB.has_email_authentication else 'Sign in'
  return flask.render_template(
    'auth/auth.html',
    title=title,
    html_class='auth',
    next_url=next_url,
    form=form,
    **urls_for_oauth(next_url)
  )
开发者ID:pombredanne,项目名称:github-stats,代码行数:35,代码来源:auth.py


示例8: login_twitter

def login_twitter():
    flask.session.pop("oauth_token", None)
    try:
        return twitter.authorize(callback=flask.url_for("auth.twitter_oauth_authorized", next=util.get_next_url()))
    except:
        flask.flash("Something went terribly wrong with Twitter login. Please try again.", category="danger")
        return flask.redirect(flask.url_for("auth.login", next=util.get_next_url()))
开发者ID:gmist,项目名称:3dhero.ru,代码行数:7,代码来源:auth_views.py


示例9: signin_github

def signin_github():
  return github.authorize(
    callback=flask.url_for('github_authorized',
      next=util.get_next_url(),
      _external=True
    )
  )
开发者ID:topless,项目名称:gae-init-docs,代码行数:7,代码来源:auth.py


示例10: signin_bitbucket

def signin_bitbucket():
  flask.session['oauth_token'] = None
  return bitbucket.authorize(
      callback=flask.url_for('bitbucket_authorized',
          next=util.get_next_url(),
          _external=True,
        )
    )
开发者ID:imxdmeo,项目名称:gae-init-auth,代码行数:8,代码来源:auth.py


示例11: signin_twitter

def signin_twitter():
    flask.session.pop("oauth_token", None)
    save_request_params()
    try:
        return twitter.authorize(callback=flask.url_for("twitter_authorized"))
    except:
        flask.flash("Something went wrong with Twitter sign in. Please try again.", category="danger")
        return flask.redirect(flask.url_for("signin", next=util.get_next_url()))
开发者ID:ksymeon,项目名称:gae-init-docs,代码行数:8,代码来源:auth.py


示例12: google_authorized

def google_authorized():
  google_user = users.get_current_user()
  if google_user is None:
    flask.flash(u'Вы отвергли запрос на вход.')
    return flask.redirect(util.get_next_url())

  user_db = retrieve_user_from_google(google_user)
  return signin_user_db(user_db)
开发者ID:aegoroff,项目名称:egoroff.spb.ru,代码行数:8,代码来源:auth.py


示例13: google_authorized

def google_authorized():
    google_user = users.get_current_user()
    if google_user is None:
        flask.flash(u"You denied the request to sign in.")
        return flask.redirect(util.get_next_url())

    user_db = retrieve_user_from_google(google_user)
    return login_user_db(user_db)
开发者ID:gmist,项目名称:3dhero.ru,代码行数:8,代码来源:auth_views.py


示例14: login_yandex

def login_yandex():
    params = dict(yandex.request_token_params)
    params["client_id"] = yandex.consumer_key
    params["response_type"] = "code"
    params["state"] = util.get_next_url()
    flask.session[yandex.name + "_oauthredir"] = flask.url_for("auth.yandex_authorized")
    url = add_query(yandex.expand_url(yandex.authorize_url), params)
    return flask.redirect(url)
开发者ID:gmist,项目名称:3dhero.ru,代码行数:8,代码来源:auth_views.py


示例15: gae_authorized

def gae_authorized():
  gae_user = users.get_current_user()
  if gae_user is None:
    flask.flash('You denied the request to sign in.')
    return flask.redirect(util.get_next_url())

  user_db = retrieve_user_from_gae(gae_user)
  return auth.signin_user_db(user_db)
开发者ID:bangive,项目名称:gae-init,代码行数:8,代码来源:gae.py


示例16: twitter_oauth_authorized

def twitter_oauth_authorized(resp):
    if resp is None:
        flask.flash(u"You denied the request to sign in.")
        return flask.redirect(util.get_next_url())

    flask.session["oauth_token"] = (resp["oauth_token"], resp["oauth_token_secret"])
    user_db = retrieve_user_from_twitter(resp)
    return login_user_db(user_db)
开发者ID:gmist,项目名称:3dhero.ru,代码行数:8,代码来源:auth_views.py


示例17: signin_windowslive

def signin_windowslive():
  return windowslive.authorize(
      callback=flask.url_for(
          'windowslive_authorized',
          next=util.get_next_url(),
          _external=True,
        )
    )
开发者ID:imxdmeo,项目名称:gae-init-auth,代码行数:8,代码来源:auth.py


示例18: facebook_authorized

def facebook_authorized(resp):
    if resp is None:
        flask.flash(u"You denied the request to sign in.")
        return flask.redirect(util.get_next_url())

    flask.session["oauth_token"] = (resp["access_token"], "")
    me = facebook.get("/me")
    user_db = retrieve_user_from_facebook(me.data)
    return signin_user_db(user_db)
开发者ID:ksymeon,项目名称:gae-init-docs,代码行数:9,代码来源:auth.py


示例19: twitter_authorized

def twitter_authorized():
    response = twitter.authorized_response()
    if response is None:
        flask.flash("You denied the request to sign in.")
        return flask.redirect(util.get_next_url())

    flask.session["oauth_token"] = (response["oauth_token"], response["oauth_token_secret"])
    user_db = retrieve_user_from_twitter(response)
    return auth.signin_user_db(user_db)
开发者ID:proserve,项目名称:gae-init,代码行数:9,代码来源:twitter.py


示例20: github_authorized

def github_authorized():
  response = github.authorized_response()
  if response is None:
    flask.flash('You denied the request to sign in.')
    return flask.redirect(util.get_next_url())
  flask.session['oauth_token'] = (response['access_token'], '')
  me = github.get('user')
  user_db = retrieve_user_from_github(me.data)
  return auth.signin_user_db(user_db)
开发者ID:gmist,项目名称:1businka2,代码行数:9,代码来源:github.py



注:本文中的util.get_next_url函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python util.get_os函数代码示例发布时间:2022-05-27
下一篇:
Python util.get_logger函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap