django-rest-auth

Django Rest Aut - User registration

半城伤御伤魂 提交于 2019-12-24 14:58:59
问题 I´m using Django Rest Auth on Django 1.9 to register new users on system. And I need to execute some extra code in this process to save extra data on another tables. Anybody knows the best way to do it? 回答1: Write CustomRegisterSerializer and add it to settings.py file. REST_AUTH_REGISTER_SERIALIZERS = { "REGISTER_SERIALIZER":"common_app.serializers.CustomRegisterSerializer" } Write save() method of newly created serializer and put some extra executable code . If your user model have extra

Password reset link not redirecting to website

喜你入骨 提交于 2019-12-24 00:48:43
问题 I'm trying to implement password reset functionality in my React app with django rest framework. I am using rest_auth. Issue: Once I tried to reset my password from website, It sends password reset link to email. But on clicking that link it redirects to DRF default password reset page, not to my website's desired password reset page. It is working fine when I tried it from localhost. But once deployed to Heroku it is not working. Some observations: consider the link below which I received on

Django Rest Framework Authentication credentials were not provided

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-23 16:28:30
问题 I'm using django-rest-auth with django-all-auth on DRF and Angularjs. On any request regarding auth, I get the following error: {"detail":"Authentication credentials were not provided."} Going through SO, i've realised there are a lot of similar problems so accumulating them together, I tried the following: settings.py INSTALLED_APPS = ( 'django.contrib.admin', 'django.contrib.auth', 'django.contrib.contenttypes', 'django.contrib.sessions', 'django.contrib.staticfiles', 'django.contrib.sites'

django - allauth and rest-auth facebook login token does not work with JWT authentication

淺唱寂寞╮ 提交于 2019-12-23 05:38:05
问题 I've followed the both packages documentations and using example from rest-auth doc. I've followed all the steps and I can successfully use this API to register/login user with facebook. API returns me token and user object but this token is not working with JWT authentication. But if I set this user's username in the db and then post the facebook login request again then returned token works fine. What does this social authentication process has to do with username? Is there something I need

Django Rest Framework - Why is a 200 status code returned when trying to login a user using incorrect credentials?

試著忘記壹切 提交于 2019-12-22 10:27:53
问题 This is my URLs.py: url(r'^api-auth/', include('rest_framework.urls', namespace='rest_framework')), I have a form on my homepage where users can type a username and password. When the submit button is clicked, AngularJS sends a POST request to "api-auth/login/" with the user object (username and password): $http.post("/api-auth/login/", self.loginuser) .error(function(data, status, headers, config) { console.log(data); }); When a user submits an incorrect username and password (username and

Reverse for 'account_email_verification_sent' not found. 'account_email_verification_sent' is not a valid view function or pattern name

亡梦爱人 提交于 2019-12-22 05:33:15
问题 I'm trying to use allauth and rest-auth in my project and try to use the built-in function in allauth to do email verification but this what I get : and here is my code settings.py ACCOUNT_EMAIL_VERIFICATION = 'mandatory' ACCOUNT_EMAIL_REQUIRED = True urls.py urlpatterns = [ re_path(r'^', include('rest_auth.urls')), re_path(r'^registration/', include('rest_auth.registration.urls')), ] 回答1: I found the solution, that I have to add URL to be able to make a post request to the backend to send

How to save extra fields on registration using custom user model in DRF + django-rest-auth

十年热恋 提交于 2019-12-21 02:53:11
问题 Using Django REST Framework (DRF), with django-rest-auth, I created a custom user model with one extra field. My aim is to use the django-rest-auth registration endpoint to register a new user in one request, and thus sending all the data to create a new user, including the data for the extra field. I am using AbstractUser, since it seems recommended for beginners, where more advanced developers could use AbstractBaseUser. This is also why the following SO answers looks too complicated for

How to customize django rest auth password reset email content/template

老子叫甜甜 提交于 2019-12-20 09:57:14
问题 In django rest_auth password reset, default email content look like following:- You're receiving this email because you requested a password reset for your user account at localhost:8000. Please go to the following page and choose a new password: http://localhost:8000/api/reset/Kih/89a-23809182347689312b123/ Your username, in case you've forgotten: test Thanks for using our site! The localhost:8000 team How to customize content of this email ? 回答1: You need to hook up your own reset password

django-rest-auth custom registration fails to save extra fields

我的梦境 提交于 2019-12-18 03:02:18
问题 I am using DRF and for login/registration I am using Django-rest-auth. I have customized User model to have extra fields I have custom registration serializer to store extra fields along with username, password while registering a new user. Registration is successful however, extra fields are not saved along with username, first_name, last_name and password. My model: class UserManager(BaseUserManager): def _create_user(self, username, email, password, is_staff, is_superuser, address, **extra

Django rest auth email instead of username

自闭症网瘾萝莉.ら 提交于 2019-12-18 02:46:31
问题 I have a django project in which I am using Django-rest-auth to do authentication. I want to use email with password to authenticate the user and not the username+password. I have following settings in my settings.py but it didn't do anything for me: REST_SESSION_LOGIN = True EMAIL_BACKEND = 'django.core.mail.backends.console.EmailBackend' ACCOUNT_EMAIL_REQUIRED = True ACCOUNT_AUTHENTICATION_METHOD = 'EMAIL' ACCOUNT_EMAIL_VERIFICATION = 'optional' How can I achieve it? 回答1: Following setting