def login(): logging.debug('user selected login') d = data() Username, Pin = username.get(), pin.get() if Username in d.keys(): logging.debug('username match found in data with name : {}'.format( d[Username][2])) if Pin == d[Username][5]: logging.debug('user entered correct pin') username.delete(0, END) pin.delete(0, END) messagebox.showinfo( 'Successfull', 'Welcome {} to atm service.'.format( (d[Username][2]).upper())) else: pin.delete(0, END) messagebox.showwarning('Unsuccessfull', 'Invalid PIN!') logging.warning('user entered incorrect pin') else: username.delete(0, END) pin.delete(0, END) logging.warning('no match found with username:{}'.format(Username)) messagebox.showwarning('Unsuccessfull', 'Invalid Username! No match found')
def account_no_gen(user_name): d = data() alphabets = 'abcdefghijklmnopqrstuvwxyz' acc_no = '' acc_no += str(len(d.keys()) + 10) for alpha in user_name: if (len(acc_no) < 12): if alpha in alphabets: index = alphabets.rfind(alpha) acc_no += str(index + 1) else: acc_no += '0' else: break if len(acc_no) > 12: final_acc_no = '' for index in acc_no: if len(final_acc_no) < 12: final_acc_no += index acc_no = final_acc_no return acc_no if len(acc_no) < 12: remain_index = 12 - len(acc_no) for index in range(remain_index): acc_no += str(randint(0, 9)) return acc_no else: return acc_no