Andrew75t Posted August 6, 2020 Share Posted August 6, 2020 (edited) Hello to all. I'm getting warnings like this, how can I fix them? WARNING: S\admin_sys.lua:21: Access denied @ 'addAccount' WARNING: S\admin_sys.lua:22: Bad argument @ 'setAccountData' [Expected account at argument 1, got nil] WARNING: S\admin_sys.lua:38: Bad argument @ 'getAccountData' [Expected account at argument 1, got boolean] WARNING: S\admin_sys.lua:39: Bad argument @ 'passwordVerify' [Expected string at argument 2, got boolean] local MINIMUN_PASSWORD_LENGTH = 6 local function isPasswordValid(password) return string.len(password) >= MINIMUN_PASSWORD_LENGTH end addCommandHandler('reg', function (player, command, username, password) if not username or not password then return outputChatBox('SYNTAX: /' .. command .. ' [username][password]', player, 255, 255, 255) end if getAccount(username) then return outputChatBox('An account already exists with that name.', player, 255, 100, 100) end if not isPasswordValid(password) then return outputChatBox('The password supplied was not valid.', player, 255,100,100) end passwordHash(password, 'bcrypt', {}, function (hashedPassword) local account = addAccount(username, hashedPassword) setAccountData(account, 'hashed_password', hashedPassword) outputChatBox('Your account has been successfully created! You may now login with /log', player, 100, 255, 100) end) end, false, false) addCommandHandler('log', function (player, command, username, password) if not username or not password then return outputChatBox('SYNTAX: /' .. command .. ' [username] [password]', player, 255, 255, 255) end local account = getAccount(username) if not account then outputChatBox('No such account could be found with that username or password.', player, 255, 100,100) end local hashedPassword = getAccountData(account, 'hashed_password') passwordVerify(password, hashedPassword, function (isValid) if not isValid then return outputChatBox('No such account could be found with that username or password.', player, 255, 100,100) end if logIn(player, account, hashedPassword) then return outputChatBox('You have successfully logged in!', player, 100,255,100) end return outputChatBox('An unknown error occured while attempting to authenticate.', player, 255, 100, 100) end) end, false, false) Edited August 6, 2020 by Andrew75t Link to comment
Administrators Tut Posted August 6, 2020 Administrators Share Posted August 6, 2020 Thread moved to the Scripting forum, @Andrew75t Link to comment
Moderators Patrick Posted August 6, 2020 Moderators Share Posted August 6, 2020 (edited) The main problem is this: WARNING: Access denied @ 'addAccount' You need to give permission to the resource to create accounts. 1) Stop the server. 2) Open ACL.xml 3) Find Admin group. ("<group name="Admin"> ...") 4) Add your resource to this group. (Add this line before </group> close tag: "<object name="resource.S"></object>") (if the resource's name is S) <group name="Admin"> <acl name="Moderator"></acl> <acl name="SuperModerator"></acl> <acl name="Admin"></acl> <acl name="RPC"></acl> <object name="resource.S"></object> </group> Edited August 6, 2020 by Patrick 1 Link to comment
Andrew75t Posted August 7, 2020 Author Share Posted August 7, 2020 Thank you very much! Have a nice day, Patrick. 1 Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now