app/views/sessions/restore_password.html.erb
<% @page_title = t('restore_password.page_title') %>
<% javascript_tag do -%>
Ext.onReady(function() {
var restorePasswordAction = function() {
restorePasswordForm.getForm().submit({
waitMsg: '<%= tjs('form.loading') %>',
success: function(form, action) {
Ext.MessageBox.show({
msg: action.result.message,
buttons: Ext.MessageBox.OK,
icon: Ext.MessageBox.INFO,
fn: function() {
document.location.href = '<%= login_path %>';
}
});
},
failure: function(form, action) {
Owp.form.errorHandler(form, action);
}
});
}
var restorePasswordForm = new Owp.form.BasicForm({
labelWidth: 100,
waitMsgTarget: !Ext.isGecko,
url: '<%= restore_password_path %>',
bodyStyle: 'padding: 15px 15px 0',
keys: [{
key: Ext.EventObject.ENTER,
fn: restorePasswordAction
}],
items: [{
fieldLabel: '<%= tjs('restore_password.username') %>',
name: 'login',
id: 'login',
width: 210,
allowBlank: false
}]
});
var restorePasswordWindow = new Owp.form.BasicFormWindow({
applyTo: 'restore-password-window',
title: '<%= tjs('restore_password.window_title') %>',
iconCls: 'icon-window-restore-password',
width: 380,
autoHeight: true,
y: 150,
closable: false,
resizable: false,
draggable: false,
plain: true,
items: restorePasswordForm,
buttons: [{
text: '<%= tjs('form.button.back') %>',
iconCls: 'icon-button-back',
handler: function() {
document.location.href = '<%= login_path %>';
}
}, {
text: '<%= tjs('restore_password.button_restore') %>',
iconCls: 'icon-button-restore-password',
handler: restorePasswordAction
}]
});
restorePasswordWindow.show();
});
<% end -%>
<div id='restore-password-window'></div>