def should_update_email():
"""Check whether the current user has not set his or her email address.
Some authentication providers may not give the email addresses.
However, Railgun relies on email addresss to finish login process.
So the users from these providers will be given `fake` email addresses.
:class:`should_update_email` should be called before a view is executed,
check whether the user should be redirected to
:func:`~railgun.website.views.profile_edit` to fill in his or her
email address.
:return: :data:`True` if the user has a fake email address, :data:`False`
otherwise.
.. note::
If the current view is :func:`~railgun.website.views.profile_edit`,
this method will return :data:`False`.
"""
if (current_user.email.endswith(app.config['EXAMPLE_USER_EMAIL_SUFFIX'])
and request.endpoint != 'profile_edit'):
return True
评论列表
文章目录