Set Password

Asked by Hossain Abeer

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:
Solved
For:
SikuliX Edit question
Assignee:
No assignee Edit question
Solved by:
Hossain Abeer
Solved:
Last query:
Last reply:
Revision history for this message
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

Revision history for this message
Hossain Abeer (retroxic) said :
#2

Hey Manfred,

Thanks for your respond. I have just started to code. So can you write a simple model of codes which may provide a log in portal. I have absolutely no idea on this.

Also, I have checked the link provided, but didn't find article relating to log in system.

Regards
HOssain ABeer

Revision history for this message
Manfred Hampl (m-hampl) said :
#3

I do not really understand your question.
To which system do you want to log in? Doesn't that system already have its login screen?

Revision history for this message
Hossain Abeer (retroxic) said :
#4

I want to create a program, using sikuli. This program would only allow a number of my colleagues to log in, using username and password. I have been able to create the program, but can't provide a log in portal for this.

Revision history for this message
Manfred Hampl (m-hampl) said :
#5

Sorry, but I am not able to offer a user identification and authentication management system in sikuli.

I already made a proposal in comment #1 for a simple validation check. If that is not enough, then you have to ask somebody else.

Revision history for this message
Hossain Abeer (retroxic) said :
#6

The code -

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

gives an error. Error reads as "[error] NameError ( name 'ok' is not defined )"

Thank you for your effort my friend
Best wishes

Revision history for this message
Hossain Abeer (retroxic) said :
#7

Hey,

I have done a little research, and successfully made a simple log in portal. the code -

yes = popAsk("Have a password?", "Program")
if not yes:
    popup("Please get one", "Program")
    exit(1)

password = input()
if password == "12543":
    popup("Thanks. Your Program starts now!", "Program")
else:
    popup("Wrong Password. Try Again", "Program")
    exit(1)

Thanks for viewing