Verifies a plain string value against a hashed value.
Parameter |
Description |
password |
The plain value. |
hashedpassword |
The hashed value. |
Return value |
Description |
boolean |
- true if the plain value converts to the same hashed value
- false if the plain value does not convert to the same hashed value
|
Examples
This button is for a page where the
user enters values for a new password and its verification. The code
hashes the text password then verifies the text verification against
the hashed value.
var cpw = document1.getItemValueString("passwordCreate");
var vpw = document1.getItemValueString("passwordVerification");
if (cpw.length < 6 || vpw.length < 6) {
requestScope.status = "Password must be at least 6 characters";
} else {
var pw = session.hashPassword(cpw);
if (session.verifyPassword(vpw, pw)) {
document1.replaceItemValue("password", pw);
document1.save();
requestScope.status = "Password accepted";
} else {
requestScope.status = "Password verification failed";
}
}