Amrin commited on
Commit
dad2784
Β·
1 Parent(s): 7c2649a

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +40 -32
app.py CHANGED
@@ -95,40 +95,40 @@ if name in user_data:
95
  save_user_data(user_data)
96
  display_message('πŸŽ‰ PIN created successfully! πŸŽ‰', "πŸŽ‰")
97
 
98
- # comparing pin
99
- count = 0
100
- with st.form(key='pin_entry_form'):
101
- pin = st.text_input('Please enter your PIN:', type='password', key="pin_input_existing")
102
- st.form_submit_button('Submit PIN')
103
-
104
- while count < 3:
105
- if pin.isdigit() and pin == user_data[name]['pin']:
106
- break
107
- else:
108
- count += 1
109
- display_message('❌ Invalid PIN. Please try again. ❌', "❌")
110
 
111
- # in case of a valid pin - continuing, or exiting
112
- if count == 3:
113
- display_message('❌ 3 UNSUCCESSFUL PIN ATTEMPTS, EXITING. YOUR CARD HAS BEEN LOCKED ❌', "❌")
114
  else:
115
- display_message(f'πŸŽ‰ LOGIN SUCCESSFUL, CONTINUE {name.capitalize()}! πŸŽ‰', "πŸŽ‰")
116
-
117
- # Main menu
118
- options = ['View Balance', 'Withdraw Cash', 'Deposit Cash', 'Change PIN', 'Quit']
119
- response = st.selectbox('Select an option:', options, key="menu_selectbox_existing")
120
-
121
- if response == 'View Balance':
122
- view_balance(user_data)
123
- elif response == 'Withdraw Cash':
124
- withdraw_cash(user_data)
125
- elif response == 'Deposit Cash':
126
- deposit_cash(user_data)
127
- elif response == 'Change PIN':
128
- change_pin(user_data)
129
- elif response == 'Quit':
130
- save_user_data(user_data)
131
- display_message('🌟 Thank you for using our ATM. Have a great day! 🌟', "🌟")
 
 
 
 
 
 
 
132
  else:
133
  # New user; create an entry with default values
134
  user_data[name] = {'pin': '', 'amount': 0}
@@ -144,3 +144,11 @@ else:
144
  user_data[name]['pin'] = new_pin
145
  save_user_data(user_data)
146
  display_message('πŸŽ‰ PIN created successfully! πŸŽ‰', "πŸŽ‰")
 
 
 
 
 
 
 
 
 
95
  save_user_data(user_data)
96
  display_message('πŸŽ‰ PIN created successfully! πŸŽ‰', "πŸŽ‰")
97
 
98
+ # comparing pin
99
+ count = 0
100
+ with st.form(key='pin_entry_form'):
101
+ pin = st.text_input('Please enter your PIN:', type='password', key="pin_input_existing")
102
+ st.form_submit_button('Submit PIN')
 
 
 
 
 
 
 
103
 
104
+ while count < 3:
105
+ if pin.isdigit() and pin == user_data[name]['pin']:
106
+ break
107
  else:
108
+ count += 1
109
+ display_message('❌ Invalid PIN. Please try again. ❌', "❌")
110
+
111
+ # in case of a valid pin - continuing, or exiting
112
+ if count == 3:
113
+ display_message('❌ 3 UNSUCCESSFUL PIN ATTEMPTS, EXITING. YOUR CARD HAS BEEN LOCKED ❌', "❌")
114
+ else:
115
+ display_message(f'πŸŽ‰ LOGIN SUCCESSFUL, CONTINUE {name.capitalize()}! πŸŽ‰', "πŸŽ‰")
116
+
117
+ # Main menu
118
+ options = ['View Balance', 'Withdraw Cash', 'Deposit Cash', 'Change PIN', 'Quit']
119
+ response = st.selectbox('Select an option:', options, key="menu_selectbox_existing")
120
+
121
+ if response == 'View Balance':
122
+ view_balance(user_data)
123
+ elif response == 'Withdraw Cash':
124
+ withdraw_cash(user_data)
125
+ elif response == 'Deposit Cash':
126
+ deposit_cash(user_data)
127
+ elif response == 'Change PIN':
128
+ change_pin(user_data)
129
+ elif response == 'Quit':
130
+ save_user_data(user_data)
131
+ display_message('🌟 Thank you for using our ATM. Have a great day! 🌟', "🌟")
132
  else:
133
  # New user; create an entry with default values
134
  user_data[name] = {'pin': '', 'amount': 0}
 
144
  user_data[name]['pin'] = new_pin
145
  save_user_data(user_data)
146
  display_message('πŸŽ‰ PIN created successfully! πŸŽ‰', "πŸŽ‰")
147
+
148
+ # Main menu (for new user)
149
+ options_new_user = ['Quit']
150
+ response_new_user = st.selectbox('Select an option:', options_new_user, key="menu_selectbox_new_user")
151
+
152
+ if response_new_user == 'Quit':
153
+ save_user_data(user_data)
154
+ display_message('🌟 Thank you for using our ATM. Have a great day! 🌟', "🌟")