Exemple #1
0
    def addRegistration(self, username, password):
        #token = auth.register(username, password)
        token = auth_client.register(username, password)
        bank_client.register(username)

        if token is not None:
            return self.loginCookie(username, token)
        else:
            return None
Exemple #2
0
def register(username, password):
    db = person_setup()
    db1 = cred_setup()
    person = db.query(Person).get(username)
    if person:
        return None
    newperson = Person()
    newcred = Cred()
    newcred.username = username
    newcred.salt = os.urandom(8).encode('base_64')
    newcred.password = pbkdf2.PBKDF2(password, newcred.salt).hexread(32)
    newperson.username = username
    db.add(newperson)
    db1.add(newcred)
    db1.commit()
    db.commit()
    bank_client.register(username)
    return newtoken(db1, newcred)
Exemple #3
0
def register(username, password):
    db_person = person_setup()
    person = db_person.query(Person).get(username)
    if person:
        return None
    newperson = Person()
    newperson.username = username
    db_person.add(newperson)
    db_person.commit()
    bank_client.register(username)

    db_cred = cred_setup()
    cred = Cred()
    cred.username = username
    cred.salt = os.urandom(8).encode('base_64')
    cred.password = pbkdf2.PBKDF2(password, cred.salt).hexread(32)
    db_cred.add(cred)
    db_cred.commit()

    return newtoken(db_cred, cred)
Exemple #4
0
def register(username, password):
    db = person_setup()
    db1 = cred_setup()
    person = db.query(Person).get(username)
    if person:
        return None
    newperson = Person()
    newcred = Cred()
    salt = os.urandom(5).decode("latin-1")
    password = unicode(pbkdf2.PBKDF2(password, salt).hexread(32))
    newperson.username = username
    newcred.password = password
    newcred.username = username
    newcred.salt = salt
    db.add(newperson)
    db1.add(newcred)
    db.commit()
    db1.commit()
    bank_client.register(username)
    return newtoken(db1, newcred)
Exemple #5
0
def register(username, password):
    print "auth register"
    db = cred_setup()
    cred = db.query(Cred).get(username)
    if cred:
        return None
    newcred = Cred()
    newcred.username = username
    salt = os.urandom(16).encode('base_64')
    newcred.password = pbkdf2.PBKDF2(password, salt).hexread(32)
    newcred.salt = salt
    db.add(newcred)
    db.commit()

    # TODO: register bank account to user
    bank.register(username)

    newperson = Person()
    newperson.username = username
    ndb = person_setup()
    ndb.add(newperson)
    ndb.commit()    

    return newtoken(db, newcred)
Exemple #6
0
def register(username, password):
    print "auth register"
    db = cred_setup()
    cred = db.query(Cred).get(username)
    if cred:
        return None
    newcred = Cred()
    newcred.username = username
    salt = os.urandom(16).encode('base_64')
    newcred.password = pbkdf2.PBKDF2(password, salt).hexread(32)
    newcred.salt = salt
    db.add(newcred)
    db.commit()

    # TODO: register bank account to user
    bank.register(username)

    newperson = Person()
    newperson.username = username
    ndb = person_setup()
    ndb.add(newperson)
    ndb.commit()

    return newtoken(db, newcred)
def register(username, password):
    cred_db = cred_setup()
    person_db = person_setup()
    if person_db.query(Person).get(username) or cred_db.query(Cred).get(
            username) or bank.register(username):
        return None
    newperson = Person()
    newperson.username = username
    person_db.add(newperson)
    person_db.commit()

    newcred = Cred()
    newcred.username = username
    newcred.salt = os.urandom(8).encode('hex')
    newcred.password = pbkdf2.PBKDF2(password, newcred.salt).hexread(32)
    cred_db.add(newcred)
    cred_db.commit()
    return newtoken(cred_db, newcred)