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'))
评论列表
文章目录