SetAccountPassword: Difference between revisions
Jump to navigation
Jump to search
No edit summary |
(→Syntax) |
||
Line 4: | Line 4: | ||
==Syntax== | ==Syntax== | ||
<syntaxhighlight lang="lua"> | <syntaxhighlight lang="lua"> | ||
bool setAccountPassword(account theAccount, string password) | bool setAccountPassword ( account theAccount, string password ) | ||
</syntaxhighlight> | </syntaxhighlight> | ||
===Required Arguments=== | ===Required Arguments=== | ||
*'''theAccount:''' the account whos password you want to set | *'''theAccount:''' the account whos password you want to set | ||
*'''password:''' the password | *'''password:''' the password | ||
===Returns=== | ===Returns=== | ||
Returns ''true'' if the password was set correctly, ''false'' otherwise. | Returns ''true'' if the password was set correctly, ''false'' otherwise. | ||
Revision as of 09:56, 13 February 2008
This function sets the password of the specified account.
Syntax
bool setAccountPassword ( account theAccount, string password )
Required Arguments
- theAccount: the account whos password you want to set
- password: the password
Returns
Returns true if the password was set correctly, false otherwise.
Example
This example allows a user to change their password with a command.
function ChangePlayerPassword(player,command,oldpass,newpass) -- get the account the player is currently logged into local account = getClientAccount(player) if (account) then -- if its only a guest account, do not allow the password to be changed if (isGuestAccount(account)) then outputChatBox("You must be logged into an account to change your password.",player) -- end the function return end -- check that the old password is correct local password_check = getAccount(getPlayerUserName(player),oldpass) if (oldpass==password_check) then -- check the length of the new password if (string.len(newpass)>=5) then setAccountPassword(account,newpass) else outputChatBox("Your new password must be at least 5 characters long.",player) end else outputChatBox("Old password invalid.",player) end end addCommandHandler("changepass",ChangePlayerPassword)
See Also
- addAccount
- copyAccountData
- getAccount
- getAccountData
- getAccountName
- getAccountPlayer
- getAccountSerial
- getAccounts
- getAccountsBySerial
- getAllAccountData
- getPlayerAccount
- isGuestAccount
- logIn
- logOut
- removeAccount
- setAccountData
- setAccountPassword
- getAccountByID
- getAccountID
- getAccountIP
- getAccountsByData
- getAccountsByIP
- setAccountName