Coronium server side change password is not working

Hi,

I am trying to change password for a given user using the server side API - coronium.user.modifyUser( userId, modificationData )  as given in http://docs.coronium.io/en/latest/server/Users/

The code is failing on the following line - when calling encode_b64 function

password = coronium.utils.encode_b64( "string_password " )

The error message is: 

2016/03/22 13:53:57 [error] 842#0: *26117 lua entry thread aborted: runtime error: /home/coronium/lua/updateuser.lua:15: attempt to call field ‘encode_b64’ (a nil value)

Do I need to install some package on coronium server to get coronium.utils.encode_b64() ?

I tried using  coronium.utils.encode_base64() or mime.base64() or  ngx.encode_base64() also. That didn’t give nil value and password was changed. But then loginUser() didn’t work with that password.

I am not doing double base64 encoding also.

Please help.

Thanks

Regards,

Samir Jain

I was able to solve this problem after looking at the source code of mod_user.lua. So this issue is resolved:

This is how my server side code

local crypto = require(“mod_crypto”);

local newpassword = crypto.digest(newpassword);

answer = coronium.user.modifyUser( objectId, { password = newpassword } );

Thanks

I was able to solve this problem after looking at the source code of mod_user.lua. So this issue is resolved:

This is how my server side code

local crypto = require(“mod_crypto”);

local newpassword = crypto.digest(newpassword);

answer = coronium.user.modifyUser( objectId, { password = newpassword } );

Thanks