django-rest-auth

allauth unverified email remains unverified once email expires

大兔子大兔子 提交于 2020-02-29 07:00:07
问题 I have a custom user model. and I use Django rest auth to handle authentication of users. the problem is that after sign up when the email is sent. if the user doesn't verify the email before it expires, it seems that it remains stuck like that indefinitely. I was expecting the verification email to be sent again since ACCOUNT_EMAIL_VERIFICATION = "mandatory" in my settings, from the documentation, it is supposed to resend the verification message by default, but this isnt happening. I am

django default Authenticaiton form shows username rather than email

試著忘記壹切 提交于 2020-01-16 09:48:06
问题 I implemented my own user login form with django like below from django.contrib.auth.forms import AuthenticationForm class CustomUserLoginForm(AuthenticationForm): class Meta: model = CustomUser fields = ('email', 'password') then as a view this is what I have: from rest_auth.views import LoginView from users.forms import CustomUserLoginForm class CustomLoginView(LoginView): def get(self, request): form = CustomUserLoginForm() return render(request, "api/test_template.html", context={"form":

Django, Angular, & DRF: Authentication to Django backend vs. API

橙三吉。 提交于 2020-01-13 01:48:14
问题 I'm building an app with a Django backend, Angular frontend, and a REST API using Django REST Framework for Angular to consume. When I was still working out backend stuff with a vanilla frontend, I used the provided Django authentication to handle user auth- but now that I'm creating a REST based app, I'm not sure how to approach authentication. Since all user data will be either retrieved or submitted via the API, should API authentication be enough? If so, do I need to remove the existing

Modify response from Django REST API using CustomUserModel extending default User Model and API classes

早过忘川 提交于 2020-01-11 11:46:06
问题 I have a Django Project with CustomUserModel. I have extended Django default RegisterView with my CustomRegisterView, and also created CustomLoginView by extending LoginView. Everything works fine, data too get saved with custom fields, and while loging in and registering, I get a "key" in response, but I want to customize response of both the APIs with additional fields such as primary key value and a result_flag which will be either 0 or 1. My CustomRegisterSerializer class is defined as-

django-rest-auth error - save() takes 1 positional argument but 2 were given

泪湿孤枕 提交于 2020-01-05 09:23:16
问题 I'm using django-rest-auth with a custom user model, registration view and serializer. What I'm trying to achieve is an email login instead of username. The api view shows correctly but when I post, I get the error: TypeError at /rest-auth/registration/ save() takes 1 positional argument but 2 were given this is the traceback: http://dpaste.com/2FR3DZY serializer.py class CustomUserSerializer(serializers.ModelSerializer): """Serializer for User objects.""" class Meta: model = models.User

django-rest-auth error - save() takes 1 positional argument but 2 were given

試著忘記壹切 提交于 2020-01-05 09:22:09
问题 I'm using django-rest-auth with a custom user model, registration view and serializer. What I'm trying to achieve is an email login instead of username. The api view shows correctly but when I post, I get the error: TypeError at /rest-auth/registration/ save() takes 1 positional argument but 2 were given this is the traceback: http://dpaste.com/2FR3DZY serializer.py class CustomUserSerializer(serializers.ModelSerializer): """Serializer for User objects.""" class Meta: model = models.User

Django rest registration

给你一囗甜甜゛ 提交于 2020-01-01 06:35:36
问题 I am using Django-rest-auth (https://github.com/Tivix/django-rest-auth) in my django project for login and registration. I see a default registration form as follows: Currently I am being able to register a new user with email instead of username. The default auth_user table in my MySql database has following columns: (id, password,last_login, is_superuser, username, first_name, last_name, email, is_staff, is_active, date_joined) My settings.py : INSTALLED_APPS = ( 'django.contrib.admin',

Django Rest Framework registrations

孤者浪人 提交于 2019-12-25 03:59:18
问题 I have a custom user model class User(AbstractUser): username = None email = models.EmailField( unique=True) phone = models.CharField( max_length=15) is_pro = models.BooleanField(default=False) USERNAME_FIELD = 'email' REQUIRED_FIELDS = ['phone'] objects = UserManager() @property def token(self): """ Allows us to get a user's token by calling `user.token` instead of `user.generate_jwt_token(). The `@property` decorator above makes this possible. `token` is called a "dynamic property". """

How can I do my logic in `http://127.0.0.1:8000/rest-auth/login/` of `django-rest-auth`?

独自空忆成欢 提交于 2019-12-24 17:17:11
问题 How can I do my logic in http://127.0.0.1:8000/rest-auth/login/ of django-rest-auth When I login it is like below and the url is provide by django-rest-auth. How can I write my own logic when I login? 回答1: That page have information about which api endpoints you can override http://django-rest-auth.readthedocs.io/en/latest/configuration.html for login you can use: 'LOGIN_SERIALIZER': 'path.to.custom.LoginSerializer', For realize custom registration logic and serializer I'm recommend to you

How to add the last_login_ip, when the user login if using `rest-auth`?

久未见 提交于 2019-12-24 16:40:46
问题 How to add the last_login_ip, when the user login if using rest-auth ? Befor ask the post I searched one post bellow: How can I do my logic in `http://127.0.0.1:8000/rest-auth/login/` of `django-rest-auth`? The answer is perfect for custom verify the login params. But, how about after login, then add attribute to the User? I mean, the answer is just for verify the data, I want to after user login success, I want to add the last_login_ip to the user instance. EDIT Please be attention, I know