[IMP] change_password is now a client_action
bzr revid: al@openerp.com-20120808192855-dq2aje2qq7sqq2mc
This commit is contained in:
parent
9c905bace9
commit
4d88bff8dd
|
@ -661,6 +661,37 @@ instance.web.Home = instance.web.Widget.extend({
|
|||
});
|
||||
instance.web.client_actions.add("home", "instance.web.Home");
|
||||
|
||||
instance.web.ChangePassword = instance.web.Widget.extend({
|
||||
template: "ChangePassword",
|
||||
start: function() {
|
||||
var self = this;
|
||||
self.$element.find("form[name=change_password_form]").validate({
|
||||
submitHandler: function (form) {
|
||||
self.rpc("/web/session/change_password",{
|
||||
'fields': $(form).serializeArray()
|
||||
}, function(result) {
|
||||
if (result.error) {
|
||||
self.display_error(result);
|
||||
return;
|
||||
} else {
|
||||
instance.webclient.on_logout();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
display_error: function (error) {
|
||||
return instance.web.dialog($('<div>'), {
|
||||
modal: true,
|
||||
title: error.title,
|
||||
buttons: [
|
||||
{text: _("Ok"), click: function() { $(this).dialog("close"); }}
|
||||
]
|
||||
}).html(error.error);
|
||||
},
|
||||
})
|
||||
instance.web.client_actions.add("change_password", "instance.web.ChangePassword");
|
||||
|
||||
instance.web.Menu = instance.web.Widget.extend({
|
||||
template: 'Menu',
|
||||
init: function() {
|
||||
|
@ -828,37 +859,6 @@ instance.web.UserMenu = instance.web.Widget.extend({
|
|||
}
|
||||
});
|
||||
},
|
||||
change_password :function() {
|
||||
var self = this;
|
||||
this.dialog = new instance.web.Dialog(this, {
|
||||
title: _t("Change Password"),
|
||||
width : 'auto'
|
||||
}).open();
|
||||
this.dialog.$element.html(QWeb.render("UserMenu.password", self));
|
||||
this.dialog.$element.find("form[name=change_password_form]").validate({
|
||||
submitHandler: function (form) {
|
||||
self.rpc("/web/session/change_password",{
|
||||
'fields': $(form).serializeArray()
|
||||
}, function(result) {
|
||||
if (result.error) {
|
||||
self.display_error(result);
|
||||
return;
|
||||
} else {
|
||||
instance.webclient.on_logout();
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
display_error: function (error) {
|
||||
return instance.web.dialog($('<div>'), {
|
||||
modal: true,
|
||||
title: error.title,
|
||||
buttons: [
|
||||
{text: _("Ok"), click: function() { $(this).dialog("close"); }}
|
||||
]
|
||||
}).html(error.error);
|
||||
},
|
||||
do_update: function () {
|
||||
var self = this;
|
||||
var fct = function() {
|
||||
|
|
|
@ -271,6 +271,31 @@
|
|||
</div>
|
||||
</t>
|
||||
|
||||
<t t-name="ChangePassword">
|
||||
<form name="change_password_form" method="POST">
|
||||
<table align="center">
|
||||
<tr>
|
||||
<td><label for="old_pwd">Old Password:</label></td>
|
||||
<td><input type="password" name="old_pwd"
|
||||
minlength="1" autofocus="autofocus"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="new_password">New Password:</label></td>
|
||||
<td><input type="password" name="new_password"
|
||||
minlength="1" autofocus="autofocus"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="confirm_pwd">Confirm Password:</label></td>
|
||||
<td><input type="password" name="confirm_pwd"
|
||||
minlength="1"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right"><button class="oe_button">Change Password</button></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</t>
|
||||
|
||||
<t t-name="Menu">
|
||||
<ul class="oe_menu" t-if="widget.data">
|
||||
<li t-foreach="widget.data.data.children" t-as="menu">
|
||||
|
@ -351,30 +376,6 @@
|
|||
</div>
|
||||
|
||||
</t>
|
||||
<t t-name="UserMenu.password">
|
||||
<form name="change_password_form" method="POST">
|
||||
<table align="center">
|
||||
<tr>
|
||||
<td><label for="old_pwd">Old Password:</label></td>
|
||||
<td><input type="password" name="old_pwd"
|
||||
minlength="1" autofocus="autofocus"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="new_password">New Password:</label></td>
|
||||
<td><input type="password" name="new_password"
|
||||
minlength="1" autofocus="autofocus"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><label for="confirm_pwd">Confirm Password:</label></td>
|
||||
<td><input type="password" name="confirm_pwd"
|
||||
minlength="1"/></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right"><button class="oe_button">Change Password</button></td>
|
||||
</tr>
|
||||
</table>
|
||||
</form>
|
||||
</t>
|
||||
|
||||
<t t-name="WebClient">
|
||||
<div class="openerp openerp_webclient_container">
|
||||
|
|
Loading…
Reference in New Issue