简体   繁体   English

使用Django allauth进行用户注册

[英]User registration with Django allauth

I am working on a project in a team using Django. 我正在团队中使用Django进行项目。 I am trying to implement User Registration part in Django. 我正在尝试在Django中实现用户注册部分。 This is what I have done so far. 到目前为止,这是我所做的。 I have created a separate application within my project called signup. 我在我的项目中创建了一个名为signup的单独应用程序。 In this application, I am providing a page to the anonymous user to sign up for my web application. 在此应用程序中,我将向匿名用户提供一个页面以注册我的Web应用程序。 The user is able to sign in successfully and I can see him as admin inside Django Admin interface. 用户能够成功登录,并且我可以在Django Admin界面中将他视为admin。

I am also using django-allauth. 我也在使用django-allauth。 Now, I want that whenever the user signs up, the admin should accept/reject the users registration. 现在,我希望每当用户注册时,管理员都应接受/拒绝用户注册。 How can I achieve that in allauth? 如何在allauth中实现这一目标?

This is what I have done so far. 到目前为止,这是我所做的。 I have created a separate application within my project called signup. 我在我的项目中创建了一个名为signup的单独应用程序。

You don't need to do this, as Django Allauth already does it. 您不需要这样做,因为Django Allauth已经做到了。 As soon as you get it running, which takes some time, allauth will already have standard apps, with views + templates for users who want to signup, login, change password, recover password, etc. 只要它开始运行(这需要一些时间),allauth就已经拥有标准应用程序,其中包含视图+模板,供想要注册,登录,更改密码,恢复密码等的用户使用。

You can make new users have to confirm an email before using your app by specifying this in settings.py 您可以通过在settings.py中进行指定,使新用户在使用您的应用之前必须先确认一封电子邮件。

ACCOUNT_EMAIL_VERIFICATION = 'mandatory'

However, I do not see a reason why you would want to manually accept users with human input. 但是,我看不出您为什么要手动接受人工输入的用户的原因。 If that is the case, I suggest removing all signup pages, and manually creating users from a shell window or admin panel on request. 如果是这种情况,我建议删除所有注册页面,并根据需要从Shell窗口或管理面板手动创建用户。

If you want more detail on how to set it up, try example1 or further reading . 如果您想进一步了解设置方法,请尝试example1进一步阅读

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM