##// END OF EJS Templates
Merged in 2.0 branch
Merged in 2.0 branch

File last commit:

r747:668c0b11 merge default
r747:668c0b11 merge default
Show More
login.py
33 lines | 982 B | text/x-python | PythonLexer
neko259
Added login and logout for moderators
r729 from django.shortcuts import render, redirect
neko259
Divided settings manager into base settings manager class and session-based settings manager. This allowes to add other backends to the settings manager
r730 from boards.abstracts.settingsmanager import PERMISSION_MODERATE, \
get_settings_manager
neko259
Added login and logout for moderators
r729 from boards.forms import LoginForm, PlainErrorList
from boards.views.base import BaseBoardView, CONTEXT_FORM
__author__ = 'neko259'
class LoginView(BaseBoardView):
def get(self, request, form=None):
context = self.get_context_data(request=request)
if not form:
form = LoginForm()
context[CONTEXT_FORM] = form
return render(request, 'boards/login.html', context)
def post(self, request):
form = LoginForm(request.POST, request.FILES,
error_class=PlainErrorList)
form.session = request.session
if form.is_valid():
neko259
Divided settings manager into base settings manager class and session-based settings manager. This allowes to add other backends to the settings manager
r730 settings_manager = get_settings_manager(request)
neko259
Added login and logout for moderators
r729 settings_manager.add_permission(PERMISSION_MODERATE)
return redirect('index')
else:
return self.get(request, form)