mirror of
https://github.com/haiwen/seahub.git
synced 2025-09-10 19:29:56 +00:00
Merge branch 'develop'
Conflicts: templates/base.html
This commit is contained in:
@@ -7,7 +7,7 @@ These are referenced from the setting TEMPLATE_CONTEXT_PROCESSORS and used by
|
|||||||
RequestContext.
|
RequestContext.
|
||||||
"""
|
"""
|
||||||
from settings import SEAFILE_VERSION, SITE_TITLE, SITE_NAME, SITE_BASE, \
|
from settings import SEAFILE_VERSION, SITE_TITLE, SITE_NAME, SITE_BASE, \
|
||||||
ENABLE_SIGNUP, MAX_FILE_NAME
|
ENABLE_SIGNUP, MAX_FILE_NAME, BRANDING_CSS, LOGO_PATH, LOGO_URL
|
||||||
try:
|
try:
|
||||||
from settings import BUSINESS_MODE
|
from settings import BUSINESS_MODE
|
||||||
except ImportError:
|
except ImportError:
|
||||||
@@ -35,6 +35,9 @@ def base(request):
|
|||||||
return {
|
return {
|
||||||
'seafile_version': SEAFILE_VERSION,
|
'seafile_version': SEAFILE_VERSION,
|
||||||
'site_title': SITE_TITLE,
|
'site_title': SITE_TITLE,
|
||||||
|
'branding_css': BRANDING_CSS,
|
||||||
|
'logo_path': LOGO_PATH,
|
||||||
|
'logo_url': LOGO_URL,
|
||||||
'business_mode': BUSINESS_MODE,
|
'business_mode': BUSINESS_MODE,
|
||||||
'cloud_mode': request.cloud_mode,
|
'cloud_mode': request.cloud_mode,
|
||||||
'org': org,
|
'org': org,
|
||||||
|
17
settings.py
17
settings.py
@@ -3,6 +3,9 @@
|
|||||||
import sys
|
import sys
|
||||||
import os
|
import os
|
||||||
import re
|
import re
|
||||||
|
import random
|
||||||
|
import string
|
||||||
|
|
||||||
|
|
||||||
DEBUG = False
|
DEBUG = False
|
||||||
TEMPLATE_DEBUG = DEBUG
|
TEMPLATE_DEBUG = DEBUG
|
||||||
@@ -204,7 +207,11 @@ REGISTRATION_SEND_MAIL = False
|
|||||||
CCNET_APPLET_ROOT = "http://127.0.0.1:13420"
|
CCNET_APPLET_ROOT = "http://127.0.0.1:13420"
|
||||||
|
|
||||||
# Account initial password, for password resetting.
|
# Account initial password, for password resetting.
|
||||||
INIT_PASSWD = '123456'
|
# INIT_PASSWD can either be a string, or a function (function has to be set without the brackets)
|
||||||
|
def genpassword():
|
||||||
|
return ''.join([random.choice(string.digits + string.letters) for i in range(0, 10)])
|
||||||
|
|
||||||
|
INIT_PASSWD = genpassword
|
||||||
|
|
||||||
# browser tab title
|
# browser tab title
|
||||||
SITE_TITLE = 'Private Seafile'
|
SITE_TITLE = 'Private Seafile'
|
||||||
@@ -213,6 +220,14 @@ SITE_TITLE = 'Private Seafile'
|
|||||||
SITE_BASE = 'http://seafile.com'
|
SITE_BASE = 'http://seafile.com'
|
||||||
SITE_NAME = 'Seafile'
|
SITE_NAME = 'Seafile'
|
||||||
|
|
||||||
|
# Path to the Logo Imagefile (relative to the media path)
|
||||||
|
LOGO_PATH = 'img/logo.png'
|
||||||
|
# URL to which the logo links
|
||||||
|
LOGO_URL = SITE_BASE
|
||||||
|
|
||||||
|
# css to modify the seafile css
|
||||||
|
BRANDING_CSS = ''
|
||||||
|
|
||||||
# Using Django to server static file. Set to `False` if deployed behide a web
|
# Using Django to server static file. Set to `False` if deployed behide a web
|
||||||
# server.
|
# server.
|
||||||
SERVE_STATIC = True
|
SERVE_STATIC = True
|
||||||
|
@@ -15,6 +15,7 @@
|
|||||||
<link rel="shortcut icon" href="{{ MEDIA_URL }}img/favicon.ico?t=1366090560"/>
|
<link rel="shortcut icon" href="{{ MEDIA_URL }}img/favicon.ico?t=1366090560"/>
|
||||||
<![endif]-->
|
<![endif]-->
|
||||||
{% block extra_style %}{% endblock %}
|
{% block extra_style %}{% endblock %}
|
||||||
|
{% if branding_css != '' %}<style>{{branding_css}}</style>{% endif %}
|
||||||
</head>
|
</head>
|
||||||
|
|
||||||
<body>
|
<body>
|
||||||
@@ -62,8 +63,8 @@
|
|||||||
<div id="header">
|
<div id="header">
|
||||||
<div id="header-inner">
|
<div id="header-inner">
|
||||||
{% block notice_panel %}{% endblock %}
|
{% block notice_panel %}{% endblock %}
|
||||||
<a href="http://seafile.com/" id="logo" class="fleft">
|
<a href="{{logo_url}}" id="logo" class="fleft">
|
||||||
<img src="{{ MEDIA_URL }}img/logo.png?t=1366090560" title="Seafile" alt="Seafile logo" />
|
<img src="{{ MEDIA_URL }}{{ logo_path }}" title="Seafile" alt="Seafile logo" />
|
||||||
</a>
|
</a>
|
||||||
{% block nav %}{% endblock %}
|
{% block nav %}{% endblock %}
|
||||||
|
|
||||||
|
@@ -1472,27 +1472,31 @@ def user_reset(request, user_id):
|
|||||||
"""Reset password for user."""
|
"""Reset password for user."""
|
||||||
try:
|
try:
|
||||||
user = User.objects.get(id=int(user_id))
|
user = User.objects.get(id=int(user_id))
|
||||||
user.set_password(INIT_PASSWD)
|
if isinstance(INIT_PASSWD, FunctionType):
|
||||||
|
new_password = INIT_PASSWD()
|
||||||
|
else:
|
||||||
|
new_password = INIT_PASSWD
|
||||||
|
user.set_password(new_password)
|
||||||
user.save()
|
user.save()
|
||||||
|
|
||||||
if IS_EMAIL_CONFIGURED:
|
if IS_EMAIL_CONFIGURED:
|
||||||
if SEND_EMAIL_ON_RESETTING_USER_PASSWD:
|
if SEND_EMAIL_ON_RESETTING_USER_PASSWD:
|
||||||
try:
|
try:
|
||||||
send_user_reset_email(request, user.email, INIT_PASSWD)
|
send_user_reset_email(request, user.email, new_password)
|
||||||
msg = _('Successfully resetted password to %(passwd)s, an email has been sent to %(user)s.') % \
|
msg = _('Successfully resetted password to %(passwd)s, an email has been sent to %(user)s.') % \
|
||||||
{'passwd': INIT_PASSWD, 'user': user.email}
|
{'passwd': new_password, 'user': user.email}
|
||||||
messages.success(request, msg)
|
messages.success(request, msg)
|
||||||
except Exception, e:
|
except Exception, e:
|
||||||
logger.error(str(e))
|
logger.error(str(e))
|
||||||
msg = _('Successfully resetted password to %(passwd)s, but failed to send email to %(user)s, please check your email configuration.') % \
|
msg = _('Successfully resetted password to %(passwd)s, but failed to send email to %(user)s, please check your email configuration.') % \
|
||||||
{'passwd':INIT_PASSWD, 'user': user.email}
|
{'passwd':new_password, 'user': user.email}
|
||||||
messages.success(request, msg)
|
messages.success(request, msg)
|
||||||
else:
|
else:
|
||||||
messages.success(request, _(u'Successfully resetted password to %(passwd)s for user %(user)s.') % \
|
messages.success(request, _(u'Successfully resetted password to %(passwd)s for user %(user)s.') % \
|
||||||
{'passwd':INIT_PASSWD,'user': user.email})
|
{'passwd':new_password,'user': user.email})
|
||||||
else:
|
else:
|
||||||
messages.success(request, _(u'Successfully resetted password to %(passwd)s for user %(user)s. But email notification can not be sent, because Email service is not properly configured.') % \
|
messages.success(request, _(u'Successfully resetted password to %(passwd)s for user %(user)s. But email notification can not be sent, because Email service is not properly configured.') % \
|
||||||
{'passwd':INIT_PASSWD,'user': user.email})
|
{'passwd':new_password,'user': user.email})
|
||||||
except User.DoesNotExist:
|
except User.DoesNotExist:
|
||||||
msg = _(u'Failed to reset password: user does not exist')
|
msg = _(u'Failed to reset password: user does not exist')
|
||||||
messages.error(request, msg)
|
messages.error(request, msg)
|
||||||
|
Reference in New Issue
Block a user