From 9af7c6cc5d3e26e8b62cb0c39fe1ff9cb230b3db Mon Sep 17 00:00:00 2001 From: John Jarvis Date: Thu, 17 Jan 2013 11:52:58 -0500 Subject: [PATCH] adding login views --- common/djangoapps/student/views.py | 27 ++++++++++++++++++--------- lms/templates/login.html | 8 ++------ lms/templates/register.html | 7 +++++++ lms/urls.py | 2 ++ 4 files changed, 29 insertions(+), 15 deletions(-) create mode 100644 lms/templates/register.html diff --git a/common/djangoapps/student/views.py b/common/djangoapps/student/views.py index 61b49e6022..071a41a834 100644 --- a/common/djangoapps/student/views.py +++ b/common/djangoapps/student/views.py @@ -203,6 +203,22 @@ def _cert_info(user, course, cert_status): return d + +def login(request): + """ + This view will display the non-modal login form + """ + context = {} + return render_to_response('login.html', context) + +def register(request): + """ + This view will display the non-modal registration form + """ + context = {} + return render_to_response('register.html', context) + + @login_required @ensure_csrf_cookie def dashboard(request): @@ -675,18 +691,11 @@ def create_exam_registration(request, post_override=None): username = post_vars['username'] user = User.objects.get(username=username) course_id = post_vars['course_id'] - course = course_from_id(course_id) # assume it will be found.... - - # make sure that any demographic data values received from the page have been stripped. - # Whitespace is not an acceptable response for any of these values - demographic_data = {} - for fieldname in TestCenterUser.user_provided_fields(): - if fieldname in post_vars: - demographic_data[fieldname] = (post_vars[fieldname]).strip() + course = (course_from_id(course_id)) # assume it will be found.... try: testcenter_user = TestCenterUser.objects.get(user=user) - needs_updating = testcenter_user.needs_update(demographic_data) + needs_updating = testcenter_user.needs_update(post_vars) log.info("User {0} enrolled in course {1} {2}updating demographic info for exam registration".format(user.username, course_id, "" if needs_updating else "not ")) except TestCenterUser.DoesNotExist: # do additional initialization here: diff --git a/lms/templates/login.html b/lms/templates/login.html index 22cfc2aa68..3fa28b9f72 100644 --- a/lms/templates/login.html +++ b/lms/templates/login.html @@ -1,10 +1,6 @@ <%inherit file="main.html" /> <%namespace name='static' file='static_content.html'/> +<%block name="title">login -<%block name="title">Login - - - -
-
+Hello world diff --git a/lms/templates/register.html b/lms/templates/register.html new file mode 100644 index 0000000000..82be5db85d --- /dev/null +++ b/lms/templates/register.html @@ -0,0 +1,7 @@ +<%inherit file="main.html" /> + +<%namespace name='static' file='static_content.html'/> +<%block name="title">register + +Hello world + diff --git a/lms/urls.py b/lms/urls.py index ad3b324534..39beeda61d 100644 --- a/lms/urls.py +++ b/lms/urls.py @@ -15,6 +15,8 @@ urlpatterns = ('', url(r'^update_certificate$', 'certificates.views.update_certificate'), url(r'^$', 'branding.views.index', name="root"), # Main marketing page, or redirect to courseware url(r'^dashboard$', 'student.views.dashboard', name="dashboard"), + url(r'^login$', 'student.views.login', name="login"), + url(r'^register$', 'student.views.register', name="register"), url(r'^admin_dashboard$', 'dashboard.views.dashboard'),