1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-08-30 21:50:59 +00:00

Merge branch '6.3'

This commit is contained in:
zhengxie 2018-12-07 14:59:14 +08:00
commit 8e1d52ce10
7 changed files with 78 additions and 24 deletions

View File

@ -24,7 +24,7 @@ before_install:
# install seahub requirements # install seahub requirements
install: install:
- pip install -r requirements.txt --allow-all-external --allow-unverified PIL - pip install -r dev-requirements.txt --allow-all-external --allow-unverified PIL
- pip install -r test-requirements.txt - pip install -r test-requirements.txt
before_scipt: true before_scipt: true

View File

@ -5,5 +5,5 @@ transifex-client
raven==5.0.0 raven==5.0.0
mysqlclient==1.3.12 mysqlclient==1.3.12
pycrypto==2.6.1 pycryptodome==3.7.2
psd-tools==1.4 psd-tools==1.4

View File

@ -3958,18 +3958,22 @@ button.sf-dropdown-toggle:focus {
} }
/*random password */ /*random password */
#share-popup .passwd-wrapper, #share-popup .passwd-wrapper,
#update-webdav-passwd .passwd-wrapper,
#add-user-form .passwd-wrapper { #add-user-form .passwd-wrapper {
position:relative; position:relative;
width:268px; width:268px;
} }
#share-popup .passwd, #share-popup .passwd,
#update-webdav-passwd .passwd,
#add-user-form .passwd { #add-user-form .passwd {
width:188px; width:188px;
padding-right:75px; padding-right:75px;
} }
#share-popup .generate-random-password, #share-popup .generate-random-password,
#add-user-form .generate-random-password, #add-user-form .generate-random-password,
#update-webdav-passwd .generate-random-password,
#share-popup .show-or-hide-password, #share-popup .show-or-hide-password,
#update-webdav-passwd .show-or-hide-password,
#add-user-form .show-or-hide-password { #add-user-form .show-or-hide-password {
position:absolute; position:absolute;
top:4px; top:4px;
@ -3981,17 +3985,21 @@ button.sf-dropdown-toggle:focus {
opacity:0.65; opacity:0.65;
} }
#share-popup .show-or-hide-password, #share-popup .show-or-hide-password,
#update-webdav-passwd .show-or-hide-password,
#add-user-form .show-or-hide-password { #add-user-form .show-or-hide-password {
right:36px; right:36px;
background:#fff; background:#fff;
} }
#share-popup .generate-random-password, #share-popup .generate-random-password,
#update-webdav-passwd .generate-random-password,
#add-user-form .generate-random-password { #add-user-form .generate-random-password {
background:#ccc; background:#ccc;
} }
#share-popup .generate-random-password:hover, #share-popup .generate-random-password:hover,
#add-user-form .generate-random-password:hover, #add-user-form .generate-random-password:hover,
#update-webdav-passwd .show-or-hide-password:hover,
#share-popup .show-or-hide-password:hover, #share-popup .show-or-hide-password:hover,
#update-webdav-passwd .show-or-hide-password:hover,
#add-user-form .show-or-hide-password:hover { #add-user-form .show-or-hide-password:hover {
opacity:1; opacity:1;
} }

View File

@ -13,12 +13,10 @@ openpyxl==2.3.0
pytz==2015.7 pytz==2015.7
django-formtools==2.1 django-formtools==2.1
qrcode==5.3 qrcode==5.3
requests==2.18.4 requests==2.20.1
requests_oauthlib==0.8.0 requests_oauthlib==0.8.0
django-simple-captcha==0.5.6 django-simple-captcha==0.5.6
gunicorn==19.8.1 gunicorn==19.8.1
django-webpack-loader==0.6.0 django-webpack-loader==0.6.0
git+git://github.com/haiwen/python-cas.git@ffc49235fd7cc32c4fdda5acfa3707e1405881df#egg=python_cas git+git://github.com/haiwen/python-cas.git@ffc49235fd7cc32c4fdda5acfa3707e1405881df#egg=python_cas
pycrypto==2.6.1
futures==3.2.0 futures==3.2.0

View File

@ -17,6 +17,10 @@
<li class="tab"><a href="#update-user-passwd">{% trans "Password" %}</a></li> <li class="tab"><a href="#update-user-passwd">{% trans "Password" %}</a></li>
{% endif %} {% endif %}
{% if ENABLE_WEBDAV_SECRET %}
<li class="tab"><a href="#update-webdav-passwd">{% trans "WebDav Password" %}</a></li>
{% endif %}
<li class="tab"><a href="#lang-setting">{% trans "Language" %}</a></li> <li class="tab"><a href="#lang-setting">{% trans "Language" %}</a></li>
{% if two_factor_auth_enabled %} {% if two_factor_auth_enabled %}
@ -81,12 +85,15 @@
{% if ENABLE_WEBDAV_SECRET %} {% if ENABLE_WEBDAV_SECRET %}
<div id="update-webdav-passwd" class="setting-item"> <div id="update-webdav-passwd" class="setting-item">
<h3>WebDav {% trans "Password" %}</h3> <h3>{% trans "WebDav Password" %}</h3>
<label>{% trans "Password" %}</label><input type="text" name="password" value="{{ webdav_passwd }}" class="input" /> <label>{% trans "Password" %}</label>
<br/> <div class="passwd-wrapper">
<a href="#" class="update sf-btn-link">{% trans "Update" %}</a> <input type="password" name="password" value="{{ webdav_passwd }}" class="passwd input" />
<a href="#" class="delete sf-btn-link">{% trans "Delete" %}</a> <span title="{% trans "Show" %}" class="icon-eye show-or-hide-password cspt" role="button" tabindex="0" aria-label="{% trans "Show" %}"></span>
<span title="{% trans "Generate a random password" %}" class="icon-magic generate-random-password cspt" role="button" tabindex="0" aria-label="{% trans "Generate a random password" %}"></span>
</div>
<button class="update submit">{% trans "Update" %}</button>
<button class="delete submit">{% trans "Delete" %}</button>
</div> </div>
{% endif %} {% endif %}
@ -246,29 +253,65 @@ $("#list-in-address-book input[type='checkbox']").on('change', function() {
{% endif %} {% endif %}
{% if ENABLE_WEBDAV_SECRET %} {% if ENABLE_WEBDAV_SECRET %}
function aj_update_webdav_secret(passwd) { function update_webdav_secret(passwd) {
$.ajax({ $.ajax({
url: "{% url 'api-v2.1-webdav-secret' %}", url: "{% url 'api-v2.1-webdav-secret' %}",
type: 'PUT', type: 'PUT',
dataType: 'json', dataType: 'json',
cache: false, cache: false,
beforeSend: prepareCSRFToken, beforeSend: prepareCSRFToken,
data: "secret=" + passwd, data: {'secret': passwd},
success: function(data) { success: function() {
feedback("{% trans "Success" %}", 'success'); feedback("{% trans "Success" %}", 'success');
}, },
error: ajaxErrorHandler error: ajaxErrorHandler
}); });
} }
$("#update-webdav-passwd a.update").click(function() { $("#update-webdav-passwd .update").click(function() {
var passwd = $("#update-webdav-passwd input[type='text']").val(); var passwd = $("#update-webdav-passwd [name='password']").val();
aj_update_webdav_secret(passwd); update_webdav_secret(passwd);
}); });
$("#update-webdav-passwd a.delete").click(function() { $("#update-webdav-passwd .delete").click(function() {
$("#update-webdav-passwd input[type='text']").val(''); $("#update-webdav-passwd [name='password']").val('');
aj_update_webdav_secret(''); update_webdav_secret('');
});
$('#update-webdav-passwd .show-or-hide-password').click(function() {
var $icon = $(this),
$password = $('#update-webdav-passwd [name="password"]');
$icon.toggleClass('icon-eye icon-eye-slash');
if ($icon.hasClass('icon-eye')) {
$icon.attr({
'title': '{% trans "Show" %}',
'aria-label': '{% trans "Show" %}'
});
$password.attr('type', 'password');
} else {
$icon.attr({
'title': '{% trans "Hide" %}',
'aria-label': '{% trans "Hide" %}'
});
$password.attr('type', 'text');
}
});
$('#update-webdav-passwd .generate-random-password').click(function() {
var random_password_length = 8;
var random_password = '';
var possible = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
for (var i = 0; i < random_password_length; i++) {
random_password += possible.charAt(Math.floor(Math.random() * possible.length));
}
$('#update-webdav-passwd [name="password"]').attr('type', 'text').val(random_password);
$('#update-webdav-passwd .show-or-hide-password')
.attr({
'title': '{% trans "Hide" %}',
'aria-label': '{% trans "Hide" %}'
}).removeClass('icon-eye').addClass('icon-eye-slash');
}); });
{% endif %} {% endif %}

View File

@ -143,11 +143,14 @@
<% if (is_pro) { %> <% if (is_pro) { %>
{% trans "Professional Edition" %} {% trans "Professional Edition" %}
<% if (with_license) { %> <% if (with_license) { %>
{% if LANGUAGE_CODE == 'zh-cn' %}永久授权给{% else %}{% trans "licensed to" %}{% endif %} <%- license_to %>,
<% if (license_mode == 'life-time') { %> <% if (license_mode == 'life-time') { %>
{% if LANGUAGE_CODE == 'zh-cn' %}技术支持服务至{% else %}{% trans "upgrade service expired in" %}{% endif %} <%- license_expiration %> {% if LANGUAGE_CODE == 'zh-cn' %}到期{% endif %} {% if LANGUAGE_CODE == 'zh-cn' %}
永久授权给 <%- license_to %>, 技术支持服务至 <%- license_expiration %> 到期
{% else %}
{% trans "licensed to" %} <%- license_to %>, {% trans "upgrade service expired in" %} <%- license_expiration %>
{% endif %}
<% } else { %> <% } else { %>
{% trans "expires on" %} <%- license_expiration %> {% trans "licensed to" %} <%- license_to %>, {% trans "expires on" %} <%- license_expiration %>
<% } %> <% } %>
<% } %> <% } %>

View File

@ -7,6 +7,7 @@ except ImportError:
from django.conf import settings from django.conf import settings
from django.utils.encoding import force_str
class AESPasswordDecodeError(Exception): class AESPasswordDecodeError(Exception):
@ -35,9 +36,10 @@ class AESPasswordHasher:
if not secret: if not secret:
secret = settings.SECRET_KEY[:BLOCK_SIZE] secret = settings.SECRET_KEY[:BLOCK_SIZE]
self.cipher = AES.new(secret) self.cipher = AES.new(secret, AES.MODE_ECB)
def encode(self, password): def encode(self, password):
password = force_str(password)
return "%s$%s" % (self.algorithm, EncodeAES(self.cipher, password)) return "%s$%s" % (self.algorithm, EncodeAES(self.cipher, password))
def verify(self, password, encoded): def verify(self, password, encoded):