Exemplo n.º 1
0
def admin_login():
	if request.method == 'POST':
		if not operatorDB.has_user():
			operatorDB.add_user(request.form.get('name', ''),request.form.get('password', ''))
			session['username'] = request.form.get('name', '')
			return redirect(url_for('admin_index'))
		if operatorDB.login_user(request.form.get('name', ''),request.form.get('password', '')):			 
			session['username'] = request.form.get('name', '')
			return redirect(url_for('admin_index'))
	return render_template('admin/login_admin.html',has_user=operatorDB.has_user(),title=u'管理员登录',SITE_TITLE=setting.SITE_TITLE,BASE_URL=setting.BASE_URL)
Exemplo n.º 2
0
def admin_login():
	if request.method == 'POST':
		if not operatorDB.has_user():
			operatorDB.add_user(request.form.get('name', ''),request.form.get('password', ''))
			session['username'] = request.form.get('name', '')
			return redirect(url_for('admin_index'))
		if operatorDB.login_user(request.form.get('name', ''),request.form.get('password', '')):			 
			session['username'] = request.form.get('name', '')
			return redirect(url_for('admin_index'))
	return render_template('admin/login_admin.html',has_user=operatorDB.has_user(),title=u'管理员登录',SITE_TITLE=setting.SITE_TITLE,BASE_URL=setting.BASE_URL)
Exemplo n.º 3
0
def admin_logout():
	session.pop('username', None)
	return render_template('admin/login_admin.html',has_user=operatorDB.has_user(),title=u'管理员登录',SITE_TITLE=setting.SITE_TITLE,BASE_URL=setting.BASE_URL)
Exemplo n.º 4
0
def admin_logout():
	session.pop('username', None)
	return render_template('admin/login_admin.html',has_user=operatorDB.has_user(),title=u'管理员登录',SITE_TITLE=setting.SITE_TITLE,BASE_URL=setting.BASE_URL)