1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-11 11:51:27 +00:00

Merge branch 'develop'

Conflicts:
	templates/base.html
This commit is contained in:
zhengxie
2013-04-22 20:19:40 +08:00
4 changed files with 33 additions and 10 deletions

View File

@@ -7,7 +7,7 @@ These are referenced from the setting TEMPLATE_CONTEXT_PROCESSORS and used by
RequestContext.
"""
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:
from settings import BUSINESS_MODE
except ImportError:
@@ -35,6 +35,9 @@ def base(request):
return {
'seafile_version': SEAFILE_VERSION,
'site_title': SITE_TITLE,
'branding_css': BRANDING_CSS,
'logo_path': LOGO_PATH,
'logo_url': LOGO_URL,
'business_mode': BUSINESS_MODE,
'cloud_mode': request.cloud_mode,
'org': org,

View File

@@ -3,6 +3,9 @@
import sys
import os
import re
import random
import string
DEBUG = False
TEMPLATE_DEBUG = DEBUG
@@ -204,7 +207,11 @@ REGISTRATION_SEND_MAIL = False
CCNET_APPLET_ROOT = "http://127.0.0.1:13420"
# 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
SITE_TITLE = 'Private Seafile'
@@ -213,6 +220,14 @@ SITE_TITLE = 'Private Seafile'
SITE_BASE = 'http://seafile.com'
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
# server.
SERVE_STATIC = True

View File

@@ -15,6 +15,7 @@
<link rel="shortcut icon" href="{{ MEDIA_URL }}img/favicon.ico?t=1366090560"/>
<![endif]-->
{% block extra_style %}{% endblock %}
{% if branding_css != '' %}<style>{{branding_css}}</style>{% endif %}
</head>
<body>
@@ -62,8 +63,8 @@
<div id="header">
<div id="header-inner">
{% block notice_panel %}{% endblock %}
<a href="http://seafile.com/" id="logo" class="fleft">
<img src="{{ MEDIA_URL }}img/logo.png?t=1366090560" title="Seafile" alt="Seafile logo" />
<a href="{{logo_url}}" id="logo" class="fleft">
<img src="{{ MEDIA_URL }}{{ logo_path }}" title="Seafile" alt="Seafile logo" />
</a>
{% block nav %}{% endblock %}

View File

@@ -1472,27 +1472,31 @@ def user_reset(request, user_id):
"""Reset password for user."""
try:
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()
if IS_EMAIL_CONFIGURED:
if SEND_EMAIL_ON_RESETTING_USER_PASSWD:
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.') % \
{'passwd': INIT_PASSWD, 'user': user.email}
{'passwd': new_password, 'user': user.email}
messages.success(request, msg)
except Exception, 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.') % \
{'passwd':INIT_PASSWD, 'user': user.email}
{'passwd':new_password, 'user': user.email}
messages.success(request, msg)
else:
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:
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:
msg = _(u'Failed to reset password: user does not exist')
messages.error(request, msg)