Marshell Posted November 3, 2019 Share Posted November 3, 2019 (edited) Problems : > Acces denied @ "addAccount" the line is : local account ="" addAccount(username, hashedPassword) "" and the 2nd problem is : Bad argument "setAccountData [ Expected account at argument 1, got nil] and the line is : >> setAccountData(account, "hashed_password", hashedPassword) ( it's under the first line mentioned). Other problem is when a players tries to login .. the line is : local hashedPassword = getAccountData(account, "hashed_password") -- and the problem : "Bad argument getAccountData[ Expected account at argument 1, got boolean" and "Bad argument @ passwordVerify [ Expected string at argument 2, got boolean], the line is passwordVerify(password, getAccountData(account, "hashed_password"), function(isValid) local MINIMUM_PASSWORD_LENGTH = 6 local function isPasswordValid(password) return string.len(password) >= 6 end addCommandHandler("register", function(player, command, username, password) if not username or not password then return outputChatBox("Syntax: /" .. command .. " [nume utilizator] [ parola ]", player, 255, 205, 201) end if getAccount(username) then return outputChatBox("Un cont cu acest nume exista deja.", player, 255, 205, 201) end if not isPasswordValid(password) then return outputChatBox("Parola este invalida/Parola trebuie sa aiba minim 6 caractere.", player, 255, 100, 100) end passwordHash(password, "bcrypt", {}, function(hashedPassword) local account = addAccount(username, hashedPassword) setAccountData(account, "hashed_password", hashedPassword) outputChatBox("Contul tau a fost inregistrat cu succes! Acum poti folosi /accountLogin pentru a te autentifica.", player, 100, 255, 100) end) end) addCommandHandler("accountLogin", function(player, command, username, password) if not username or not password then return outputChatBox("Syntax: /" .. command .. " [nume utilizator] [ parola ]", player, 255, 205, 201) end local account = getAccount(username) if not account then outputChatBox("Nu s-a gasit niciun cont cu acest nume si aceasta parola.", player, 255, 100, 100) end local hashedPassword = getAccountData(account, "hashed_password") passwordVerify(password, getAccountData(account, "hashed_password"), function(isValid) if not isValid then return outputChatBox("Nu s-a gasit niciun cont cu acest nume si aceasta parola.", player, 255, 100, 100) end if logIn(player, account, hashedPassword) then return outputChatBox("Te-ai autentificat cu succes!", player, 100, 255, 100) end return outputChatBox("O eroare neasteptata a avut loc in timpul autentificarii.", player, 255, 100, 100) end) end, false, false) Edited November 3, 2019 by Marshell Link to comment
Addlibs Posted November 3, 2019 Share Posted November 3, 2019 The resource which calls addAccount needs to have the correct permissions set up in ACL. Perhaps the easiest but also the most dangerous way to fix this issue is to add resource.[your resource name] object in the admin ACL group (but this grants way more permissions than just addAccount, so make sure you trust the code) 2 Link to comment
VenomOG Posted November 3, 2019 Share Posted November 3, 2019 4 minutes ago, MrTasty said: The resource which calls addAccount needs to have the correct permissions set up in ACL. Perhaps the easiest but also the most dangerous way to fix this issue is to add resource.[your resource name] object in the admin ACL group (but this grants way more permissions than just addAccount, so make sure you trust the code) As he said > use "Admin" ACL for all permissions Link to comment
Marshell Posted November 3, 2019 Author Share Posted November 3, 2019 (edited) Just now, MrTasty said: The resource which calls addAccount needs to have the correct permissions set up in ACL. Perhaps the easiest but also the most dangerous way to fix this issue is to add resource.[your resource name] object in the admin ACL group (but this grants way more permissions than just addAccount, so make sure you trust the code) Oke, thanks, but, the other problems ? How can I solve them ? Edited November 3, 2019 by Marshell hhhh.. I solved using the method u told me. Thanks!!! 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