Step 2,3 and 4 are disabled if files are not yet uploaded.

This commit is contained in:
crunk 2022-01-23 15:21:33 +01:00
parent 83b4816ccc
commit 4a12caf31c
6 changed files with 44 additions and 16 deletions

View File

@ -73,6 +73,9 @@ def login():
if loginform.validate_on_submit():
try:
user = User.query.filter_by(email=loginform.email.data).first()
if user is None:
loginform.password.errors.append("Invalid email or password!")
return render_template("login.html", loginform=loginform)
if check_password_hash(user.password, loginform.password.data):
login_user(user)
flash("Logged in successfully.", "success")
@ -81,7 +84,7 @@ def login():
return abort(400)
return redirect(next or url_for("index"))
else:
flash("Invalid Username or password!", "danger")
flash("Invalid email or password!", "danger")
loginform.password.errors.append("Invalid email or password!")
return render_template("login.html", loginform=loginform)
except Exception as e:

View File

@ -37,6 +37,7 @@ div#upload form {
border: 3px solid #E0B0FF;
background-color:#383C4A;
text-decoration: none;
scroll-behavior: smooth;
}
#mainworkflow
{

View File

@ -1,4 +1,12 @@
<div id="edit" class="workflow">
<h3>(Optional) Step 3: Edit</h3>
{% if files_uploaded %}
<a href="/editor"><p>Go to CSS editor</p></a>
{% else %}
<p>
You need to upload your files first before you can a css theme
for your files.
</p>
<a href="#upload">Go to Step 1</a>
{% endif %}
</div>

View File

@ -4,8 +4,16 @@
your content public.</p>
<form method="POST" enctype="multipart/form-data" action="{{ url_for('distribusi') }}">
{{ distribusiform.csrf_token }}
{% if files_uploaded %}
<fieldset class="button required">
{{ distribusiform.submit }}
</fieldset>
{% else %}
<p>
You need to upload your files first before you can run distribusi
on your files.
</p>
<a href="#upload">Go to Step 1</a>
{% endif %}
</form>
</div>

View File

@ -8,8 +8,16 @@
{{ themeform.theme.label }}
{{ themeform.theme }}
</fieldset>
{% if files_uploaded %}
<fieldset class="button required">
{{ themeform.save }}
</fieldset>
{% else %}
<p>
You need to upload your files first before you can a css theme
for your files.
</p>
<a href="#upload">Go to Step 1</a>
{% endif %}
</form>
</div>

View File

@ -18,21 +18,21 @@
</div>
<div class="editarea">
{% if files_uploaded %}
<fieldset class="required">
{{ editorform.cssname.label }}
{{ editorform.cssname }}
{% for message in editorform.cssname.errors %}
<div class="error">{{ message }}</div>
{% endfor %}
</fieldset>
<fieldset class="button required">
{{ editorform.submit }}
</fieldset>
{% else %}
<p>
You need to upload your files first before you can save a css file.
</p>
{% endif %}
<fieldset class="required">
{{ editorform.cssname.label }}
{{ editorform.cssname }}
{% for message in editorform.cssname.errors %}
<div class="error">{{ message }}</div>
{% endfor %}
</fieldset>
<fieldset class="button required">
{{ editorform.submit }}
</fieldset>
{% else %}
<p>
You need to upload your files first before you can save a css file.
</p>
{% endif %}
</div>
</div>
</form>