def logout(): user = current_user user.authenticated = False db.session.add(user) db.session.commit() logout_user() return redirect(url_for('index'))
def handle_request(self, request): """Handle a logout request.""" result = {} logout_user() session.clear() result["method"] = "logout" return jsonify({"result": result})
def logout(): user = current_user user.authenticate(False) logout_user() flash("Logged out successfully.", "success") return redirect(url_for('index'))
def logout(): user = current_user user.authenticated = False db.session.add(user) db.session.commit() logout_user() return render_template("index.html")
def logout(): if not is_logged_in(): flash('Not logged in') else: flash('Logged out successfully') logout_user() return redirect(url_for('login'))
def test_logout_without_current_user(self): with self.app.test_request_context(): login_user(notch) del session['user_id'] with listen_to(user_logged_out) as listener: logout_user() listener.assert_heard_one(self.app, user=ANY)
def logout(): logout_user() if request.args.get('persona', None): return 'OK' else: flash('You are logged out.', 'info') return render_template('user/logout.html', date=today.strftime('%B %d, %Y'),)
def account_signout(): username = current_user.username print 'account_signout:', locals() # flask-login: logout user logout_user() return redirect(url_for(FlaskConfig.LOGIN_VIEW))
def logout(): """ Logs out and redirects to index :rtype: html """ logout_user() return redirect(url_for('index'))
def logout(): """ Logs a user out, regirects to index """ if current_user.is_authenticated(): logout_user() return redirect("/")
def post(self): args = self.get_args() if current_user.is_authenticated(): um.models.UserLog.logout(current_user.id, args['device']) logout_user() return success()
def decorator (*args, **kwargs): if current_user.is_authenticated (): if not WebedLoginManager.is_privileged (): logout_user () ## double check failed! return fn (*args, **kwargs)
def logout(): logout_user() if request.args.get('persona', None): return 'OK' else: flash('Logged out successfully!', 'alert-success') return render_template('users/logout.html')
def user_activate(token): if auth.is_logged_in(): 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, )
def logout(): if g.user.is_authenticated: g.user.last_seen = datetime.utcnow() db.session.add(g.user) db.session.commit() logout_user() return redirect(url_for('index'))
def passwd(): form = EditForm() if form.validate_on_submit() and check_qaptcha(): l = ldap.initialize(LDAP_SERVER) l.simple_bind_s(LDAP_BINDDN, LDAP_BINDPW) [(dn, attrs)] = l.search_s(people_basedn, ldap.SCOPE_ONELEVEL, '(uid=%s)' % (g.user.username), None) if dn: # if user exists passwd_list = attrs['userPassword'][0].split('$') if '{CRYPT}' + crypt.crypt(form.old_password.data, '$' + passwd_list[1] + '$' + passwd_list[2] + '$') == attrs['userPassword'][0]: # if passwd is right old = {'userPassword': attrs['userPassword']} new = {'userPassword': ['{CRYPT}' + crypt.crypt(form.new_password.data, '$6$%s$'%(''.join([random.choice(string.ascii_letters + string.digits) for n in xrange(10)])))]} ldif = modlist.modifyModlist(old, new) l.modify_s(dn, ldif) logout_user() flash('Your password has been reset, please login now.') l.unbind_s() return redirect(url_for('login')) else: # if passwd is wrong flash('Password incorrect!') l.unbind_s() return render_template('passwd.html', form = form, user = g.user) else: flash("User doesn't exist, please login again.") l.unbind_s() return redirect(url_for('login')) return render_template('passwd.html', form = form, user = g.user)
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(): 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, )
def logout(): logout_user() next = flask.request.args.get('next') if not is_safe_url(next): return flask.abort(400) return flask.redirect(next or flask.url_for('index'))
def logout(): if current_user.get_id() in User.users: del User.users[current_user.get_id()] logout_user() return redirect(url_for("index")) else: return redirect(url_for("login"))
def change_password(id): if request.method == 'POST': try: user = SC_User.query.filter_by(id=id).first() if user.login_password == GetStringMD5(request.form['old_password']): user.login_password = GetStringMD5(request.form['login_password']) else: raise Exception # 事务提交 db.session.commit() # 消息闪现 flash('修改密码成功,请重新登录!','success') except: # 回滚 db.session.rollback() logger.exception('exception') # 消息闪现 flash('修改密码失败,为保障账号安全,请重新登录后再尝试修改!','error') logout_user() return redirect("login") else: return render_template("change_password.html")
def change_password(cls): """ Changes the password .. tip:: On changing the password, the user is logged out and the login page is thrown at the user """ form = ChangePasswordForm(request.form) if request.method == 'POST' and form.validate(): if request.nereid_user.match_password(form.old_password.data): cls.write( [request.nereid_user], {'password': form.password.data} ) flash( _('Your password has been successfully changed! ' 'Please login again') ) logout_user() return redirect(url_for('nereid.website.login')) else: flash(_("The current password you entered is invalid")) return render_template( 'change-password.jinja', change_password_form=form )
def handle_request(self, request): """Handle a logout request.""" result = {} logout_user() session.clear() result['method'] = 'logout' return jsonify({'result': result})
def logout(): """Handle logout.""" logout_user() identity_changed.send(current_app._get_current_object(), identity=AnonymousIdentity()) flash("You have been logged out.", category="success") return redirect(url_for('blog.home'))
def logout(): """Logout the current user.""" user = current_user user.authenticated = False user.save() logout_user() return render_template("login.html")
def logout(): logout_user() # notify the change of role identity_changed.send(current_app._get_current_object(), identity=AnonymousIdentity()) return redirect("/")
def logout(): """ End user login session. """ logout_user() flash("You're logged out!", "success") return redirect(url_for('index'))
def logout(): current_user.last_online = datetime.utcnow() current_user.is_online = False db.session.commit() logout_user() flash('Logout successful', 'success') return redirect( url_for('main.index') )
def logout(): """ Logout """ logger.debug('logout()') logout_user() return redirect(url_for('web_app'))
def before_request(): if current_user.is_authenticated() and current_user.is_user() and not current_user.active: logout_user() error(msg=Item.data('active_alert_text', '你的帐号已被封号处理!', name='封号提示')) if current_user.is_authenticated() \ and request.endpoint not in current_app.user_manager.config.allow_oauth_urls \ and not request.path.startswith('/admin'): um = current_app.user_manager model = um.config.oauth_model remember = um.config.oauth_remember um.models.User.heart() if not current_user.is_user(): if model == 'auto': user = um.models.User.from_oauth(current_user) login_user(user, remember=remember) return elif current_user.phone or current_user.email or model == 'auto': return if is_json(): abort(NEED_BIND) query = urlencode(dict(next=request.url)) return redirect('%s?%s' % (current_app.user_manager.config.bind_url, query))
def test_restriction(self): """JSONAlchemy - restriction""" from flask.ext.login import login_user, logout_user from invenio.ext.login.legacy_user import UserInfo from invenio.modules.jsonalchemy.reader import Reader from invenio.modules.jsonalchemy.wrappers import SmartJson blob = {'_id': 1} json = Reader.translate(blob, SmartJson, model='test_access_base', master_format='json', namespace='testsuite') self.assertIsNotNone(json) self.assertTrue('restriction' in json) self.assertTrue('email' in json['restriction']) self.assertTrue(hasattr(json, 'is_authorized')) self.assertEqual(json.is_authorized()[0], 0) self.assertEqual(json.is_authorized(user_info=UserInfo(1))[0], 0) json['restriction']['email'] = UserInfo(1)['email'] self.assertEqual(json.is_authorized()[0], 1) self.assertEqual(json.is_authorized(user_info=UserInfo(1))[0], 0) login_user(UserInfo(1)) self.assertEqual(json.is_authorized()[0], 0) logout_user() self.assertEqual(json.is_authorized()[0], 1)
def signout(): login.logout_user() return flask.redirect(util.param('next') or flask.url_for('signin'))
def logout(): logout_user() return redirect(url_for('login'))
def logout(): session.pop('logged_in', None) logout_user() return redirect(url_for('login'))
def logout(): session.pop('twitter_token', None) session.pop('google_token', None) session.pop('facebook_token', None) logout_user() return redirect('/')
def logout(): logout_user() flash('You have logged out', 'success') return redirect(url_for('index'))
def logout(): logout_user() if is_json_request(): return jsonify(status='success') return redirect(url_for('index'))
def logout(): # Remove and reset the user session logout_user() flash('You have been logged out.') return redirect(url_for('main.index'))
def logout(): logout_user() flash('You were logged out.', 'success') return redirect(url_for('user.login'))
def logout(): logout_user() return redirect(url_for('index'))
def logout(): logout_user() return redirect(url_for("home"))
def logout(): logout_user() flash('Logged out successfully.') return redirect(url_for('.index'))
def logout(): logout_user() flash('You have been logged out.') return redirect(url_for('main.index'))
def logout(): logout_user() flash("You've been logged out! Come back soon!", 'success') return redirect(url_for('index'))
def logout(): logout_user() identity_changed.send(current_app._get_current_object(), identity=AnonymousIdentity()) return redirect(url_for('.login'))
def logout(): print current_user.email logout_user() return "Bye!!!"
def logout(): logout_user() flash('You have been logged out.', 'warning') return redirect(url_for('login'))
def logout(): logout_user() flash('You are logged out.', 'info') return redirect(url_for('public.home'))
def logout(self): logout_user() return redirect(request.referrer or '/')
def logout(): logout_user() flash("You have been logged out.", "success") #session.clear() return redirect(url_for('main.home'))
def logout(): logout_user() flash("You have been logged out.", "success") return redirect(url_for(".home"))
def logout(): if not current_user.is_anonymous: logout_user() return redirect(url_for('home.home'))
def logout(): logout_user() flash("you've been logged out! Come back soon", "success") return redirect(url_for('index'))
def logout(): """Logout current user""" logout_user() return redirect(url_for('index'))
def logout(): logout_user() flash(gettext('Logout successful. See you soon!'), 'success') return redirect(url_for('index'))
def render_logout(): logout_user() return redirect(url_for('log.render_login'))
def logout(): logout_user() return redirect(url_for("login"))
def logout(): logout_user() session.pop('username') return redirect(url_for('login'))
def logout(): logout_user() flash('You are now logged out.') return redirect(request.args.get('next') or url_for('login'))
def signout(): logout_user() flash('Succesfully signed out.', 'positive') return redirect(url_for('index'))
def logout(): logout_user() return redirect(url_for('splash'))