def login(): error = None if request.method == 'POST': if request.form['username'] != app.config['USERNAME']: error = 'Invalid username' elif request.form['password'] != app.config['PASSWORD']: error = 'Invalid password' else: session['logged_in'] = True flash('You were logged in') return redirect(url_for('index')) return render_template('login.html', error=error)
def update_config(): f = request.form keys = f.keys() values = f.values() logging.debug('keys: ' + str(keys)) logging.debug('values: ' + str(values)) for config_id in keys: value = f.getlist(config_id)[0] config.set_config(config_id, value) return redirect(request.referrer)
def logout(): session.pop('logged_in', None) flash('You were logged out') return redirect(url_for('index'))
def decorated_function(*args, **kwargs): if session.get('logged_in') is not True: return redirect(url_for('login', next=request.url)) return f(*args, **kwargs)
def remove_library(id): thread.start_new_thread(library.remove_library,(id,)) return redirect(redirect_url())
def new_library(): thread.start_new_thread(library.new_library,(request.form['library_type'], request.form['path'],)) return redirect(redirect_url())