I am new to uibakery and still learning how to build apps with it. I am coming from a different platform and having some issues porting over some functionality.
In my previous platform this app has a user can create an account with a password, and I would use dcodeIO (https://cdn.jsdelivr.net/gh/dcodeIO/bcrypt.js@3.0.2/index.js) JS library to encrypt the password before storing it in the database. I cannot figure out how to get this library to load.
In my custom code section I have
<script src="https://cdn.jsdelivr.net/gh/dcodeIO/bcrypt.js@3.0.2/index.js"></script>
Then I have tried to reference the functions a number of ways
dcodeIO.bcrypt.compareSync
bcrypt.compareSync
compareSync
but I am always getting an error similar to
**code step**has failed:
{
name: "ReferenceError",
message: "dcodeIO is not defined"
}
I am sure I am just not referencing the syntax correctly somehow, but I can’t seem to figure out what I am doing wrong.
Here is the JS code I am trying to run
const currentUser = await {{actions.PfindUserByEmail.trigger()}}
console.log('checking variables passed',)
console.log('username passed:', currentUser[0].User)
console.log('password passed:', currentUser[0].Password)
console.log('password in form:', {{ui.form.value.Password}})
console.log('about to run is valid',)
const isValid = dcodeIO.bcrypt.compareSync(password, storedpassword);
console.log('finished running valid',)
console.log('is Valid:', isValid)
The script stops execution when trying to invoke the dcodeIO library and everything prior is working as expected.
I am beyond frustrated and hoping someone can help me with some blatantly obvious misuse that I am doing in my implementation.
Please Kindly help!!
Thanks