Beispiel #1
0
def password_changed_signal(sender, instance, **kwargs):
    """
    Regenerate token on password change
    :param sender:
    :param instance:
    :param kwargs:
    :return:
    """
    try:
        user = get_user_model().objects.get(pk=instance.pk)
        if user.password != instance.password:
            update_token(user.username)
    except User.DoesNotExist:
        pass
Beispiel #2
0
def password_changed_signal(sender, instance, **kwargs):
    """
    Regenerate token on password change
    :param sender:
    :param instance:
    :param kwargs:
    :return:
    """
    mail_subect = _('Nextcloud Appstore password changed')
    mail_message = _("Your Appstore password has changed.  Contact\
    support if this wasn't you.")

    try:
        user = get_user_model().objects.get(pk=instance.pk)
        if user.password != instance.password:
            update_token(user.username)
            send_mail(mail_subect, mail_message, settings.NEXTCLOUD_FROM_EMAIL,
                      [user.email], False)
    except User.DoesNotExist:
        pass
Beispiel #3
0
def password_changed_signal(sender, instance, **kwargs):
    """
    Regenerate token on password change
    :param sender:
    :param instance:
    :param kwargs:
    :return:
    """
    mail_subect = _('Nextcloud Appstore password changed')
    mail_message = _("Your Appstore password has changed.  Contact\
    support if this wasn't you.")

    try:
        user = get_user_model().objects.get(pk=instance.pk)
        if user.password != instance.password:
            update_token(user.username)
            send_mail(
                    mail_subect,
                    mail_message,
                    settings.DEFAULT_FROM_EMAIL,
                    [user.email],
                    False)
    except User.DoesNotExist:
        pass
Beispiel #4
0
 def post(self, request, *args, **kwargs):
     return Response({'token': update_token(request.user.username).key})
Beispiel #5
0
 def post(self, request, *args, **kwargs):
     return Response({'token': update_token(request.user.username).key})
Beispiel #6
0
 def handle(self, *args, **options):
     username = options['username']
     token = update_token(username, options.get('token', None))
     msg = 'Successfully set token %s for user %s' % (token.key, username)
     self.stdout.write(self.style.SUCCESS(msg))
Beispiel #7
0
 def handle(self, *args, **options):
     username = options['username']
     token = update_token(username, options.get('token', None))
     msg = 'Successfully set token %s for user %s' % (token.key, username)
     self.stdout.write(self.style.SUCCESS(msg))