passwords are now longer separate entities. added description field.

This commit is contained in:
Ville Rantanen
2018-02-15 23:05:15 +02:00
parent 0ff3f59c03
commit 46e9cea720
4 changed files with 76 additions and 44 deletions

View File

@@ -40,7 +40,7 @@ def index():
authenticated_share = get_share(share['name'])
password_set = False
if authenticated_share[0]:
password_set = authenticated_share[1]['authenticated'] in ('hash', 'plain')
password_set = authenticated_share[1]['authenticated'] == 'hash'
if not expired:
if public or password_set:
public_shares.append({
@@ -130,7 +130,8 @@ def list_view(name, password = None):
upload = get_or_none(share,'upload'),
overwrite = get_or_none(share,'overwrite'),
direct = allow_direct,
expire = get_or_none(share,'expire')
expire = get_or_none(share,'expire'),
description = get_or_none(share,'description',"")
)
@app.route('/logout/<name>', methods=['GET'])
@@ -275,11 +276,11 @@ def get_folder_size(path):
return total_size
def get_or_none(d,key):
def get_or_none(d,key,none = None):
if key in d:
return d[key]
else:
return None
return none
def get_share(name, require_auth = True):
@@ -291,11 +292,6 @@ def get_share(name, require_auth = True):
return (False, 'Share has expired')
authenticated = "no-pass"
if require_auth:
if 'pass_plain' in share:
authenticated = False
if name in session:
if session[name] == hashlib.sha1(share['pass_plain'].encode('utf-8')).hexdigest():
authenticated = "plain"
if 'pass_hash' in share:
authenticated = False
if name in session:

View File

@@ -57,7 +57,10 @@ tr:nth-child(even) {
#list_title {
margin-left: 5em;
}
#list_description {
margin-left: 2em;
margin-bottom: 1em;
}
#list_menu {
float:right;
padding: 8px;

View File

@@ -40,6 +40,7 @@
</div>
<div id=list_left>
<div id=list_title><h1>{{ name }}</h1></div>
<div id=list_description>{{ description }}</div>
<table class="sortable" id="list_table">
<thead>
<tr>