mirror of https://github.com/jumpserver/jumpserver
[Update] 修改一些bug
parent
311538dcf8
commit
c82044f6bc
|
@ -88,7 +88,10 @@ class LDAPUser(_LDAPUser):
|
|||
def _populate_user_from_attributes(self):
|
||||
super()._populate_user_from_attributes()
|
||||
if not hasattr(self._user, 'email') or '@' not in self._user.email:
|
||||
if '@' not in self._user.username:
|
||||
email = '{}@{}'.format(self._user.username, settings.EMAIL_SUFFIX)
|
||||
else:
|
||||
email = self._user.username
|
||||
setattr(self._user, 'email', email)
|
||||
|
||||
|
||||
|
|
|
@ -193,7 +193,7 @@ class Config(dict):
|
|||
if self.root_path:
|
||||
filename = os.path.join(self.root_path, filename)
|
||||
try:
|
||||
with open(filename) as f:
|
||||
with open(filename, 'rt', encoding='utf8') as f:
|
||||
obj = yaml.load(f)
|
||||
except IOError as e:
|
||||
if silent and e.errno in (errno.ENOENT, errno.EISDIR):
|
||||
|
|
|
@ -6,12 +6,15 @@ from celery import Celery
|
|||
|
||||
# set the default Django settings module for the 'celery' program.
|
||||
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'jumpserver.settings')
|
||||
|
||||
from django.conf import settings
|
||||
from jumpserver import settings
|
||||
# from django.conf import settings
|
||||
|
||||
app = Celery('jumpserver')
|
||||
|
||||
configs = {k: v for k, v in settings.__dict__.items() if k.startswith('CELERY')}
|
||||
# Using a string here means the worker will not have to
|
||||
# pickle the object when using Windows.
|
||||
app.config_from_object('django.conf:settings', namespace='CELERY')
|
||||
# app.config_from_object('django.conf:settings', namespace='CELERY')
|
||||
app.namespace = 'CELERY'
|
||||
app.conf.update(configs)
|
||||
app.autodiscover_tasks(lambda: [app_config.split('.')[0] for app_config in settings.INSTALLED_APPS])
|
||||
|
|
|
@ -14,8 +14,12 @@ class SwitchOrgView(DetailView):
|
|||
pk = kwargs.get('pk')
|
||||
self.object = Organization.get_instance(pk)
|
||||
request.session['oid'] = self.object.id.__str__()
|
||||
referer = request.META.get('HTTP_REFERER', reverse('index'))
|
||||
host = request.get_host()
|
||||
referer = request.META.get('HTTP_REFERER')
|
||||
if referer.find(host) != -1:
|
||||
return redirect(referer)
|
||||
else:
|
||||
return redirect('index')
|
||||
|
||||
|
||||
class SwitchToAOrgView(View):
|
||||
|
|
Loading…
Reference in New Issue