Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import bcrypt
- import getpass
- from bcrypt import hashpw, gensalt
- from sqlalchemy import *
- from sqlalchemy.orm import*
- from sqlalchemy import create_engine
- from sqlalchemy.orm import sessionmaker
- from sqlalchemy.ext.declarative import declarative_base
- from sqlalchemy import exists
- from login_table import user, Base
- engine = create_engine('sqlite:///sqlalchemy_login.db')
- Base.metadata.bind = engine
- DBSession = sessionmaker(bind=engine)
- session = DBSession()
- username_attempt = raw_input('Enter username:')
- username_attempt = unicode(username_attempt)
- #password_attempt = raw_input('Enter password:')
- exist = session.query(exists().where(user.username == username_attempt)).scalar()
- while exist == False :
- print 'Incorrect username'
- username_attempt = raw_input('Enter username:')
- username_attempt = unicode(username_attempt)
- exist = session.query(exists().where(user.username == username_attempt)).scalar()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement