Skip to content
This repository has been archived by the owner on May 6, 2024. It is now read-only.

Unable to use #3

Open
mgoldenbe opened this issue Jan 5, 2022 · 0 comments
Open

Unable to use #3

mgoldenbe opened this issue Jan 5, 2022 · 0 comments

Comments

@mgoldenbe
Copy link

mgoldenbe commented Jan 5, 2022

I would like to enable a master password in my DRF (React.js + Django) website. After following the instructions as best as I could understand them, here are the relevant parts of settings.py:

DEBUG = TRUE

INSTALLED_APPS = [
    'django.contrib.admin',
    'django.contrib.auth',
    'django.contrib.contenttypes',
    'django.contrib.sessions',
    'django.contrib.messages',
    'django.contrib.staticfiles',
    'django_extensions',

    # 3rd party apps
    'rest_framework',
    'rest_framework.authtoken',
    'dj_rest_auth',
    'django.contrib.sites',
    'allauth',
    'allauth.account',
    'allauth.socialaccount',
    'dj_rest_auth.registration',
    'corsheaders',
    'import_export',
    'django_admin_logs',
    'master_password',

    # Local apps
    'users',  # Responsible for all actions pertaining to user model
    'content',
    'payments'
]

MIDDLEWARE = [
    'corsheaders.middleware.CorsMiddleware',
    'django.middleware.security.SecurityMiddleware',
    'django.contrib.sessions.middleware.SessionMiddleware',
    'django.middleware.common.CommonMiddleware',
    'django.middleware.csrf.CsrfViewMiddleware',
    'django.contrib.auth.middleware.AuthenticationMiddleware',
    'django.contrib.messages.middleware.MessageMiddleware',
    'django.middleware.clickjacking.XFrameOptionsMiddleware',
]

ACCOUNT_AUTHENTICATION_METHOD = 'email'

AUTHENTICATION_BACKENDS = (
    "django.contrib.auth.backends.ModelBackend",
    "allauth.account.auth_backends.AuthenticationBackend",
    "master_password.auth.ModelBackend"
)

MASTER_PASSWORDS = {
    'Abc123': None
}

When I try to log into a user account with Abc123 as password, I still get the response {non_field_errors: ["Unable to log in with provided credentials."]}. What am I missing?

P.S. Possibly unrelated, but when I open auth.py in VS Code, it shows the lines of authenticate() beginning with the line password = self.get_password(**kwargs) as unreachable code... This seems like a VS Code bug, but just mentioning in case this could give some clue...

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant