mirror of
https://github.com/Rushilwiz/SkoolOS.git
synced 2025-04-16 02:10:19 -04:00
basic login
This commit is contained in:
parent
0081e55a9d
commit
a0a58164ac
0
.login.txt
Normal file
0
.login.txt
Normal file
20
options/login.py
Normal file
20
options/login.py
Normal 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
35
run.py
|
@ -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
|
|
Loading…
Reference in New Issue
Block a user