Skip to content

app.helper.checkServerConfig() returns true when Emails_CheckServerInfo_Action returns false

This function is used to validate that there is a smtp configuration:

	checkServerConfig : function(module){
		var aDeferred = jQuery.Deferred();
		var actionParams = {
			"action": 'CheckServerInfo',
			'module' : module
		};
		app.request.post({data:actionParams}).then(
			function(err,data) {
				var state = false;
				if(err === null){
					state = true;
				} else {
					state = false;
				}
				aDeferred.resolve(state);
			}
		);
		return aDeferred.promise();
	},

In that logic, if there is no error in the post request (an Exception for example), it is assumed that state = true, when in fact, it could be true or false. Instead or setting state=true, it should be state=data.

The consequence is that, when you have no smtp configuration, that function will return true when it should return false.

Edited by Prasad