示例#1
0
def confirm_if_username_or_email_exists_already_during_registration(user_email: str, user_name: str) -> dict:
    user_instance = UserDatabaseService.get_active_inactive_single_user_by_email(user_email)

    if user_instance:
        return {'result': True, 'value': ErrorEnums.EMAIL_ALREADY_EXISTS_ERROR.value}

    alt_username_user = UserDatabaseService.get_user_by_alt_username(user_name)
    username_instance = UserDatabaseService.get_user_by_username(user_name)

    if username_instance or alt_username_user:
        return {'result': True, 'value': ErrorEnums.USER_NAME_ALREADY_EXISTS.value}
示例#2
0
def get_existing_user_by_username(username):
    user = UserDatabaseService.get_user_by_username(username)
    return dataStateAccess.UserDTO.user_dto(user)
示例#3
0
def confirm_if_user_name_already_exists(username):
    user_instance = UserDatabaseService.get_user_by_username(username)
    if user_instance.username == username:
        return True
    return False