예제 #1
0
    def validate_identity(self, user_name, password, visit_key):
        newuser = False
        user_name = to_db_encoding(user_name, self.user_class_db_encoding)

        try:
            user = User.by_user_name(user_name)
        except SQLObjectNotFound:
            log.info("Creating new user %s" % user_name)
            user = User(user_name=user_name)
            newuser = True

        if not self.validate_password(user, user_name, password):
            log.warning("Invalid password for %s" % user_name)
            if newuser:
                user.destroySelf()
            return None

        log.info("Login successful for %s" % user_name)

        try:
            link = VisitIdentity.by_visit_key(visit_key)
            link.user_id = user.id
        except SQLObjectNotFound:
            link = VisitIdentity(visit_key=visit_key, user_id=user.id)

        return SqlObjectIdentity(visit_key, user)
예제 #2
0
    def validate_identity(self, user_name, password, visit_key):
        newuser = False
        user_name = to_db_encoding(user_name, self.user_class_db_encoding)

        try:
            user = User.by_user_name(user_name)
        except SQLObjectNotFound:
            log.info("Creating new user %s" % user_name)
            user = User(user_name=user_name)
            newuser = True

        if not self.validate_password(user, user_name, password):
            log.warning("Invalid password for %s" % user_name)
            if newuser:
                user.destroySelf()
            return None

        log.info("Login successful for %s" % user_name)

        try:
            link = VisitIdentity.by_visit_key(visit_key)
            link.user_id = user.id
        except SQLObjectNotFound:
            link = VisitIdentity(visit_key=visit_key, user_id=user.id)

        return SqlObjectIdentity(visit_key, user)
예제 #3
0
파일: dev_init.py 프로젝트: bitlord/bodhi
def main():
    load_config()
    hub.begin()

    try:
        print "\nCreating guest user and giving it administrator priviliges"
        guest = User(user_name="guest", display_name="Bodhi Hacker", password="******")
        admin = Group(group_name="releng", display_name="Bodhi administrators")
        guest.addGroup(admin)
        hub.commit()
    except DuplicateEntryError:
        print "guest account already created"
예제 #4
0
파일: dev_init.py 프로젝트: tyll/bodhi
def main():
    load_config()
    hub.begin()

    try:
        print "\nCreating guest user and giving it administrator priviliges"
        guest = User(user_name='guest',
                     display_name='Bodhi Hacker',
                     password='******')
        admin = Group(group_name='releng', display_name='Bodhi administrators')
        guest.addGroup(admin)
        hub.commit()
    except DuplicateEntryError:
        print "guest account already created"