django-social-auth django-registration和django-profiles - 在一起 [英] django-social-auth django-registration and django-profiles -- together

查看:119
本文介绍了django-social-auth django-registration和django-profiles - 在一起的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有人使用 django-social-auth django-registration django-profiles 在一起。他们一起工作吗?我建立了社会认证,但我读到了 django-allauth 更好的地方。我应该切换到

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?

请指教

更新:

我在我的项目中使用了 allauth ,它的工作正常。您不需要使用 django-registration 与allauth,因为它是集成在其中。但是我使用的是自定义用户配置文件,这比 django-profiles 更好。

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.

推荐答案

他们一起工作很好 - 我只是在另一天设置(除了我不需要使用django配置文件,因为它很容易创建自己的)。

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-registration设置一个普通帐户(contrib.auth),发送一个要确认的电子邮件 - 在DB中创建用户名/电子邮件/密码。

  • 或者,他们可以使用twitter / facebook / google等方式立即登录,并使用虚拟密码(可能没有电子邮件)自动创建一个contribauth用户。

一些要点和限制:


  • 当您使用社交媒体配置文件登录时,会自动创建一个contrib.auth.user。如果该用户名已经存在,则附加UUID - 这是丑陋的,django-social-auth似乎还没有处理这个问题 - 一个简单的解决方案是允许用户在注册后更改用户名即可。理想情况下,当您使用twitter登录时,您将有机会将其细节保存到数据库(而不是之前)中。

  • 同样,设置一个虚拟密码 - 这样很难允许用户使用内置的django密码更改表单重置密码,因为它们将无法输入其现有密码(因为它被设置为不重叠的字符串)

  • 你需要考虑什么时候用twitter注册的用户想要后来关联他们的Facebook帐户 - django-social-auth帐户,并且可以轻松地使用一个帐户关联多个第三方登录

  • Twitter不会透露用户电子邮件地址,因此您可能希望提示他们将其提供给您并将其保存到数据库中 - 此问题是您需要验证它这不符合使用社会认证的整个目的!

  • 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)
  • 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)
  • 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 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!

django-social-auth是一个伟大的项目,正在被激活y开发了一个<罢工>群组在 Google群组这是永远是最新的,所以我一定会建议。这也很容易设置 - 只要确保你已经排除了你的登录流程,并且你知道使用这个的潜在限制。

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 已成为 python-social-auth

  • django-allauth :OP提到了 django-allauth ,最近很受欢迎。我没有使用它,但它似乎是一个伟大的替代替代身份验证,注册和配置文件。

  • 可配置用户模型:Django 1.5引入了 auth 模块中的可配置用户模型> configuratble用户模型,以便现在可以编辑要为用户使用的字段(仅限电子邮件,没有用户名等)。如果您想在不需要加入其他表格的情况下,向用户添加类似个人资料的信息(例如,您可以使用 django-profiles OneToOne 与自定义配置文件模型的关系)

  • django-social-auth has become 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.
  • 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-social-auth django-registration和django-profiles - 在一起的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆