aucune idée de ce que je fais
This commit is contained in:
parent
e099f705c8
commit
b3f13399a4
37
Flask/app.py
37
Flask/app.py
@ -165,7 +165,7 @@ def change_password():
|
|||||||
|
|
||||||
# handle login failed
|
# handle login failed
|
||||||
@app.errorhandler(401)
|
@app.errorhandler(401)
|
||||||
def page_not_found(e):
|
def unauthorized(e):
|
||||||
return(render_template("login.html"))
|
return(render_template("login.html"))
|
||||||
|
|
||||||
|
|
||||||
@ -416,8 +416,9 @@ def download(filename):
|
|||||||
print("file send !")
|
print("file send !")
|
||||||
return send_from_directory(directory='/app/MsRewards-Reborn/user_data/', path=filename, as_attachment=True)
|
return send_from_directory(directory='/app/MsRewards-Reborn/user_data/', path=filename, as_attachment=True)
|
||||||
|
|
||||||
ALLOWED_EXTENSIONS = ["json"]
|
|
||||||
def allowed_file(filename):
|
def allowed_file(filename):
|
||||||
|
ALLOWED_EXTENSIONS = ["json"]
|
||||||
return '.' in filename and \
|
return '.' in filename and \
|
||||||
filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS
|
filename.rsplit('.', 1)[1].lower() in ALLOWED_EXTENSIONS
|
||||||
|
|
||||||
@ -425,22 +426,24 @@ def allowed_file(filename):
|
|||||||
@login_required
|
@login_required
|
||||||
def upload_file():
|
def upload_file():
|
||||||
print(request.files)
|
print(request.files)
|
||||||
print(request)
|
i = 1
|
||||||
# check if the post request has the file part
|
while f'file{i}' in request.files :
|
||||||
if 'file1' not in request.files:
|
file = request.files[f'file{i}']
|
||||||
print('No file part')
|
if file.filename == '':
|
||||||
return redirect(url_for('settings_get'))
|
print('end of files')
|
||||||
file = request.files['file1']
|
return redirect(url_for('settings_get'))
|
||||||
# If the user does not select a file, the browser submits an
|
elif file and allowed_file(file.filename):
|
||||||
# empty file without a filename.
|
filename = secure_filename(file.filename)
|
||||||
if file.filename == '':
|
print(os.path.join('/app/MsRewards-Reborn/user_data/', filename))
|
||||||
print('No selected file')
|
file.save(os.path.join('/app/MsRewards-Reborn/user_data/', filename))
|
||||||
return redirect(url_for('settings_get'))
|
|
||||||
if file and allowed_file(file.filename):
|
i += 1
|
||||||
filename = secure_filename(file.filename)
|
|
||||||
file.save(os.path.join('/app/MsRewards-Reborn/user_data/', filename))
|
|
||||||
return redirect(url_for('settings_get'))
|
|
||||||
|
|
||||||
|
print("requete bizarre")
|
||||||
|
return redirect(url_for('settings_get'))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
return redirect(url_for('settings_get'))
|
return redirect(url_for('settings_get'))
|
||||||
|
|
||||||
def maxi(dict):
|
def maxi(dict):
|
||||||
|
Loading…
Reference in New Issue
Block a user