django-authentication

How to hash stored passwords in mysql using pbkdf2_sha256 using Django

How to hash stored passwords in mysql using pbkdf2_sha256 using Django Question: I have list of user passwords stored as plain text. I think I need a script to run over the stored passwords and hash them. I’m new to Django and not sure where to start or how. I created login and creating accounts …

Total answers: 1

How to pass change_password.html to replace Django Admin Password Reset

How to pass change_password.html to replace Django Admin Password Reset Question: Currently in my urls.py I have the following links for user to reset their password app_name = ‘users’ urlpatterns = [ path(‘password/’, user_views.change_password, name=’change_password’), path(‘password-reset/’, auth_views.PasswordResetView.as_view(template_name=’users/password_reset.html’, success_url=reverse_lazy(‘users:password_reset_done’)), name=’password_reset’), path(‘password-reset/done/’, auth_views.PasswordResetDoneView.as_view(template_name=’users/password_reset_done.html’),name=’password_reset_done’), path(‘password-reset-confirm/<uidb64>/<token>/’,auth_views.PasswordResetConfirmView.as_view(template_name=’users/change_password.html’,success_url=reverse_lazy(‘users:password_reset_complete’)),name=’password_reset_confirm’), path(‘password-reset-complete/’, auth_views.PasswordResetCompleteView.as_view(template_name=’users/password_reset_complete.html’),name=’password_reset_complete’), ] here is the change_password.html <main class="mt-5" > <div class="container dark-grey-text …

Total answers: 1

create superuser in django custom User model with phone number as username

create superuser in django custom User model with phone number as username Question: I have a django project which I want it to have phone number as its username field. I’ve created an app named accounts, and this is the models.py: class UserManager(BaseUserManager): use_in_migrations = True def create_user(self, phone_number, password, **extra_fields): user = self.model(phone_number=phone_number, **extra_fields) …

Total answers: 3

Custom django data migration creating records allauth.account EmailAddress model returns error – django.db.migrations.exceptions.NodeNotFoundError:

Custom django data migration creating records allauth.account EmailAddress model returns error – django.db.migrations.exceptions.NodeNotFoundError: Question: I am upgrading a django project that was created with the default django auth. Email verification was implemented with the django.contrib.auth.tokens package. The way it worked was that the ‘is_active’ flag of the default django user which itself is extended with …

Total answers: 2

How to update User model in Django using signals.py

How to update User model in Django using signals.py Question: how can I update the user model first_name and last_name in Django using signals.py when a new user updates first_name and last_name in custom registration form? This is my signals.py for creating a custom separate user details model using Django @receiver(post_save, sender=settings.AUTH_USER_MODEL) def create_profile_handler(sender, instance, …

Total answers: 1

Django: Custom User Model with Autoincrementing Id

Django: Custom User Model with Autoincrementing Id Question: I am trying to use Django Authentication and I want to create a custom model for the user that has an autoincrementing integer as id. I know about uuid library, but I want the id to be an integer number, that is why I want to avoid …

Total answers: 1

How to redirect logged in user with url params?

How to redirect logged in user with url params? Question: In my Django project I am trying to make the http://127.0.0.1:8000/ which is the home page to redirect to the Login in Page if user is not logged in however there is a user who is logged in I want http://127.0.0.1:8000/ to become http://127.0.0.1:8000/username/ I …

Total answers: 1

MultiValueDictKeyError at /signup

MultiValueDictKeyError at /signup Question: I am creating a login in page in django but facing the issue MultiValueDictKeyError at /signup Below is views.py ”’ from django.shortcuts import render, redirect from django.http import HttpResponse from django.contrib.auth.models import User from django.contrib import messages def home(request): return render(request, "authentication/index.html") def signup(request): if request.method == "POST": uname = request.POST[‘uname’] …

Total answers: 1

How can I log a user in without password in django?

How can I log a user in without password in django? Question: I am trying to log a user in and I currently only know the user’s email but I know for a fact that it’s the correct user. The user has created a password and this is not a log in page. So the …

Total answers: 1

AttributeError: module 'profile' has no attribute 'run'

AttributeError: module 'profile' has no attribute 'run' Question: So I have an extended User model (extended AbstractUser) called Profile. This was in a seperate app called “profiles”. I was plugging in the standard login and realised it was looking for a “profile” app name as standard, so I renamed it (directories, code, DB schema) which …

Total answers: 3