django-authentication

Django / vBulletin single sign on

孤街醉人 提交于 2019-12-01 09:09:43
What is the easiest way to make a single sign on (SSO) for a Django project and a vBulletin board on the same domain? I have an existing database of vBulletin users. I have looked into Django's RemoteUserBackend and vBulletin's vBSSO but I haven't found a complete solution. I doesn't know Django, but when you are up to something like this, search for "bridges". There is a high chance someone have already done that for you. These three source of information can also help you get through doing your own bridge: Drupal Bridge http://drupalcode.org/project/drupalvb.git/blob

Django / vBulletin single sign on

江枫思渺然 提交于 2019-12-01 06:28:17
问题 What is the easiest way to make a single sign on (SSO) for a Django project and a vBulletin board on the same domain? I have an existing database of vBulletin users. I have looked into Django's RemoteUserBackend and vBulletin's vBSSO but I haven't found a complete solution. 回答1: I doesn't know Django, but when you are up to something like this, search for "bridges". There is a high chance someone have already done that for you. These three source of information can also help you get through

Multiple USERNAME_FIELD in django user model

丶灬走出姿态 提交于 2019-12-01 03:56:43
My custom user model: class MyUser(AbstractBaseUser): username = models.CharField(unique=True,max_length=30) email = models.EmailField(unique=True,max_length=75) is_staff = models.IntegerField(default=False) is_active = models.IntegerField(default=False) date_joined = models.DateTimeField(default=None) # Use default usermanager objects = UserManager() USERNAME_FIELD = 'email' Is there a way to specify multiple USERNAME_FIELD ? Something like ['email','username'] so that users can login via email as well as username ? Alasdair The USERNAME_FIELD setting does not support a list. You could create

How can I set a minimum password length when using the built-in Django auth module?

人盡茶涼 提交于 2019-11-30 18:49:41
I’m implementing authentication in a Django site using the built-in auth module , including the built-in UserCreationForm . I’d like to set a minimum length for passwords. However, I can’t find any documentation on how to do this. Can I configure the auth module’s User module to require this at the database level? Or should I sub-class the UserCreationForm (I’m actually doing this already for unrelated reasons) and add an extra validator that enforces the password length? Chris Pratt Especially if you're already using a sub-classed UserCreationForm , I'd say you should definitely just add the

Django Multiple Authentication Backends Based On Status

一笑奈何 提交于 2019-11-30 17:33:55
问题 I was wondering how to tell Django which authentication backend to use based on if the user is marked as staff or if they are not. Can this be done? 回答1: Since the authentication backend is used by Django to get the user object, it is not known at the time we're calling the backend wether the user will be marked as staff or not. Is is still possible to use different backends for staff and non-staff user, by chaining backends as explained in Specifying authentication backends. For example if

Django - detect if user is online / offline

会有一股神秘感。 提交于 2019-11-30 17:07:14
I am using Django 1.10 with Django-REST. I need to know if a user is logged in or not (offline / online) How can I do that? I am using token based authentication. I tried this article but it didn't work for my use case... it seems to be too old Oz Bar-Shalom Ok, After trying a few different things I got it. Here's how I made it work: First create a Middleware to store on memcache the last time the user has accessed the server. import datetime from django.core.cache import cache from django.conf import settings from django.utils.deprecation import MiddlewareMixin class ActiveUserMiddleware

How can I set a minimum password length when using the built-in Django auth module?

戏子无情 提交于 2019-11-30 16:45:56
问题 I’m implementing authentication in a Django site using the built-in auth module, including the built-in UserCreationForm. I’d like to set a minimum length for passwords. However, I can’t find any documentation on how to do this. Can I configure the auth module’s User module to require this at the database level? Or should I sub-class the UserCreationForm (I’m actually doing this already for unrelated reasons) and add an extra validator that enforces the password length? 回答1: Especially if you

Django auth.user with unique email

吃可爱长大的小学妹 提交于 2019-11-30 13:39:56
问题 I use the django.auth system and I've this: class RegisterForm(UserCreationForm): username = forms.RegexField(label= "Username" , max_length = 30, regex = r'^[\w]+$', error_messages = {'invalid': "This value may contain only letters, numbers and _ characters."}) email = forms.EmailField(label = "Email") first_name = forms.CharField(label = "First name", required = False) last_name = forms.CharField(label = "Last name", required = False) class Meta: model = User fields = ("username", "first

Django Remote Authentication without redirecting

杀马特。学长 韩版系。学妹 提交于 2019-11-30 13:31:39
问题 In my application I need to authenticate users via my REST API. So I have a form with user/pass fields, and after submitting it, I'd like to proceed directly to the 'next' page. So apparently I need to submit my form via AJAX, as I don't want to be redirected to the API page. But how then the RemoteUserMiddleware will know that my user should be authenticated if the request will be processed by javascript ? 回答1: To my understanding of the system architecture you have currently looks something

Inform user that email is invalid using Django's Password Reset

房东的猫 提交于 2019-11-30 13:01:37
问题 I am using the built-in django password reset functionality. The documentation states: If the email address provided does not exist in the system, this view won’t send an email, but the user won’t receive any error message either. This prevents information leaking to potential attackers. If you want to provide an error message in this case, you can subclass PasswordResetForm and use the password_reset_form argument. However, in my case it's more important to show an error message when a user