session["userid"] = user_data["userid"]
session.permanent = True
app.logger.info(f"{username} logged in")
- return redirect("/")
+ return redirect(f"/users/{username}")
flash("Invalid username/password", "error")
app.logger.info(f"Failed login for {username}")
return redirect(f"/users/{username}")
else:
+ username = session["username"]
app.logger.info(f"Failed song update - {username} - {get_flashed_messages()}")
return redirect(request.referrer)
error = True
# Check if description is valid
- if not description.isprintable():
- flash(f"Description contains invalid characters", "error")
- error = True
- elif len(description) > 10_000:
+ if len(description) > 10_000:
flash(f"Description cannot be more than 10k characters", "error")
error = True
textarea {
font-family: sans-serif;
color: var(--purple);
- border: 2px solid var(--blue);
+ border: 3px solid var(--purple);
border-radius: 10px;
padding: 10px;
background: var(--yellow);
height: 100px;
width: 100%;
+ margin: 5px;
box-sizing: border-box;
resize: vertical;
}
-.button {
+input[type=text], input[type=password] {
+ background: var(--yellow);
font-family: sans-serif;
+ font-weight: bold;
+ color: var(--purple);
+ border: 3px solid var(--purple);
+ border-radius: 10px;
+ padding: 5px;
+ width: 200px;
+ margin: 5px;
+}
+
+.button, input[type=submit] {
+ font-family: sans-serif;
+ font-weight: bold;
color: var(--yellow);
background: var(--pink);
border: 0px;
border-radius: 5px;
padding: 8px;
+ margin: 5px;
}
div.main {
padding: 10px;
}
+/* Upload/Edit Form */
+
+div.upload-form input[type=text] {
+ width: 100%;
+ box-sizing: border-box;
+}
+
+input[type=file] {
+ margin: 5px;
+}
+
/* Profile */
.profile-name {
text-align: center;
{% endif %}
<h2>Upload a new song</h2>
<div class="upload-form">
- <label for="song">{% if song %}Replace {% endif %}mp3 File</label>
+ <label for="song">{% if song %}Replace {% endif %}mp3 File</label><br>
<input type="file" name="song" accept=".mp3" id="file-select" {% if not song %}required{% endif %}>
</div>
<div class="upload-form">
- <label for="title">Title</label>
+ <label for="title">Title</label><br>
<input type="text" name="title" id="song-title" value="{{ song.title }}" maxlength="80" required>
</div>
<div class="upload-form">
- <label for="description">Description</label>
+ <label for="description">Description</label><br>
<textarea name="description" maxlength="10000">{{ song.description }}</textarea>
</div>
<div class="upload-form">
- <label for="tags">Tags</label>
+ <label for="tags">Tags</label><br>
<input type="text" name="tags" placeholder="country, extratone, vocals, ..." value="{{ ", ".join(song.tags) }}" maxlength="350">
</div>
<div class="upload-form">
- <label for="collabs">Collaborators</label>
+ <label for="collabs">Collaborators</label><br>
<input type="text" name="collabs" placeholder="@fren_user, John Doe, ..." value="{{ ", ".join(song.collaborators) }}" maxlength="350">
</div>
<div class="upload-form">
<form method="post" action="/login">
<div class="login-form">
- <label for="username">Username</label>
+ <label for="username">Username</label><br>
<input type="text" name="username" maxlength="30" required></input>
</div>
<div class="login-form">
- <label for="password">Password</label>
+ <label for="password">Password</label><br>
<input type="password" name="password" maxlength="100" required></input>
</div>
</ol>
<form method="post">
<div class="signup-form">
- <label for="username">Username</label>
+ <label for="username">Username</label><br>
<input type="text" name="username" maxlength="30"required></input>
</div>
<div class="signup-form">
- <label for="password">Password</label>
+ <label for="password">Password</label><br>
<input type="password" name="password" maxlength="100" required></input>
</div>
<div class="signup-form">
- <label for="password_confirm">Confirm Password</label>
+ <label for="password_confirm">Confirm Password</label><br>
<input type="password" name="password_confirm" maxlength="100" required></input>
</div>
TODO (BEFORE RELEASE)
-- CSS/Design
+- Multiline descriptions
- Automated Tests
- Homepage
- Tips and Tricks