ECOM-369 added forgot password flow plugged in to Renzo's API
This commit is contained in:
@@ -286,7 +286,7 @@ FEATURES = {
|
||||
'ENABLE_VIDEO_ABSTRACTION_LAYER_API': False,
|
||||
|
||||
# Enable the new dashboard, account, and profile pages
|
||||
'ENABLE_NEW_DASHBOARD': False,
|
||||
'ENABLE_NEW_DASHBOARD': True,
|
||||
}
|
||||
|
||||
# Ignore static asset files on import which match this pattern
|
||||
|
||||
@@ -12,7 +12,7 @@ var edx = edx || {};
|
||||
email: ''
|
||||
},
|
||||
|
||||
urlRoot: '/resetMe',
|
||||
urlRoot: '/account/password',
|
||||
|
||||
sync: function(method, model) {
|
||||
var headers = {
|
||||
@@ -27,9 +27,6 @@ var edx = edx || {};
|
||||
headers: headers
|
||||
})
|
||||
.done(function() {
|
||||
var query = window.location.search,
|
||||
url = '/dashboard';
|
||||
|
||||
model.trigger('success');
|
||||
})
|
||||
.fail( function( error ) {
|
||||
|
||||
@@ -57,22 +57,10 @@ var edx = edx || {};
|
||||
this.subview.register = new edx.student.account.RegisterView();
|
||||
} else if ( type === 'reset' ) {
|
||||
this.subview.passwordHelp = new edx.student.account.PasswordResetView();
|
||||
|
||||
// Listen for 'password-reset' event to toggle sub-views
|
||||
this.listenTo( this.subview.passwordHelp, 'password-reset', this.removePasswordView);
|
||||
}
|
||||
},
|
||||
|
||||
removePasswordView: function() {
|
||||
this.$header.removeClass('hidden');
|
||||
$(this.el).find('.form-type').removeClass('hidden');
|
||||
|
||||
// User should only have to submit reset once so remove view
|
||||
this.subview.passwordHelp.remove();
|
||||
},
|
||||
|
||||
resetPassword: function() {
|
||||
console.log( this.$header );
|
||||
this.$header.addClass('hidden');
|
||||
$(this.el).find('.form-type').addClass('hidden');
|
||||
this.loadForm('reset');
|
||||
@@ -90,15 +78,6 @@ var edx = edx || {};
|
||||
$form.removeClass('hidden');
|
||||
},
|
||||
|
||||
getModel: function( type ) {
|
||||
var models = {
|
||||
join: app.JoinModel,
|
||||
login: app.JoinModel
|
||||
};
|
||||
|
||||
return models[type] ? new models[type]() : false;
|
||||
},
|
||||
|
||||
form: {
|
||||
isLoaded: function( $form ) {
|
||||
return $form.html().length > 0;
|
||||
|
||||
@@ -24,7 +24,7 @@ var edx = edx || {};
|
||||
|
||||
$form: {},
|
||||
|
||||
initialize: function( obj ) {
|
||||
initialize: function() {
|
||||
this.getInitialData();
|
||||
},
|
||||
|
||||
@@ -66,7 +66,7 @@ var edx = edx || {};
|
||||
});
|
||||
},
|
||||
|
||||
initModel: function( url, method ) {
|
||||
initModel: function( url ) {
|
||||
this.model = new edx.student.account.LoginModel({
|
||||
url: url
|
||||
});
|
||||
|
||||
@@ -25,7 +25,7 @@ var edx = edx || {};
|
||||
|
||||
$form: {},
|
||||
|
||||
initialize: function( obj ) {
|
||||
initialize: function() {
|
||||
var fields = this.buildForm([{
|
||||
label: 'E-mail',
|
||||
instructions: 'This is the e-mail address you used to register with edX',
|
||||
@@ -34,7 +34,7 @@ var edx = edx || {};
|
||||
type: 'email',
|
||||
restrictions: []
|
||||
}]);
|
||||
console.log('PasswordResetView INIT');
|
||||
|
||||
this.initModel();
|
||||
this.render( fields );
|
||||
},
|
||||
@@ -61,13 +61,12 @@ console.log('PasswordResetView INIT');
|
||||
this.listenTo( this.model, 'success', this.resetComplete) ;
|
||||
},
|
||||
|
||||
initModel: function( url, method ) {
|
||||
console.log('init the password reset model');
|
||||
/*this.model = new edx.student.account.PasswordResetModel();
|
||||
initModel: function() {
|
||||
this.model = new edx.student.account.PasswordResetModel();
|
||||
|
||||
this.listenTo( this.model, 'error', function( error ) {
|
||||
console.log(error.status, ' error: ', error.responseText);
|
||||
});*/
|
||||
});
|
||||
},
|
||||
|
||||
buildForm: function( data ) {
|
||||
@@ -75,14 +74,14 @@ console.log('PasswordResetView INIT');
|
||||
i,
|
||||
len = data.length,
|
||||
fieldTpl = this.fieldTpl;
|
||||
console.log('buildForm ', data);
|
||||
|
||||
for ( i=0; i<len; i++ ) {
|
||||
html.push( _.template( fieldTpl, $.extend( data[i], {
|
||||
form: 'reset-password'
|
||||
}) ) );
|
||||
}
|
||||
|
||||
this.render( html.join('') );
|
||||
return html.join('');
|
||||
},
|
||||
|
||||
getFormData: function() {
|
||||
@@ -118,7 +117,10 @@ console.log('buildForm ', data);
|
||||
},
|
||||
|
||||
resetComplete: function() {
|
||||
this.trigger('password-reset');
|
||||
var $el = $(this.el);
|
||||
|
||||
$el.find('#password-reset-form').addClass('hidden');
|
||||
$el.find('.js-reset-success').removeClass('hidden');
|
||||
},
|
||||
|
||||
submitForm: function( event ) {
|
||||
@@ -126,8 +128,6 @@ console.log('buildForm ', data);
|
||||
|
||||
event.preventDefault();
|
||||
|
||||
// console.log(this.model);
|
||||
|
||||
if ( !this.errors.length ) {
|
||||
console.log('save me');
|
||||
this.model.set( data );
|
||||
|
||||
@@ -23,7 +23,7 @@ var edx = edx || {};
|
||||
|
||||
$form: {},
|
||||
|
||||
initialize: function( obj ) {
|
||||
initialize: function() {
|
||||
this.getInitialData();
|
||||
},
|
||||
|
||||
@@ -65,7 +65,7 @@ var edx = edx || {};
|
||||
});
|
||||
},
|
||||
|
||||
initModel: function( url, method ) {
|
||||
initModel: function( url ) {
|
||||
this.model = new edx.student.account.RegisterModel({
|
||||
url: url
|
||||
});
|
||||
|
||||
@@ -5,6 +5,16 @@
|
||||
@include span-columns(6);
|
||||
@include shift(3);
|
||||
|
||||
input:-webkit-autofill {
|
||||
-webkit-box-shadow:0 0 0 50px white inset;
|
||||
-webkit-text-fill-color: #333;
|
||||
}
|
||||
|
||||
input:-webkit-autofill:focus {
|
||||
-webkit-box-shadow: white, 0 0 0 50px white inset;
|
||||
-webkit-text-fill-color: #333;
|
||||
}
|
||||
|
||||
.form-field {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
@@ -15,7 +15,13 @@
|
||||
|
||||
<%= fields %>
|
||||
|
||||
<button class="action action-primary action-update js-reset">Create My edX Account</button>
|
||||
<button class="action action-primary action-update js-reset">Reset my password</button>
|
||||
</form>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="js-reset-success hidden">
|
||||
<h2>Password Reset Successful</h2>
|
||||
<p>We've e-mailed you instructions for setting your password to the e-mail address you submitted. You should be receiving it shortly.</p>
|
||||
</div>
|
||||
</section>
|
||||
@@ -1,4 +1,4 @@
|
||||
<form id="register">
|
||||
<form id="register" autocomplete="off">
|
||||
<div class="error-msg hidden">
|
||||
<h4>An error occured in your registration.</h4>
|
||||
<div class="errors">
|
||||
|
||||
Reference in New Issue
Block a user