rest_auth.views

Views for authentication

In this views, authentication views are composited with GenericAPIView (of rest_framework) and mixins, which is implemented for process views.

Because, we didn’t know what methods you use for process business logics. You can construct your own views by extending our mixins.

(rest_framework’s generic views used this strategy)

class rest_auth.views.LoginMixin[source]

Mixin for logging-in

response_includes_data = False

Set this to True if you wanna send user data (or more) when authentication is successful. (default: False)

serializer_class = None

You should make your own serializer class if you cusomize auth backend and this backend are not satisfied by LoginSerializer.

(accept other than username and password. (e.g RemoteUserBackend)

login(request, *args, **kwargs)[source]

Main business logic for loggin in

Raises:ValidationError – auth failed, but it will be handled by rest_frameworks error handler.
get_response_data(data)[source]

Override this method when you use response_includes_data and You wanna send customized user data (beyond serializer.data)

class rest_auth.views.LoginView(**kwargs)[source]

LoginView for REST-API.

post(request, *args, **kwargs)[source]

Just calls LoginMixin.login

class rest_auth.views.LogoutView(**kwargs)[source]

LogoutView for user logout.

post(request, *args, **kwargs)[source]

Logout a user. performed by django.contrib.auth.logout

No data is to sent.

class rest_auth.views.PasswordForgotMixin[source]

View for sending password-reset-link.

serializer_class

alias of rest_auth.serializers.PasswordResetSerializer

forgot(request, *args, **kwargs)[source]

Sends a password-reset-link to requested email.

class rest_auth.views.PasswordForgotView(**kwargs)[source]

sending password-reset email to user.

post(request, *args, **kwargs)[source]
class rest_auth.views.PasswordForgotConfirmView(**kwargs)[source]

django-rest-auth’s password reset confirmation just adopts django’s one. This idea is under assumption, which password reset confirmation should be done, by clicking password-reset-url we sent and moving to webpage to change password.

class rest_auth.views.PasswordResetDoneView(**kwargs)[source]

adopts django’s password reset complete view.

class rest_auth.views.PasswordChangeMixin[source]

Change password for a user.

serializer_class

alias of rest_auth.serializers.PasswordChangeSerializer

reset(request, *args, **kwargs)[source]

Reset password. No data is to sent.

class rest_auth.views.PasswordChangeView(**kwargs)[source]

View for change password.

post(request, *args, **kwargs)[source]
class rest_auth.views.SignupView(**kwargs)[source]
serializer_class

alias of rest_auth.serializers.SignupSerializer

class rest_auth.views.EmailVerificationConfirmView(**kwargs)[source]

Email verification view for newly-created User instances.

After user verified his/her email, users can use his/her full features of website.