PasswordVerify: Difference between revisions

From Multi Theft Auto: Wiki
Jump to navigation Jump to search
(Created page with "__NOTOC__ {{Shared function}} {{Note box|Using '''passwordHash''' is the recommended way of storing passwords.}} {{New feature/item|3.0154|1.5.4|11277| This function verifies...")
 
m (add callback functionality)
Line 7: Line 7:
==Syntax==  
==Syntax==  
<syntaxhighlight lang="lua">
<syntaxhighlight lang="lua">
bool passwordVerify ( string password, string hash )   
bool passwordVerify ( string password, string hash[, function callback] )   
</syntaxhighlight>  
</syntaxhighlight>  


Line 14: Line 14:
*'''hash:''' A supported hash (see [[passwordHash]])
*'''hash:''' A supported hash (see [[passwordHash]])


===Optional Arguments===
{{New feature/item|3.0154|1.5.4|11281|
*'''callback:''' providing a callback will run this function asynchronously, the arguments to the callback are the same as the returned values below.
}}
===Returns===
===Returns===
Returns true if the password matches the hash. Returns false if the password does not match, or if an unknown hash was passed.
Returns true if the password matches the hash. Returns false if the password does not match, or if an unknown hash was passed. If a callback was provided, the aforementioned values are arguments to the callback, and this function will always return ''true''.


==Example==  
==Example==  

Revision as of 18:46, 19 April 2017

This template is no longer in use as it results in poor readability. This function verifies whether a password matches a password hash.

Syntax

bool passwordVerify ( string password, string hash[, function callback] )  

Required Arguments

  • password: The password to check.
  • hash: A supported hash (see passwordHash)

Optional Arguments

  • callback: providing a callback will run this function asynchronously, the arguments to the callback are the same as the returned values below.

Returns

Returns true if the password matches the hash. Returns false if the password does not match, or if an unknown hash was passed. If a callback was provided, the aforementioned values are arguments to the callback, and this function will always return true.

Example

Accessories-text-editor.png Script Example Missing Function PasswordVerify needs a script example, help out by writing one.

Before submitting check out Editing Guidelines Script Examples.
-- TODO


See Also