Advertisement
Guest User

Untitled

a guest
Jan 26th, 2016
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.73 KB | None | 0 0
  1. import os
  2. import re
  3.  
  4. q_user = r'([\d\w]{3,})\,([\d\w]{3,})\n'
  5. q_name = r'(name)\,([\d\w]{3,})\n'
  6. q_password = r'([\d\w]{3,})\,(password)\n'
  7.  
  8. print 'Welcome to our Autorization Service!'
  9. menu = input('Print 1 for registration or 2 for login')
  10.  
  11. if not os.path.isfile('users'):
  12.     open('users', 'w').close()
  13. f = open('users', 'a')
  14.  
  15. def name_exists(name):
  16.     users = f.read()
  17.     r = re.search(q_name.replace('name', name), users)
  18.     return r
  19.    
  20.  
  21. if menu == '1':
  22.     print 'Registration!\n*****')
  23.     name = input('Your name: ')
  24.    
  25.     pass_success = False
  26.     while not pass_success:
  27.         password = input('Your password: ')
  28.         if input('Repeat password: ') == password:
  29.             pass_success = True
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement