mirror of
https://github.com/dducret/kopano-webapp-passwd
synced 2026-07-27 18:42:47 +02:00
54 lines
1.6 KiB
JavaScript
54 lines
1.6 KiB
JavaScript
Ext.namespace('Zarafa.plugins.passwd.data');
|
|
|
|
/**
|
|
* @class Zarafa.plugins.passwd.data.ResponseHandler
|
|
* @extends Zarafa.core.data.AbstractResponseHandler
|
|
*
|
|
* Passwd plugin specific response handler.
|
|
*/
|
|
Zarafa.plugins.passwd.data.PasswdResponseHandler = Ext.extend(Zarafa.core.data.AbstractResponseHandler, {
|
|
|
|
/**
|
|
* @cfg {Function} callbackFn The function which will be called after success/failure response.
|
|
*/
|
|
callbackFn : undefined,
|
|
|
|
/**
|
|
* @cfg {Object} scope The function scope that will be used when calling {@link #callbackFn}.
|
|
*/
|
|
scope : undefined,
|
|
|
|
/**
|
|
* In case exception happened on server, server will return exception response with the display message.
|
|
* @param {Object} response Object contained the response data.
|
|
*/
|
|
doError : function(response)
|
|
{
|
|
var displayMessage = dgettext("plugin_passwd", 'An unknown error occurred while changing password.');
|
|
|
|
if(response.info) {
|
|
displayMessage = response.info.display_message;
|
|
}
|
|
|
|
Ext.MessageBox.alert(dgettext("plugin_passwd", 'Error'), displayMessage);
|
|
|
|
this.callbackFn.apply(this.scope || this, [ false, response ]);
|
|
},
|
|
|
|
/**
|
|
* When password change is successfull server will send a success response including display message.
|
|
* @param {Object} response Object contained the response data.
|
|
*/
|
|
doSuccess : function(response)
|
|
{
|
|
var displayMessage = dgettext("plugin_passwd", 'Password is changed successfully.');
|
|
|
|
if(response.info) {
|
|
displayMessage = response.info.display_message;
|
|
}
|
|
|
|
Ext.MessageBox.alert(dgettext("plugin_passwd", 'Success'), displayMessage);
|
|
|
|
this.callbackFn.apply(this.scope || this, [ true, response ]);
|
|
}
|
|
});
|