2017-08-18 15:46:51 +00:00
|
|
|
from django.conf import settings
|
2017-08-17 16:20:18 +00:00
|
|
|
from django.http import HttpResponseServerError
|
2017-08-18 15:46:51 +00:00
|
|
|
from django.shortcuts import render
|
2017-08-17 16:20:18 +00:00
|
|
|
from django.template import RequestContext
|
|
|
|
from django.template import Template
|
|
|
|
from django.template.loader import get_template
|
|
|
|
from django.views import defaults
|
|
|
|
|
2017-08-18 15:46:51 +00:00
|
|
|
from account.forms import LoginEmailForm, LoginUsernameForm, SignupForm
|
2017-08-18 16:26:35 +00:00
|
|
|
from account.views import LoginView
|
2017-08-18 15:46:51 +00:00
|
|
|
|
2017-08-17 16:20:18 +00:00
|
|
|
def server_error(request, template_name=defaults.ERROR_500_TEMPLATE_NAME):
|
|
|
|
t = Template("{%% include '%s' %%}" % template_name)
|
|
|
|
return HttpResponseServerError(t.render(RequestContext(request)))
|
2017-08-18 15:46:51 +00:00
|
|
|
|
|
|
|
|
|
|
|
def account_login(request):
|
|
|
|
|
|
|
|
d = {
|
2017-08-18 16:26:35 +00:00
|
|
|
"login_form": LoginEmailForm(),
|
2017-08-18 15:46:51 +00:00
|
|
|
"signup_form": SignupForm(),
|
|
|
|
"signup_open": getattr(settings, "ACCOUNT_OPEN_SIGNUP", True),
|
|
|
|
}
|
|
|
|
|
|
|
|
print d["signup_open"], settings.ACCOUNT_OPEN_SIGNUP
|
|
|
|
return render(request, "account_login.html", d)
|
2017-08-18 16:26:35 +00:00
|
|
|
|
|
|
|
|
|
|
|
class EmailLoginView(LoginView):
|
|
|
|
form_class = LoginEmailForm
|