It occurred to me that at some point and time I may want another user account for others to log into the system with. I assume this is not built-in to the software - but I can add it to the code somewhere?
Furthermore, some type of permission wall would be desired so that a user could, for example, view the video stream and look at pictures, but not have the ability to activate any relays/hardware, etc. That way I don't have to worry about my 12 year old nephew dumping all my water. :)
Just thinking out loud!
Thanks.
Adding a new user is still an obstacle for me. I'm trying to understand the way the data is stored and called in order to add another entry. I know the credentials are stored in
`/env/autonom/database/logincred.txt`
and that's serving as the database, where the username/password are checked against. In that file, by default is the value string:
{"name": "login", "password": "REDACTED", "username": "admin"}
I thought it would be simple enough to add another line, same thing, but different username and password:
{"name": "login", "password": "REDACTED", "username": "admin"} {"name": "login", "password": "REDACTED", "username": "newuser"}
But that killed my login abilities, giving me login error for whatever account I tried to use. My understanding is due to keyword collision/conflict as outlined below. Looking at the logic in the code I see the get username and getpassword functions, they use a keytosearch variable titled `username`, and `password`, respectively:
def getusername(): recordkey="name" recordvalue="login" keytosearch="username" dataitem=filestoragemod.searchdata(DATAFILENAME,recordkey,recordvalue,keytosearch) return dataitem def getpassword(): recordkey="name" recordvalue="login" keytosearch="password" dataitem=filestoragemod.searchdata(DATAFILENAME,recordkey,recordvalue,keytosearch) return dataitem
Thinking about what the code is doing, this indicates to me there is a collision in the naming keyword. My thought process says the logincreds.txt file needs to have unique keyword names, such as username2 and password2 - something like this:
{"name": "login", "password": "REDACTED", "username": "admin"} {"name": "login", "password2": "REDACTED", "username2": "newuser"}
The problem I have now is modifying the python code so that it iterates through all username/password combinations? Basically, the logic should say, if I match username admin, then try to match 'this' password. But if not, move on to the next pattern match attempt, and if a match use `that` password. If no match, move on to the next line trying to match username. If by the end of document `logincreds.txt`, no match on username, then 'invalid credentials' is the result.
Just thinking out loud here. Not sure I'll have the time to play with it today.
Thanks.