File tree Expand file tree Collapse file tree 3 files changed +19
-11
lines changed Expand file tree Collapse file tree 3 files changed +19
-11
lines changed Original file line number Diff line number Diff line change 1
1
# Author Steven Yeoh
2
2
# Copyright (c) 2019. All rights reserved.
3
3
4
- from exercises .utils .form_util import get_form
4
+ from exercises .utils .form_util import display_form
5
5
6
6
print ("\n =========================== MENU ===========================" )
7
7
print (" [R]egister account" )
8
8
print (" [L]ogin" )
9
- user_option = input (" Enter your option: " ).upper ()
9
+ user_option = input (" Enter option: " ).upper ()
10
10
print ("=========================== MENU ===========================" )
11
- get_form (user_option )
11
+ display_form (user_option )
12
12
13
13
Original file line number Diff line number Diff line change 1
1
# Author Steven Yeoh
2
2
# Copyright (c) 2019. All rights reserved.
3
3
4
- from exercises .utils import login_util , register_util
4
+ from getpass import getpass
5
+ from exercises .utils import register_util , validate_util
5
6
6
7
7
- def get_form ( option ):
8
- if option == "R" :
8
+ def display_form ( user_option ):
9
+ if user_option == "R" :
9
10
register_form ()
10
- elif option == "M" :
11
+ elif user_option == "M" :
11
12
login_form ()
12
13
else :
13
- print ("Invalid option, please try again." )
14
+ print ("Incorrect option, please try again." )
14
15
15
16
16
17
def register_form ():
17
18
print ("\n =========================== REGISTER ===========================" )
18
19
username = input (" Enter username: " )
19
- password = input (" Enter password: " )
20
- confirm_password = input (" Enter confirm password: " )
21
- print ("=========================== REGISTER ===========================" )
20
+ password = getpass (" Password: " )
21
+ confirm_password = getpass (" Enter confirm password: " )
22
+ print ("=========================== REGISTER ===========================\n " )
23
+ errors = validate_util .validate_user_input (username , password , confirm_password )
24
+ validate_util .print_errors (errors ) if bool (errors ) else register_util .add_new_user (username , password )
22
25
23
26
24
27
def login_form ():
Original file line number Diff line number Diff line change 1
1
# Author Steven Yeoh
2
2
# Copyright (c) 2019. All rights reserved.
3
3
4
+
5
+ def add_new_user (username , password ):
6
+ # store into txt file
7
+ print ("Successfully created user, {}." .format (username ))
8
+
You can’t perform that action at this time.
0 commit comments