diff --git a/apps/common/main/lib/view/OpenDialog.js b/apps/common/main/lib/view/OpenDialog.js index e124c45a8..43a8ddf7f 100644 --- a/apps/common/main/lib/view/OpenDialog.js +++ b/apps/common/main/lib/view/OpenDialog.js @@ -95,6 +95,7 @@ define([ this.type = options.type; this.codepages = options.codepages; this.settings = options.settings; + this.validatePwd = options.validatePwd || false; _options.tpl = _.template(this.template)(_options); @@ -104,18 +105,20 @@ define([ Common.UI.Window.prototype.render.call(this); if (this.$window) { + var me = this; this.$window.find('.tool').hide(); this.$window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this)); if (this.type == Asc.c_oAscAdvancedOptionsID.DRM) { this.inputPwd = new Common.UI.InputField({ el: $('#id-password-txt'), type: 'password', - allowBlank: false, - validateOnBlur: false + validateOnBlur: false, + validation : function(value) { + return me.txtIncorrectPwd; + } }); this.$window.find('input').on('keypress', _.bind(this.onKeyPress, this)); } else { - var me = this; this.initCodePages(); this.onPrimary = function() { me.onBtnClick(); @@ -132,6 +135,8 @@ define([ var me = this; setTimeout(function(){ me.inputPwd.cmpEl.find('input').focus(); + if (me.validatePwd) + me.inputPwd.checkValidate(); }, 500); } }, @@ -375,7 +380,8 @@ define([ txtTitle : "Choose %1 options", txtPassword : "Password", txtTitleProtected : "Protected File", - txtOther: 'Other' + txtOther: 'Other', + txtIncorrectPwd: 'Password is incorrect.' }, Common.Views.OpenDialog || {})); }); \ No newline at end of file diff --git a/apps/documenteditor/main/app/controller/Main.js b/apps/documenteditor/main/app/controller/Main.js index 6dff51c7a..b1a7fbcdf 100644 --- a/apps/documenteditor/main/app/controller/Main.js +++ b/apps/documenteditor/main/app/controller/Main.js @@ -1739,6 +1739,7 @@ define([ } else if (type == Asc.c_oAscAdvancedOptionsID.DRM) { dlg = new Common.Views.OpenDialog({ type: type, + validatePwd: !!me._state.isDRM, handler: function (value) { me.isShowOpenDialog = false; if (me && me.api) { @@ -1747,6 +1748,7 @@ define([ } } }); + me._state.isDRM = true; } if (dlg) { this.isShowOpenDialog = true; diff --git a/apps/documenteditor/main/locale/en.json b/apps/documenteditor/main/locale/en.json index fab887550..c8fde3b84 100644 --- a/apps/documenteditor/main/locale/en.json +++ b/apps/documenteditor/main/locale/en.json @@ -179,6 +179,7 @@ "Common.Views.OpenDialog.cancelButtonText": "Cancel", "Common.Views.OpenDialog.okButtonText": "OK", "Common.Views.OpenDialog.txtEncoding": "Encoding ", + "Common.Views.OpenDialog.txtIncorrectPwd": "Password is incorrect.", "Common.Views.OpenDialog.txtPassword": "Password", "Common.Views.OpenDialog.txtTitle": "Choose %1 options", "Common.Views.OpenDialog.txtTitleProtected": "Protected File", diff --git a/apps/presentationeditor/main/app/controller/Main.js b/apps/presentationeditor/main/app/controller/Main.js index 3041f25b2..13228225b 100644 --- a/apps/presentationeditor/main/app/controller/Main.js +++ b/apps/presentationeditor/main/app/controller/Main.js @@ -1605,6 +1605,7 @@ define([ if (type == Asc.c_oAscAdvancedOptionsID.DRM) { dlg = new Common.Views.OpenDialog({ type: type, + validatePwd: !!me._state.isDRM, handler: function (value) { me.isShowOpenDialog = false; if (me && me.api) { @@ -1613,6 +1614,7 @@ define([ } } }); + me._state.isDRM = true; } if (dlg) { this.isShowOpenDialog = true; diff --git a/apps/presentationeditor/main/locale/en.json b/apps/presentationeditor/main/locale/en.json index c1d58396c..ddc4b8a4e 100644 --- a/apps/presentationeditor/main/locale/en.json +++ b/apps/presentationeditor/main/locale/en.json @@ -112,6 +112,7 @@ "Common.Views.OpenDialog.cancelButtonText": "Cancel", "Common.Views.OpenDialog.okButtonText": "OK", "Common.Views.OpenDialog.txtEncoding": "Encoding ", + "Common.Views.OpenDialog.txtIncorrectPwd": "Password is incorrect.", "Common.Views.OpenDialog.txtPassword": "Password", "Common.Views.OpenDialog.txtTitle": "Choose %1 options", "Common.Views.OpenDialog.txtTitleProtected": "Protected File", diff --git a/apps/spreadsheeteditor/main/app/controller/Main.js b/apps/spreadsheeteditor/main/app/controller/Main.js index ec1fef52d..eb21a0a84 100644 --- a/apps/spreadsheeteditor/main/app/controller/Main.js +++ b/apps/spreadsheeteditor/main/app/controller/Main.js @@ -1428,6 +1428,7 @@ define([ } else if (type == Asc.c_oAscAdvancedOptionsID.DRM) { dlg = new Common.Views.OpenDialog({ type: type, + validatePwd: !!me._state.isDRM, handler: function (value) { me.isShowOpenDialog = false; if (me && me.api) { @@ -1436,6 +1437,7 @@ define([ } } }); + me._state.isDRM = true; } if (dlg) { this.isShowOpenDialog = true; diff --git a/apps/spreadsheeteditor/main/locale/en.json b/apps/spreadsheeteditor/main/locale/en.json index 05256a7df..5f7eb38cd 100644 --- a/apps/spreadsheeteditor/main/locale/en.json +++ b/apps/spreadsheeteditor/main/locale/en.json @@ -95,6 +95,7 @@ "Common.Views.OpenDialog.okButtonText": "OK", "Common.Views.OpenDialog.txtDelimiter": "Delimiter", "Common.Views.OpenDialog.txtEncoding": "Encoding ", + "Common.Views.OpenDialog.txtIncorrectPwd": "Password is incorrect.", "Common.Views.OpenDialog.txtOther": "Other", "Common.Views.OpenDialog.txtPassword": "Password", "Common.Views.OpenDialog.txtSpace": "Space",