Show error when file password is incorrect.

This commit is contained in:
Julia Radzhabova 2017-09-06 16:41:53 +03:00
parent 42c08e7b89
commit 0caa6dfb2f
7 changed files with 19 additions and 4 deletions

View file

@ -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 || {}));
});

View file

@ -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;

View file

@ -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",

View file

@ -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;

View file

@ -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",

View file

@ -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;

View file

@ -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",