Advertisement
gunawantw

check existing password from person NAB

Feb 11th, 2021 (edited)
3,803
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2. Create a Form, name it as "FORM CHANGE PASSWORD"
  3. strExistingPassword = doc.existingPassword(0)
  4. strPassword1 = doc.password1(0)
  5. strPassword2 = doc.password2(0)
  6.  
  7. */
  8.  
  9. ' docPersonDocument is person document from NAB
  10.  
  11.  
  12. Dim strExistingPasswordFromNAB As String
  13. strExistingPasswordFromNAB = docPersonDocument.Httppassword(0)
  14.    
  15. ' strExistingPasswordFromNAB is encrypted
  16.    
  17. Dim strFormulaExistingPassword As String
  18. strFormulaExistingPassword = "@hashpassword(" + Chr(34) + strExistingPassword + Chr(34) + ")"
  19.    
  20. 'strExistingPassword is field value from FORM CHANGE PASSWORD
  21.    
  22. Dim varExistingPassword As Variant
  23. varExistingPassword = Evaluate(strFormulaExistingPassword)
  24.    
  25. '  "$$ existing password is " + varExistingPassword(0)
  26.    
  27. Dim strVerifyPassword As String
  28. strVerifyPassword = "@verifypassword( "+Chr(34)+strExistingPassword+Chr(34)+";"+Chr(34)+strExistingPasswordFromNAB+Chr(34)+" )"
  29.    
  30. Dim varVerify As variant
  31. varVerify = evaluate(strVerifyPassword)
  32.    
  33. ' act = "$$ strVerifyPassword = " + strVerifyPassword
  34.    
  35. act = "result strVerifyPassword " + varVerify(0)
  36. If GlobaldebugFlag Then Call doCreateLogAction(GlobalLogProgramName,act)
  37.    
  38. If varVerify(0) = 0 Then
  39.     'password existing does not match!
  40.     exit sub
  41. End If
  42.    
  43. ' "$$ new password is " + strPassword1
  44.  
  45. Dim strNewPassword As String
  46. strNewPassword = "@hashpassword(" + Chr(34) + strPassword1 + Chr(34) + ")"
  47.    
  48. ' act = "$$ str NewP " + strNewPassword
  49.  
  50.    
  51. Dim varNewPassword As Variant
  52. varNewPassword = Evaluate(strNewPassword)
  53.    
  54. ' act = "new password is " + varNewPassword(0) + "<-- encrypted "
  55.  
  56.  
  57. 'saving / update new password to NAB!
  58. Call docPersonDocument.Replaceitemvalue("HTTPPassword", varNewPassword(0))
  59. Call docPersonDocument.save(True,True)
  60.  
  61.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement