Example #1
0
    def execute(self, params):
        hashed_password = self.__authentication_service.hash_password(
            password=params.get('password'))

        user = User()
        user.full_name = params.get('full_name')
        user.email = params.get('email')
        user.password = hashed_password
        user.generate_activation()
        user.save(force_insert=True)

        return user
Example #2
0
def _build_user(**kwargs):
    now = datetime.datetime.now()

    user = User()
    user.full_name = kwargs.get('full_name', 'Antonie Russo')
    user.email = kwargs.get('email', '*****@*****.**')
    user.password = kwargs.get('password', 'a-secret')
    user.reset_password_token = kwargs.get('reset_password_token', uuid.uuid4())
    user.reset_password_token_created_at = kwargs.get('reset_password_token_created_at', now)
    user.is_active = kwargs.get('is_active', True)
    user.activation_token = kwargs.get('activation_token', uuid.uuid4())
    user.activation_token_created_at = kwargs.get('activation_token_created_at', now)
    user.save(force_insert=True)

    return user