示例#1
0
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)
示例#2
0
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)
示例#3
0
def logout():
	session.pop('logged_in', None)
	flash('You were logged out')
	return redirect(url_for('index'))
示例#4
0
	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)
示例#5
0
def remove_library(id):
	thread.start_new_thread(library.remove_library,(id,))
	return redirect(redirect_url())
示例#6
0
def new_library():
	thread.start_new_thread(library.new_library,(request.form['library_type'], request.form['path'],))
	return redirect(redirect_url())