【问题标题】:django-registration disable activationdjango-registration 禁用激活
【发布时间】:2012-11-07 09:43:08
【问题描述】:

django-registration 中是否有禁用激活的设置?最好,电子邮件仍会以如下形式发送:Thanks for your registration.

  1. 是否可以停用所需的帐户激活以及如何停用?
  2. 是否仍然可以发送激活电子邮件但没有验证要求?

【问题讨论】:

    标签: django django-registration


    【解决方案1】:

    是的,您可以使用simple backend

    【讨论】:

      【解决方案2】:

      我知道这是一个老问题,但如果有人仍在寻找解决方案, 这是一个基于 django-registration 提供的特定“user_activated”信号的选项。

      根据原始问题的要求,激活被静默撤销,并且 用户不知道这一点。

      from django.dispatch import receiver
      from registration.signals import user_activated
      
      
      def remove_user_activation(user):
          """
          Replace with specific app logic
          """
          return True
      
      
      @receiver(user_activated)
      def on_user_activated(sender, **kwargs):
          """
          Revoke activation to robot users
          """
      
          user = kwargs['user']
      
          if remove_user_activation(user):
              if user.is_active:
                  user.is_active = False
                  user.save()
      

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2011-05-16
        • 2016-08-01
        • 1970-01-01
        • 2011-06-22
        • 2013-01-12
        • 1970-01-01
        相关资源
        最近更新 更多