Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Everything is working perfectly except it asks me 3 times for password :) #2

Open
lupo-ch opened this issue Feb 25, 2024 · 1 comment

Comments

@lupo-ch
Copy link

lupo-ch commented Feb 25, 2024

Hello, thank you very much for sharing this VALUABLE project!!!
I'm using it and it's working perfectly, the only one problem I have is that it ask me 3 times one after another for the password in order to let me login.
It asks 3 times because I executed the install script 3 times actually :)
First after the installation I closed the termux and after the new start I was not asked for pass, because of that I installed it for a second time ... LOL :)
After that I closed and checked if termux have been closed and after that after the start it asked me for the pass ... 2 times :)
hmmm I removed the etc/.login directory and installed again and now I'm asked 3 time to enter the pass in order to login ... :) :) :)
I have checked the install script, the login script and actually can't find where and way all this phenomenon happens :)
Goof Luck! TX!

@lupo-ch
Copy link
Author

lupo-ch commented Feb 25, 2024

OK, found the problem! :)
in file
/data/data/com.termux/files/usr/bin/login
I had 2 lines
python3 /data/data/com.termux/files/usr/etc/.login/login
python3 /data/data/com.termux/files/usr/etc/.login/login

because I run the installation few times one after another NOT knowing how cleanly to uninstall
Actually in the Readme.md there is no info about the
tlock --uninstall
:)

My suggestion is to add a check if the line exists before inserting it again.
Bellow is a simple check added (suggested by ChatGPT) :)

def addline(filename, new_line):
# Open the file and read all lines
with open(filename, 'r') as file:
lines = file.readlines()

# Check if the new line already exists in the file
if new_line not in lines:
    # If the line doesn't exist, write it at the beginning of the file
    with open(filename, 'w') as file:
        file.write(lines[0])  
        file.write(new_line + '\n') 
        for line in lines[1:]:
            file.write(line)
else:
    # If the line exists, just rewrite the file without adding the line
    with open(filename, 'w') as file:
        for line in lines:
            file.write(line)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant