django-social-auth django-registration和django-profiles - 在一起

时间:2021-05-05 19:18:27

Has anyone used django-social-auth, django-registration and django-profiles together. Do they work well together? I have established social-auth but I read somewhere that django-allauth is better. Should I switch over to that?

有没有人一起使用django-social-auth,django-registration和django-profiles。他们一起工作得好吗?我已经建立了社交认证,但我在某处读到django-allauth更好。我应该切换到那个吗?

Please advise

请指教

Update:

更新:

I have used allauth in my project and it is working fine. You don't need to use django-registration with allauth because that is integrated within. However I am using custom user profiles and that is a better option than the django-profiles.

我在我的项目中使用了allauth并且工作正常。你不需要在allauth中使用django-registration,因为它集成在内。但是我使用自定义用户配置文件,这是一个比django-profiles更好的选择。

1 个解决方案

#1


34  

They work fine together - I just set this up the other day (except I didn't need to use django-profiles as it's as easy to create your own).

它们可以很好地协同工作 - 我只是在前几天设置它(除了我不需要使用django-profiles,因为它很容易创建自己的)。

  • A user can set up a normal account (contrib.auth) using django-registration which sends out an email to be confirmed - creating a username/email/password in the DB.
  • 用户可以使用django-registration设置普通帐户(contrib.auth),该帐户会发送要确认的电子邮件 - 在数据库中创建用户名/电子邮件/密码。
  • Alternatively they can sign in straight away with twitter/facebook/google etc. and a contrib.auth user is created for them automatically with a dummy password (and potentially no email).
  • 或者,他们可以使用twitter / facebook / google等直接登录,并使用虚拟密码(可能没有电子邮件)自动为他们创建contrib.auth用户。

Some points and limitations:

一些要点和限制:

  • When you sign in with a social media profile, a contrib.auth.user is automatically created. If that username already exists, a UUID is appended - this is ugly and django-social-auth doesn't seem to deal with this problem yet - an easy solution is to allow the user to change their username after they sign up. Ideally, when you sign in with twitter you are given the chance to refine your details before they are saved to the DB (instead of after)
  • 使用社交媒体配置文件登录时,会自动创建contrib.auth.user。如果该用户名已经存在,则会附加UUID - 这很难看,django-social-auth似乎还没有解决这个问题 - 一个简单的解决方案是允许用户在注册后更改用户名。理想情况下,当您使用Twitter登录时,您有机会在将详细信息保存到数据库之前(而不是之后)优化您的详细信息
  • Similarly, a dummy password is set - this makes it difficult to allow the user to reset the password using the built in django password change-form as they will not be able to enter their existing password (as it's set as an unhashble string)
  • 类似地,设置了一个虚拟密码 - 这使得用户很难使用内置的django密码更改表单来重置密码,因为他们无法输入现有的密码(因为它设置为不可用的字符串)
  • You need to consider when a user that signs up with twitter wants to later associate their facebook account - django-social-auth accounts for this and it's easy to assoicate multiple 3rd party sign ins with one account
  • 您需要考虑注册Twitter的用户何时想要关联他们的Facebook帐户 - django-social-auth帐户,并且很容易通过一个帐户分配多个第三方登录
  • Twitter doesn't disclose a users email address so you might want to prompt them to provide it to you and save it to the database - the problem with this is that you will then need to verify it which negates the whole purpose of using social-auth!
  • Twitter没有透露用户的电子邮件地址,因此您可能希望提示他们将其提供给您并将其保存到数据库中 - 这样做的问题是您需要验证它否定了使用社交的全部目的 - AUTH!

django-social-auth is a great project and is being actively developed with a group on convore Google Group that is always up to date so I would certainly suggest it. It's also very easy to set up - just be sure you have ironed out your login flow, and you know of the potential limitations of using this

django-social-auth是一个伟大的项目,正在积极开发与谷歌集团的一个团队,总是最新的,所以我肯定会建议。它也很容易设置 - 只要确保你已经解决了登录流程,并且你知道使用它的潜在局限性

EDIT:

编辑:

This post is a little outdated

这篇文章有点过时了

  • django-social-auth has become python-social-auth
  • django-social-auth已成为python-social-auth
  • django-allauth: OP mentioned django-allauth which has gotten popular recently. I haven't used it but it seems to be a great drop-in replacement for authentication, registration and profiles.
  • django-allauth:OP提到最近流行的django-allauth。我没有使用它,但它似乎是认证,注册和配置文件的一个很好的替代品。
  • Configurable User Models: Django 1.5 introduced a configuratble User models in the auth module so you can now edit what fields you want to make use of for your user (email only, no username etc.). This is also useful if you want to add profile-like information to your user without having to join with another table (like you would with django-profiles or a OneToOne relationship with a custom profile model)
  • 可配置的用户模型:Django 1.5在auth模块中引入了可配置的用户模型,因此您现在可以编辑要为您的用户使用的字段(仅限电子邮件,无用户名等)。如果您想要向用户添加类似于类似配置文件的信息而不必与另一个表连接(如使用django-profiles或与自定义配置文件模型的OneToOne关系),这也很有用。

#1


34  

They work fine together - I just set this up the other day (except I didn't need to use django-profiles as it's as easy to create your own).

它们可以很好地协同工作 - 我只是在前几天设置它(除了我不需要使用django-profiles,因为它很容易创建自己的)。

  • A user can set up a normal account (contrib.auth) using django-registration which sends out an email to be confirmed - creating a username/email/password in the DB.
  • 用户可以使用django-registration设置普通帐户(contrib.auth),该帐户会发送要确认的电子邮件 - 在数据库中创建用户名/电子邮件/密码。
  • Alternatively they can sign in straight away with twitter/facebook/google etc. and a contrib.auth user is created for them automatically with a dummy password (and potentially no email).
  • 或者,他们可以使用twitter / facebook / google等直接登录,并使用虚拟密码(可能没有电子邮件)自动为他们创建contrib.auth用户。

Some points and limitations:

一些要点和限制:

  • When you sign in with a social media profile, a contrib.auth.user is automatically created. If that username already exists, a UUID is appended - this is ugly and django-social-auth doesn't seem to deal with this problem yet - an easy solution is to allow the user to change their username after they sign up. Ideally, when you sign in with twitter you are given the chance to refine your details before they are saved to the DB (instead of after)
  • 使用社交媒体配置文件登录时,会自动创建contrib.auth.user。如果该用户名已经存在,则会附加UUID - 这很难看,django-social-auth似乎还没有解决这个问题 - 一个简单的解决方案是允许用户在注册后更改用户名。理想情况下,当您使用Twitter登录时,您有机会在将详细信息保存到数据库之前(而不是之后)优化您的详细信息
  • Similarly, a dummy password is set - this makes it difficult to allow the user to reset the password using the built in django password change-form as they will not be able to enter their existing password (as it's set as an unhashble string)
  • 类似地,设置了一个虚拟密码 - 这使得用户很难使用内置的django密码更改表单来重置密码,因为他们无法输入现有的密码(因为它设置为不可用的字符串)
  • You need to consider when a user that signs up with twitter wants to later associate their facebook account - django-social-auth accounts for this and it's easy to assoicate multiple 3rd party sign ins with one account
  • 您需要考虑注册Twitter的用户何时想要关联他们的Facebook帐户 - django-social-auth帐户,并且很容易通过一个帐户分配多个第三方登录
  • Twitter doesn't disclose a users email address so you might want to prompt them to provide it to you and save it to the database - the problem with this is that you will then need to verify it which negates the whole purpose of using social-auth!
  • Twitter没有透露用户的电子邮件地址,因此您可能希望提示他们将其提供给您并将其保存到数据库中 - 这样做的问题是您需要验证它否定了使用社交的全部目的 - AUTH!

django-social-auth is a great project and is being actively developed with a group on convore Google Group that is always up to date so I would certainly suggest it. It's also very easy to set up - just be sure you have ironed out your login flow, and you know of the potential limitations of using this

django-social-auth是一个伟大的项目,正在积极开发与谷歌集团的一个团队,总是最新的,所以我肯定会建议。它也很容易设置 - 只要确保你已经解决了登录流程,并且你知道使用它的潜在局限性

EDIT:

编辑:

This post is a little outdated

这篇文章有点过时了

  • django-social-auth has become python-social-auth
  • django-social-auth已成为python-social-auth
  • django-allauth: OP mentioned django-allauth which has gotten popular recently. I haven't used it but it seems to be a great drop-in replacement for authentication, registration and profiles.
  • django-allauth:OP提到最近流行的django-allauth。我没有使用它,但它似乎是认证,注册和配置文件的一个很好的替代品。
  • Configurable User Models: Django 1.5 introduced a configuratble User models in the auth module so you can now edit what fields you want to make use of for your user (email only, no username etc.). This is also useful if you want to add profile-like information to your user without having to join with another table (like you would with django-profiles or a OneToOne relationship with a custom profile model)
  • 可配置的用户模型:Django 1.5在auth模块中引入了可配置的用户模型,因此您现在可以编辑要为您的用户使用的字段(仅限电子邮件,无用户名等)。如果您想要向用户添加类似于类似配置文件的信息而不必与另一个表连接(如使用django-profiles或与自定义配置文件模型的OneToOne关系),这也很有用。