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
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
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
def post(self, request, *args, **kwargs): return Response({'token': update_token(request.user.username).key})
def post(self, request, *args, **kwargs): return Response({'token': update_token(request.user.username).key})
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))
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))