aaronn / django-rest-framework-passwordless

Passwordless Auth for Django REST Framework
MIT License
708 stars 154 forks source link

Override `EmailAuthSerializer` to add custom fields. #93

Closed fabiom91 closed 2 years ago

fabiom91 commented 3 years ago

Is it possible to override this class to allow adding other custom fields? e.g. In my case is an administrator who register the user email. I already modified the send_email_with_callback_token function to include the token into a link but I also want to be able to add other custom codes to the link so that the user will be redirected appropriately based on the administrator wishes.

How do I override this class to add some more serialisers fields? Thanks.

class EmailAuthSerializer(AbstractBaseAliasAuthenticationSerializer):
    @property
    def alias_type(self):
        return 'email'

    email = serializers.EmailField()
bprachi27 commented 2 years ago

you can inherit EmailAuthSerializer and make your serializer. i also implement like this. then I override view and make my own url and it worked really fine