basic login

This commit is contained in:
Raffu Khondaker 2020-06-04 15:53:19 -04:00
parent 0081e55a9d
commit a0a58164ac
4 changed files with 46 additions and 9 deletions

BIN
.DS_Store vendored Normal file

Binary file not shown.

0
.login.txt Normal file
View File

20
options/login.py Normal file
View File

@ -0,0 +1,20 @@
from __future__ import print_function, unicode_literals
from PyInquirer import prompt, print_json
import os
def login():
questions = [
{
'type': 'input',
'name': 'user_name',
'message': 'What\'s your first name',
},
{
'type': 'password',
'name': 'passwd',
'message': 'Password?',
},
]
answers = prompt(questions)
print_json(answers) # use the answers as input for your app

35
run.py
View File

@ -1,13 +1,30 @@
from __future__ import print_function, unicode_literals from __future__ import print_function, unicode_literals
from PyInquirer import prompt, print_json from PyInquirer import prompt, print_json
import os
def login():
questions = [
{
'type': 'input',
'name': 'user_name',
'message': 'What\'s your first name',
},
{
'type': 'password',
'name': 'passwd',
'message': 'Password?',
},
]
answers = prompt(questions)
print(answers)
f = open(".login.txt", "w")
f.write(str(answers["user_name"]))
print_json(answers) # use the answers as input for your app
if(os.path.exists(".login.txt") == False):
login()
else:
print("Hello!")
questions = [
{
'type': 'input',
'name': 'first_name',
'message': 'What\'s your first name',
}
]
answers = prompt(questions)
print_json(answers["name"]) # use the answers as input for your app