Null checks for encrypt and decrypt functions

This commit is contained in:
David Westgate 2021-03-02 09:13:44 +00:00
parent c4c034efa8
commit c40ff11e49

View File

@ -174,11 +174,17 @@ function getPostData(request) {
}
function encrypt(string){
return CryptoJS.AES.encrypt(string,config.key).toString();
if(string != undefined && string != null)
return CryptoJS.AES.encrypt(string,config.key).toString();
else
return '';
}
function decrypt(string){
return CryptoJS.AES.decrypt(string, config.key).toString(CryptoJS.enc.Utf8);
if(string != undefined && string != null)
return CryptoJS.AES.decrypt(string, config.key).toString(CryptoJS.enc.Utf8);
else
return '';
}
module.exports = {