Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1104779
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 17, 20262026-05-17T01:31:55+00:00 2026-05-17T01:31:55+00:00

I have a Django app where there are 2 use cases where I want

  • 0

I have a Django app where there are 2 use cases where I want a user to be able to login without a password.

  1. User registers and gets activation link in e-mail.
  2. User resets password and gets link to change password form in e-mail.

The links include a one-time-use key that I validate, and then I want to log the user in without using credentials.

# This raises an exception unless
# I call user.authenticate 1st.
auth.login(request, user)

How do I acheive this?

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-17T01:31:56+00:00Added an answer on May 17, 2026 at 1:31 am

    You can write your own authentication backend(s) which handles your two use cases. See the docs on writing and using a custom auth backend:
    http://docs.djangoproject.com/en/1.2/topics/auth/#other-authentication-sources

    EDIT:
    There seems there might be some misconception about how difficult it might be to write your own auth backend. From the docs:

    An authentication backend is a class
    that implements two methods:
    get_user(user_id) and
    authenticate(**credentials).

    That’s right. It’s any class that implements two functions both which return User objects.

    The get_user method takes a user_id —
    which could be a username, database ID
    or whatever — and returns a User
    object.

    …authenticate should check the
    credentials it gets, and it should
    return a User object that matches
    those credentials, if the credentials
    are valid. If they’re not valid, it
    should return None.

    The OP has already stated that the links contain one-time keys that he validates (and presumably has associated with the user he wishes to log in). In other words he’s already written the business logic for the backend, he would just need to convert it into an appropirate class.

    Custom authentication backends can do a number of awesome things in Django 1.2 like object level permissions but they don’t have to be that complicated. Plus they stack so you can mix in your token based authentication with the default model backend or OpenID or Facebook. But in the end an auth backend is just class with two methods and I don’t see how you can call that overkill.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a Django app that gets it's data completely from an external source
I have a Django app that use a django-tagging. I need to port this
I have been developing some Django app and there's some duplicated code for different
I have written a Django app that makes use of Python threading to create
I have been intending to use django-notification in my django app. The docs are
I have a Django app set up to use multiple caches (I hope). Is
I have created a django app. Now i want to test the application's performance
So is there any other way to use mysql database with django app on
I have a Django app written in Python 2.5 and I plan to upgrade
I have a Django app where most of the search is driven by foreign

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.