Jump to content




[solved] Bug in Code, Please Help (user creation)


  • You cannot reply to this topic
3 replies to this topic

#1 lebalusch

  • Members
  • 49 posts

Posted 10 November 2016 - 12:47 AM

Hi guys

so i have been trying to make a User create based on the one on this page:

How to Securely Store Passwords by computech

http://www.computerc...768#entry260768

as you can see i have posted my code there and awaited for some help but no response.

Cant seem to be able to get it to write users to the file and debug other bits. And now stuck. Thanks for your help if you can in advance.

code:-
Spoiler

Edited by lebalusch, 19 November 2016 - 11:34 PM.


#2 Dog

  • Members
  • 1,179 posts
  • LocationEarth orbit

Posted 10 November 2016 - 02:11 AM

A couple things I noticed. First, I don't see why you have setScreen() defined globally - are you calling it from other concurrently running programs? If not, it should be local (and my guess is that it would probably be better to define it locally in each concurrently running program rather than defining it globally here).

Second - when you try to create usrs[u] the pwd entry in your table should cause an error. You're trying to concatenate a string and a number. This won't work. Unfortunately, I know very little (almost nothing really) about encryption, so I'll have to leave the correct implementation of that line for someone else to explain. If that's how the sha api you're using really works, then you'll need to convert your salt to a string (using tostring()) before concatenating.

#3 Bomb Bloke

    Hobbyist Coder

  • Moderators
  • 7,099 posts
  • LocationTasmania (AU)

Posted 11 November 2016 - 04:32 AM

View PostDog, on 10 November 2016 - 02:11 AM, said:

Second - when you try to create usrs[u] the pwd entry in your table should cause an error. You're trying to concatenate a string and a number. This won't work.

Well, it should "work" in the sense that it won't immediately cause an error - Lua itself is quite happy to concatenate strings and numbers. Beats me whether it's correct to do it in the context of this script, though.

As to the problem... it'd be worth elaborating on what that is. Simply saying you're "stuck" is about as ambiguous as you can get.

For example, when you attempt to write user details to a file, what does happen? Does the file get created? Is there any data in it at all? Etc? Etc? Etc?

If you're not even sure if the desired lines are being executed at all, add print statements to your script so you can see!

#4 lebalusch

  • Members
  • 49 posts

Posted 19 November 2016 - 11:33 PM

Hi Guys thank you for your help i have got it to work now and you can find the code at:

http://pastebin.com/Vr8tYMP8

http://www.computerc...ng-and-salting/





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users