From d5a1ff3f64ec3a5f446f5ae5283526e32c3fc413 Mon Sep 17 00:00:00 2001 From: Vincent Schippefilt Date: Wed, 6 Mar 2019 14:01:55 +0100 Subject: [PATCH] [REF] auth_password_policy: adapt code after jQuery update Part of task 1896658 Co-authored-by: Aaron Bohy Co-authored-by: Christophe Matthieu Co-authored-by: Mathieu Duckerts-Antoine Co-authored-by: David Monjoie Co-authored-by: Martin Geubelle Co-authored-by: svs-odoo Co-authored-by: Vincent Schippefilt --- .../auth_password_policy/static/src/js/change_password.js | 8 ++++---- .../auth_password_policy/static/src/js/password_field.js | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/addons/auth_password_policy/static/src/js/change_password.js b/addons/auth_password_policy/static/src/js/change_password.js index 1a6e7faaafc..0a40f4bd39d 100644 --- a/addons/auth_password_policy/static/src/js/change_password.js +++ b/addons/auth_password_policy/static/src/js/change_password.js @@ -18,16 +18,16 @@ ChangePassword.include({ }).then(function (p) { _this._meter = new Meter(_this, new policy.Policy(p), policy.recommendations); }); - return $.when( + return Promise.all([ this._super.apply(this, arguments), getPolicy - ); + ]); }, start: function () { - return $.when( + return Promise.all([ this._meter.insertAfter(this.$('input[name=new_password]')), this._super() - ); + ]); } }) }); diff --git a/addons/auth_password_policy/static/src/js/password_field.js b/addons/auth_password_policy/static/src/js/password_field.js index fa8cfd20ff2..f0aa2c4420e 100644 --- a/addons/auth_password_policy/static/src/js/password_field.js +++ b/addons/auth_password_policy/static/src/js/password_field.js @@ -28,10 +28,10 @@ var PasswordField = fields.InputField.extend({ }).then(function (p) { _this._meter = new Meter(_this, new policy.Policy(p), policy.recommendations); }); - return $.when( + return Promise.all([ this._super.apply(this, arguments), getPolicy - ); + ]); }, /** * Add a next to the input (TODO: move to template?) @@ -42,7 +42,7 @@ var PasswordField = fields.InputField.extend({ _renderEdit: function () { var _this = this; var meter = this._meter; - return $.when(this._super.apply(this, arguments)).then(function () { + return Promise.resolve(this._super.apply(this, arguments)).then(function () { return meter._widgetRenderAndInsert(function (t) { // insertAfter doesn't work and appendTo means the meter is // ignored (as this.$el is an input[type=password])