diff --git a/common/static/js/spec_helpers/edx.utils.validate.js b/common/static/js/spec_helpers/edx.utils.validate.js index 293d881ee7..2e79413c7c 100644 --- a/common/static/js/spec_helpers/edx.utils.validate.js +++ b/common/static/js/spec_helpers/edx.utils.validate.js @@ -18,6 +18,11 @@ var edx = edx || {}; }, charLength: function( $el ) { + var type = $el.attr("type"); + if (type !== "text" && type !== "textarea" && type !== "password") { + return true; + } + // Cannot assume there will be both min and max var min = $el.attr('minlength') || 0, max = $el.attr('maxlength') || false, @@ -35,7 +40,12 @@ var edx = edx || {}; }, required: function( $el ) { - return $el.attr('required') ? $el.val() : true; + if ($el.attr("type") === "checkbox") { + return $el.attr('required') ? $el.prop("checked") : true; + } + else { + return $el.attr('required') ? $el.val() : true; + } }, email: { @@ -66,6 +76,6 @@ var edx = edx || {}; })(); - edx.utils.validate = utils.validate + edx.utils.validate = utils.validate; })( jQuery, _ ); \ No newline at end of file diff --git a/lms/djangoapps/student_account/urls.py b/lms/djangoapps/student_account/urls.py index 73afe129ea..6f7e5aa3e4 100644 --- a/lms/djangoapps/student_account/urls.py +++ b/lms/djangoapps/student_account/urls.py @@ -6,6 +6,7 @@ urlpatterns = patterns( 'student_account.views', url(r'^login/$', 'login_and_registration_form', {'initial_mode': 'login'}, name='account_login'), url(r'^register/$', 'login_and_registration_form', {'initial_mode': 'register'}, name='account_register'), + url(r'^password$', 'password_change_request_handler', name='password_change_request'), ) if settings.FEATURES.get('ENABLE_NEW_DASHBOARD'): @@ -14,5 +15,4 @@ if settings.FEATURES.get('ENABLE_NEW_DASHBOARD'): url(r'^$', 'index', name='account_index'), url(r'^email$', 'email_change_request_handler', name='email_change_request'), url(r'^email/confirmation/(?P[^/]*)$', 'email_change_confirmation_handler', name='email_change_confirm'), - url(r'^password$', 'password_change_request_handler', name='password_change_request'), ) diff --git a/lms/envs/common.py b/lms/envs/common.py index 2769f413d9..b44c383391 100644 --- a/lms/envs/common.py +++ b/lms/envs/common.py @@ -286,7 +286,7 @@ FEATURES = { 'ENABLE_VIDEO_ABSTRACTION_LAYER_API': False, # Enable the new dashboard, account, and profile pages - 'ENABLE_NEW_DASHBOARD': True, + 'ENABLE_NEW_DASHBOARD': False, } # Ignore static asset files on import which match this pattern @@ -1036,6 +1036,7 @@ student_account_js = [ 'js/student_account/views/AccessView.js', 'js/student_account/accessApp.js', ] + student_profile_js = sorted(rooted_glob(PROJECT_ROOT / 'static', 'js/student_profile/**/*.js')) PIPELINE_CSS = { diff --git a/lms/static/js/spec/main.js b/lms/static/js/spec/main.js index 30ce47a9e9..f5ecdb181a 100644 --- a/lms/static/js/spec/main.js +++ b/lms/static/js/spec/main.js @@ -216,6 +216,7 @@ exports: 'js/student_account/account', deps: ['jquery', 'underscore', 'backbone', 'gettext', 'jquery.cookie'] }, + 'js/student_profile/profile': { exports: 'js/student_profile/profile', deps: ['jquery', 'underscore', 'backbone', 'gettext', 'jquery.cookie'] @@ -231,6 +232,7 @@ exports: 'js/dashboard/donation', deps: ['jquery', 'underscore', 'gettext'] }, + // Backbone classes loaded explicitly until they are converted to use RequireJS 'js/models/cohort': { exports: 'CohortModel', @@ -257,7 +259,42 @@ 'js/views/notification': { exports: 'NotificationView', deps: ['backbone', 'jquery', 'underscore'] - } + }, + + // Student account registration/login + // Loaded explicitly until these are converted to RequireJS + 'js/student_account/models/LoginModel': { + exports: 'js/student_account/models/LoginModel', + deps: ['jquery', 'underscore', 'backbone', 'gettext', 'jquery.cookie'] + }, + 'js/student_account/views/LoginView': { + exports: 'js/student_account/views/LoginView', + deps: ['js/student_account/models/LoginModel'] + }, + 'js/student_account/models/PasswordResetModel': { + exports: 'js/student_account/models/PasswordResetModel', + deps: ['jquery', 'underscore', 'backbone', 'gettext', 'jquery.cookie'] + }, + 'js/student_account/views/PasswordResetView': { + exports: 'js/student_account/views/PasswordResetView', + deps: ['js/student_account/models/PasswordResetModel'] + }, + 'js/student_account/models/RegisterModel': { + exports: 'js/student_account/models/RegisterModel', + deps: ['jquery', 'underscore', 'backbone', 'gettext', 'jquery.cookie'] + }, + 'js/student_account/views/RegisterView': { + exports: 'js/student_account/views/RegisterView', + deps: ['js/student_account/models/RegisterModel'] + }, + 'js/student_account/views/AccessView': { + exports: 'js/student_account/views/AccessView', + deps: [ + 'js/student_account/views/LoginView', + 'js/student_account/views/PasswordResetView', + 'js/student_account/views/RegisterView' + ] + }, }, }); @@ -270,7 +307,11 @@ 'lms/include/js/spec/views/notification_spec.js', 'lms/include/js/spec/dashboard/donation.js', 'lms/include/js/spec/student_account/account.js', - 'lms/include/js/spec/student_profile/profile.js' + 'lms/include/js/spec/student_account/access_spec.js', + 'lms/include/js/spec/student_account/login_spec.js', + 'lms/include/js/spec/student_account/register_spec.js', + 'lms/include/js/spec/student_account/password_reset_spec.js', + 'lms/include/js/spec/student_profile/profile.js', ]); }).call(this, requirejs, define); diff --git a/lms/static/js/spec/student_account/access_spec.js b/lms/static/js/spec/student_account/access_spec.js new file mode 100644 index 0000000000..2ddb09ae27 --- /dev/null +++ b/lms/static/js/spec/student_account/access_spec.js @@ -0,0 +1,19 @@ +define(['js/student_account/views/AccessView'], + function() { + 'use strict'; + + describe("edx.student.account.AccessView", function() { + it("initially displays the correct form", function() { + // TODO + }); + + it("toggles between the login and registration forms", function() { + // TODO + }); + + it("displays the reset password form", function() { + // TODO + }); + }); + } +); \ No newline at end of file diff --git a/lms/static/js/spec/student_account/login_spec.js b/lms/static/js/spec/student_account/login_spec.js new file mode 100644 index 0000000000..010c94d65d --- /dev/null +++ b/lms/static/js/spec/student_account/login_spec.js @@ -0,0 +1,39 @@ +define(['js/student_account/views/LoginView'], + function() { + 'use strict'; + + describe("edx.student.account.LoginView", function() { + it("logs the user in", function() { + // TODO + }); + + it("displays third party auth login buttons", function() { + // TODO + }); + + it("validates the email field", function() { + // TODO + }); + + it("validates the password field", function() { + // TODO + }); + + it("displays login errors", function() { + // TODO + }); + + it("displays an error if the form definition could not be loaded", function() { + // TODO + }); + + it("displays an error if the server could not be contacted while logging in", function() { + // TODO + }); + + it("allows the user to navigate to the password assistance form", function() { + // TODO + }); + }); + } +); \ No newline at end of file diff --git a/lms/static/js/spec/student_account/password_reset_spec.js b/lms/static/js/spec/student_account/password_reset_spec.js new file mode 100644 index 0000000000..c57be639a5 --- /dev/null +++ b/lms/static/js/spec/student_account/password_reset_spec.js @@ -0,0 +1,23 @@ +define(['js/student_account/views/PasswordResetView'], + function() { + 'use strict'; + + describe("edx.student.account.PasswordResetView", function() { + it("allows the user to request a new password", function() { + // TODO + }); + + it("validates the email field", function() { + // TODO + }); + + it("displays password reset errors", function() { + // TODO + }); + + it("displays an error if the server could not be contacted", function() { + // TODO + }); + }); + } +); \ No newline at end of file diff --git a/lms/static/js/spec/student_account/register_spec.js b/lms/static/js/spec/student_account/register_spec.js new file mode 100644 index 0000000000..5402de348e --- /dev/null +++ b/lms/static/js/spec/student_account/register_spec.js @@ -0,0 +1,31 @@ +define(['js/student_account/views/RegisterView'], + function() { + 'use strict'; + + describe("edx.student.account.RegisterView", function() { + it("registers a new user", function() { + // TODO + }); + + it("displays third party auth registration buttons", function() { + // TODO + }); + + it("validates form fields", function() { + // TODO + }); + + it("displays registration errors", function() { + // TODO + }); + + it("displays an error if the form definition could not be loaded", function() { + // TODO + }); + + it("displays an error if the server could not be contacted while registering", function() { + // TODO + }); + }); + } +); \ No newline at end of file diff --git a/lms/templates/student_account/login.underscore b/lms/templates/student_account/login.underscore index 1aadf57f20..363d06196e 100644 --- a/lms/templates/student_account/login.underscore +++ b/lms/templates/student_account/login.underscore @@ -7,6 +7,4 @@ <%= fields %> - - \ No newline at end of file diff --git a/lms/templates/student_account/register.underscore b/lms/templates/student_account/register.underscore index 874d72530d..3d4371fdde 100644 --- a/lms/templates/student_account/register.underscore +++ b/lms/templates/student_account/register.underscore @@ -5,11 +5,6 @@

Please enter a valid password

- - - <%= fields %> - - \ No newline at end of file