views.py 文件源码

python
阅读 68 收藏 0 点赞 0 评论 0

项目:mensa-tracker 作者: annyanich 项目源码 文件源码
def delete_email_address():

    if current_user.is_anonymous:
        flash('You need to be logged in to do that')
        return redirect(url_for('index'))

    try:
        current_user.email = None
        db.session.commit()
    except exc.SQLAlchemyError:
        #  TODO log this
        flash('Something went wrong while deleting your email from our database.')
        db.session.rollback()

    oauth = OAuthSignIn.get_provider('facebook')
    # Strip out the 'facebook$' at the start of the id
    user_id = re.findall('\d+', current_user.social_id)[0]
    permission_revoked = oauth.revoke_email_permission(user_id)

    if not permission_revoked:
        flash('There was a problem giving up the permission to access your email address.  '
              'It may be re-added to your account here the next time you sign in.  '
              'To permanently remove it, please use your privacy settings in Facebook.')

    return redirect(url_for('index'))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号