Set Password

Asked by Hossain Abeer on 2017-07-16

Hi,

I am trying to set password on starting the program. It would prompt a window, ask for a password, then do its operations. I have used the following commands:

yes = popAsk("PassWord?", "Program")
if not yes:
    popup("Please enter Valid password", "Program")
    exit(1)

ok = input("Enter Validity Code:", "15-digit code", "Program")
input = (" ")
if not ok:
    exit(1)

popup("Program starts now!", "Program")

Problem: The program accepts just about anything on input, and lets anyone access.

Thank you for your time
Hossain Abeer

Question information

Language:
English Edit question
Status:
Answered
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Last query:
2017-07-16
Last reply:
2017-07-17
Manfred Hampl (m-hampl) said : #1

There is no logic in your program to validate the code that has been entered.

You need to compare the entered value with the desired password, something like

if ok != "TheHiddenSecret":
   exit(1)

see also http://sikulix-2014.readthedocs.io/en/latest/interaction.html

Can you help with this problem?

Provide an answer of your own, or ask Hossain Abeer for more information if necessary.

To post a message you must log in.