Python flask_login.logout_user() Examples
The following are 14
code examples of flask_login.logout_user().
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example.
You may also want to check out all available functions/classes of the module
flask_login
, or try the search function
.
Example #1
Source File: user.py From gae-angular-material-starter with MIT License | 6 votes |
def user_verify(token): """Verifies user's email by token provided in url""" if auth.is_logged_in(): login.logout_user() return flask.redirect(flask.request.path) user_db = model.User.get_by('token', token) if user_db and not user_db.verified: # setting new token is necessary, so this one can't be reused user_db.token = util.uuid() user_db.verified = True user_db.put() auth.signin_user_db(user_db) flask.flash('Welcome on board %s!' % user_db.username) else: flask.flash('Sorry, activation link is either invalid or expired.') return flask.redirect(flask.url_for('index'))
Example #2
Source File: flask_ext.py From quart with MIT License | 5 votes |
def logout(): flask_login.logout_user() return 'Logged out'
Example #3
Source File: user.py From github-stats with MIT License | 5 votes |
def user_reset(token=None): user_db = model.User.get_by('token', token) if not user_db: flask.flash('That link is either invalid or expired.', category='danger') return flask.redirect(flask.url_for('welcome')) if auth.is_logged_in(): flask_login.logout_user() return flask.redirect(flask.request.path) form = UserResetForm() if form.validate_on_submit(): user_db.password_hash = util.password_hash(user_db, form.new_password.data) user_db.token = util.uuid() user_db.verified = True user_db.put() flask.flash('Your password was changed succesfully.', category='success') return auth.signin_user_db(user_db) return flask.render_template( 'user/user_reset.html', title='Reset Password', html_class='user-reset', form=form, user_db=user_db, ) ############################################################################### # User Activate ###############################################################################
Example #4
Source File: user.py From github-stats with MIT License | 5 votes |
def user_activate(token): if auth.is_logged_in(): flask_login.logout_user() return flask.redirect(flask.request.path) user_db = model.User.get_by('token', token) if not user_db: flask.flash('That link is either invalid or expired.', category='danger') return flask.redirect(flask.url_for('welcome')) form = UserActivateForm(obj=user_db) if form.validate_on_submit(): form.populate_obj(user_db) user_db.password_hash = util.password_hash(user_db, form.password.data) user_db.token = util.uuid() user_db.verified = True user_db.put() return auth.signin_user_db(user_db) return flask.render_template( 'user/user_activate.html', title='Activate Account', html_class='user-activate', user_db=user_db, form=form, ) ############################################################################### # User Merge ###############################################################################
Example #5
Source File: auth.py From github-stats with MIT License | 5 votes |
def signout(): flask_login.logout_user() return flask.redirect(flask.url_for('welcome')) ############################################################################### # Helpers ###############################################################################
Example #6
Source File: monitor_main.py From flask-sqlalchemy-web with MIT License | 5 votes |
def logout(): # remove the username from the session if it's there logger.debug("logout page") flask_login.logout_user() return redirect(url_for('login'))
Example #7
Source File: view.py From osm-wikidata with GNU General Public License v3.0 | 5 votes |
def logout(): next_url = request.args.get('next') or url_for('index') flask_login.logout_user() flash('you are logged out') return redirect(next_url)
Example #8
Source File: view.py From osm-wikidata with GNU General Public License v3.0 | 5 votes |
def check_still_auth(): if not g.user.is_authenticated: return r = osm_oauth.api_request('user/details') if r.status_code == 401: flash('Not authenticated with OpenStreetMap') flask_login.logout_user()
Example #9
Source File: login.py From evesrp with BSD 2-Clause "Simplified" License | 5 votes |
def logout(): """Logs the current user out. Redirects to :py:func:`.index`. """ flask_login.logout_user() return redirect(url_for('index'))
Example #10
Source File: user.py From gae-angular-material-starter with MIT License | 5 votes |
def user_reset(token=None): """Verifies user's token from url, if it's valid redirects user to page, where he can set new password""" user_db = model.User.get_by('token', token) if not user_db: flask.flash('Sorry, password reset link is either invalid or expired.') return flask.redirect(flask.url_for('index')) if auth.is_logged_in(): login.logout_user() return flask.redirect(flask.request.path) # note this is url with '#', so it leads to angular state return flask.redirect('%s#!/password/reset/%s' % (flask.url_for('index'), token))
Example #11
Source File: auth.py From gae-angular-material-starter with MIT License | 5 votes |
def signout_user(): """Signs out given user""" login.logout_user()
Example #12
Source File: app.py From vulyk with BSD 3-Clause "New" or "Revised" License | 5 votes |
def logout() -> Response: """ An action-view, signs the user out and redirects to the homepage. :returns: Prepared response. :rtype: Response """ login.logout_user() return flask.redirect(flask.url_for('index'))
Example #13
Source File: app.py From unshred-tag with MIT License | 5 votes |
def logout(): login.logout_user() return redirect(url_for('index'))
Example #14
Source File: views.py From flask-blog with MIT License | 5 votes |
def logout_view(self): login.logout_user() return redirect(url_for('.index')) # Customized User model admin