is-blocked-in-auth0.py 文件源码

python
阅读 25 收藏 0 点赞 0 评论 0

项目:tecken 作者: mozilla-services 项目源码 文件源码
def handle(self, *args, **options):
        email = options['email']
        if ' ' in email or email.count('@') != 1:
            raise CommandError(f'Invalid email {email!r}')
        users = find_users(
            settings.OIDC_RP_CLIENT_ID,
            settings.OIDC_RP_CLIENT_SECRET,
            urlparse(settings.OIDC_OP_USER_ENDPOINT).netloc,
            email,
            requests,
        )
        for user in users:
            if user.get('blocked'):
                self.stdout.write(self.style.ERROR('BLOCKED!'))
            else:
                self.stdout.write(self.style.SUCCESS('NOT blocked!'))
            break
        else:
            self.stdout.write(self.style.WARNING(
                f'{email} could not be found in Auth0'
            ))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号