Show error when file password is incorrect.
This commit is contained in:
parent
42c08e7b89
commit
0caa6dfb2f
|
@ -95,6 +95,7 @@ define([
|
||||||
this.type = options.type;
|
this.type = options.type;
|
||||||
this.codepages = options.codepages;
|
this.codepages = options.codepages;
|
||||||
this.settings = options.settings;
|
this.settings = options.settings;
|
||||||
|
this.validatePwd = options.validatePwd || false;
|
||||||
|
|
||||||
_options.tpl = _.template(this.template)(_options);
|
_options.tpl = _.template(this.template)(_options);
|
||||||
|
|
||||||
|
@ -104,18 +105,20 @@ define([
|
||||||
Common.UI.Window.prototype.render.call(this);
|
Common.UI.Window.prototype.render.call(this);
|
||||||
|
|
||||||
if (this.$window) {
|
if (this.$window) {
|
||||||
|
var me = this;
|
||||||
this.$window.find('.tool').hide();
|
this.$window.find('.tool').hide();
|
||||||
this.$window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this));
|
this.$window.find('.dlg-btn').on('click', _.bind(this.onBtnClick, this));
|
||||||
if (this.type == Asc.c_oAscAdvancedOptionsID.DRM) {
|
if (this.type == Asc.c_oAscAdvancedOptionsID.DRM) {
|
||||||
this.inputPwd = new Common.UI.InputField({
|
this.inputPwd = new Common.UI.InputField({
|
||||||
el: $('#id-password-txt'),
|
el: $('#id-password-txt'),
|
||||||
type: 'password',
|
type: 'password',
|
||||||
allowBlank: false,
|
validateOnBlur: false,
|
||||||
validateOnBlur: false
|
validation : function(value) {
|
||||||
|
return me.txtIncorrectPwd;
|
||||||
|
}
|
||||||
});
|
});
|
||||||
this.$window.find('input').on('keypress', _.bind(this.onKeyPress, this));
|
this.$window.find('input').on('keypress', _.bind(this.onKeyPress, this));
|
||||||
} else {
|
} else {
|
||||||
var me = this;
|
|
||||||
this.initCodePages();
|
this.initCodePages();
|
||||||
this.onPrimary = function() {
|
this.onPrimary = function() {
|
||||||
me.onBtnClick();
|
me.onBtnClick();
|
||||||
|
@ -132,6 +135,8 @@ define([
|
||||||
var me = this;
|
var me = this;
|
||||||
setTimeout(function(){
|
setTimeout(function(){
|
||||||
me.inputPwd.cmpEl.find('input').focus();
|
me.inputPwd.cmpEl.find('input').focus();
|
||||||
|
if (me.validatePwd)
|
||||||
|
me.inputPwd.checkValidate();
|
||||||
}, 500);
|
}, 500);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -375,7 +380,8 @@ define([
|
||||||
txtTitle : "Choose %1 options",
|
txtTitle : "Choose %1 options",
|
||||||
txtPassword : "Password",
|
txtPassword : "Password",
|
||||||
txtTitleProtected : "Protected File",
|
txtTitleProtected : "Protected File",
|
||||||
txtOther: 'Other'
|
txtOther: 'Other',
|
||||||
|
txtIncorrectPwd: 'Password is incorrect.'
|
||||||
|
|
||||||
}, Common.Views.OpenDialog || {}));
|
}, Common.Views.OpenDialog || {}));
|
||||||
});
|
});
|
|
@ -1739,6 +1739,7 @@ define([
|
||||||
} else if (type == Asc.c_oAscAdvancedOptionsID.DRM) {
|
} else if (type == Asc.c_oAscAdvancedOptionsID.DRM) {
|
||||||
dlg = new Common.Views.OpenDialog({
|
dlg = new Common.Views.OpenDialog({
|
||||||
type: type,
|
type: type,
|
||||||
|
validatePwd: !!me._state.isDRM,
|
||||||
handler: function (value) {
|
handler: function (value) {
|
||||||
me.isShowOpenDialog = false;
|
me.isShowOpenDialog = false;
|
||||||
if (me && me.api) {
|
if (me && me.api) {
|
||||||
|
@ -1747,6 +1748,7 @@ define([
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
me._state.isDRM = true;
|
||||||
}
|
}
|
||||||
if (dlg) {
|
if (dlg) {
|
||||||
this.isShowOpenDialog = true;
|
this.isShowOpenDialog = true;
|
||||||
|
|
|
@ -179,6 +179,7 @@
|
||||||
"Common.Views.OpenDialog.cancelButtonText": "Cancel",
|
"Common.Views.OpenDialog.cancelButtonText": "Cancel",
|
||||||
"Common.Views.OpenDialog.okButtonText": "OK",
|
"Common.Views.OpenDialog.okButtonText": "OK",
|
||||||
"Common.Views.OpenDialog.txtEncoding": "Encoding ",
|
"Common.Views.OpenDialog.txtEncoding": "Encoding ",
|
||||||
|
"Common.Views.OpenDialog.txtIncorrectPwd": "Password is incorrect.",
|
||||||
"Common.Views.OpenDialog.txtPassword": "Password",
|
"Common.Views.OpenDialog.txtPassword": "Password",
|
||||||
"Common.Views.OpenDialog.txtTitle": "Choose %1 options",
|
"Common.Views.OpenDialog.txtTitle": "Choose %1 options",
|
||||||
"Common.Views.OpenDialog.txtTitleProtected": "Protected File",
|
"Common.Views.OpenDialog.txtTitleProtected": "Protected File",
|
||||||
|
|
|
@ -1605,6 +1605,7 @@ define([
|
||||||
if (type == Asc.c_oAscAdvancedOptionsID.DRM) {
|
if (type == Asc.c_oAscAdvancedOptionsID.DRM) {
|
||||||
dlg = new Common.Views.OpenDialog({
|
dlg = new Common.Views.OpenDialog({
|
||||||
type: type,
|
type: type,
|
||||||
|
validatePwd: !!me._state.isDRM,
|
||||||
handler: function (value) {
|
handler: function (value) {
|
||||||
me.isShowOpenDialog = false;
|
me.isShowOpenDialog = false;
|
||||||
if (me && me.api) {
|
if (me && me.api) {
|
||||||
|
@ -1613,6 +1614,7 @@ define([
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
me._state.isDRM = true;
|
||||||
}
|
}
|
||||||
if (dlg) {
|
if (dlg) {
|
||||||
this.isShowOpenDialog = true;
|
this.isShowOpenDialog = true;
|
||||||
|
|
|
@ -112,6 +112,7 @@
|
||||||
"Common.Views.OpenDialog.cancelButtonText": "Cancel",
|
"Common.Views.OpenDialog.cancelButtonText": "Cancel",
|
||||||
"Common.Views.OpenDialog.okButtonText": "OK",
|
"Common.Views.OpenDialog.okButtonText": "OK",
|
||||||
"Common.Views.OpenDialog.txtEncoding": "Encoding ",
|
"Common.Views.OpenDialog.txtEncoding": "Encoding ",
|
||||||
|
"Common.Views.OpenDialog.txtIncorrectPwd": "Password is incorrect.",
|
||||||
"Common.Views.OpenDialog.txtPassword": "Password",
|
"Common.Views.OpenDialog.txtPassword": "Password",
|
||||||
"Common.Views.OpenDialog.txtTitle": "Choose %1 options",
|
"Common.Views.OpenDialog.txtTitle": "Choose %1 options",
|
||||||
"Common.Views.OpenDialog.txtTitleProtected": "Protected File",
|
"Common.Views.OpenDialog.txtTitleProtected": "Protected File",
|
||||||
|
|
|
@ -1428,6 +1428,7 @@ define([
|
||||||
} else if (type == Asc.c_oAscAdvancedOptionsID.DRM) {
|
} else if (type == Asc.c_oAscAdvancedOptionsID.DRM) {
|
||||||
dlg = new Common.Views.OpenDialog({
|
dlg = new Common.Views.OpenDialog({
|
||||||
type: type,
|
type: type,
|
||||||
|
validatePwd: !!me._state.isDRM,
|
||||||
handler: function (value) {
|
handler: function (value) {
|
||||||
me.isShowOpenDialog = false;
|
me.isShowOpenDialog = false;
|
||||||
if (me && me.api) {
|
if (me && me.api) {
|
||||||
|
@ -1436,6 +1437,7 @@ define([
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
me._state.isDRM = true;
|
||||||
}
|
}
|
||||||
if (dlg) {
|
if (dlg) {
|
||||||
this.isShowOpenDialog = true;
|
this.isShowOpenDialog = true;
|
||||||
|
|
|
@ -95,6 +95,7 @@
|
||||||
"Common.Views.OpenDialog.okButtonText": "OK",
|
"Common.Views.OpenDialog.okButtonText": "OK",
|
||||||
"Common.Views.OpenDialog.txtDelimiter": "Delimiter",
|
"Common.Views.OpenDialog.txtDelimiter": "Delimiter",
|
||||||
"Common.Views.OpenDialog.txtEncoding": "Encoding ",
|
"Common.Views.OpenDialog.txtEncoding": "Encoding ",
|
||||||
|
"Common.Views.OpenDialog.txtIncorrectPwd": "Password is incorrect.",
|
||||||
"Common.Views.OpenDialog.txtOther": "Other",
|
"Common.Views.OpenDialog.txtOther": "Other",
|
||||||
"Common.Views.OpenDialog.txtPassword": "Password",
|
"Common.Views.OpenDialog.txtPassword": "Password",
|
||||||
"Common.Views.OpenDialog.txtSpace": "Space",
|
"Common.Views.OpenDialog.txtSpace": "Space",
|
||||||
|
|
Loading…
Reference in a new issue