mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-16 07:08:55 +00:00
Update social_django and profile
This commit is contained in:
@@ -5,7 +5,6 @@ from django.apps import apps
|
||||
from django.conf import settings
|
||||
from django.contrib import messages
|
||||
from django.contrib.messages.api import MessageFailure
|
||||
from django.core.urlresolvers import reverse
|
||||
from django.shortcuts import redirect
|
||||
from django.utils.http import urlquote
|
||||
|
||||
@@ -52,8 +51,6 @@ class SocialAuthExceptionMiddleware(MiddlewareMixin):
|
||||
|
||||
if url:
|
||||
return redirect(url)
|
||||
else:
|
||||
return redirect(reverse('edit_profile'))
|
||||
|
||||
def raise_exception(self, request, exception):
|
||||
strategy = getattr(request, 'social_strategy', None)
|
||||
|
@@ -1,20 +0,0 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
# Generated by Django 1.11.15 on 2018-11-15 08:25
|
||||
from __future__ import unicode_literals
|
||||
|
||||
from django.db import migrations, models
|
||||
|
||||
|
||||
class Migration(migrations.Migration):
|
||||
|
||||
dependencies = [
|
||||
('social_django', '0001_initial'),
|
||||
]
|
||||
|
||||
operations = [
|
||||
migrations.AlterField(
|
||||
model_name='usersocialauth',
|
||||
name='uid',
|
||||
field=models.CharField(max_length=150),
|
||||
),
|
||||
]
|
@@ -19,7 +19,7 @@ from .managers import UserSocialAuthManager
|
||||
USER_MODEL = getattr(settings, setting_name('USER_MODEL'), None) or \
|
||||
getattr(settings, 'AUTH_USER_MODEL', None) or \
|
||||
'auth.User'
|
||||
UID_LENGTH = getattr(settings, setting_name('UID_LENGTH'), 150)
|
||||
UID_LENGTH = getattr(settings, setting_name('UID_LENGTH'), 255)
|
||||
EMAIL_LENGTH = getattr(settings, setting_name('EMAIL_LENGTH'), 254)
|
||||
NONCE_SERVER_URL_LENGTH = getattr(
|
||||
settings, setting_name('NONCE_SERVER_URL_LENGTH'), 255)
|
||||
@@ -148,3 +148,12 @@ class DjangoStorage(BaseDjangoStorage):
|
||||
@classmethod
|
||||
def is_integrity_error(cls, exception):
|
||||
return exception.__class__ is IntegrityError
|
||||
|
||||
########## handle signals
|
||||
from django.dispatch import receiver
|
||||
from registration.signals import user_deleted
|
||||
|
||||
@receiver(user_deleted)
|
||||
def user_deleted_cb(sender, **kwargs):
|
||||
username = kwargs['username']
|
||||
UserSocialAuth.objects.filter(username=username).delete()
|
||||
|
@@ -74,8 +74,7 @@ class DjangoUserMixin(UserMixin):
|
||||
assert 'username' in kwargs
|
||||
|
||||
user = User.objects.create_user(email=kwargs['username'],
|
||||
is_active=True,
|
||||
save_profile=False)
|
||||
is_active=True)
|
||||
|
||||
# try:
|
||||
# if hasattr(transaction, 'atomic'):
|
||||
|
Reference in New Issue
Block a user