diff --git a/app.py b/app.py index 9c04f8d..1045cd1 100644 --- a/app.py +++ b/app.py @@ -609,8 +609,17 @@ def edit_profile(): if request.method == 'POST': user = get_current_user() username = request.form['username'] + if not username: + # prevent username to be set to empty + username = user.username if username != user.username: User.update(username=username).where(User.id == user.id).execute() + UserProfile.update( + full_name=request.form['full_name'] or username, + biography=request.form['biography'], + website=request.form['website'] + ).where(UserProfile.user == user).execute() + return redirect(url_for('user_detail', username=username)) return render_template('edit_profile.html') @app.route('/notifications/') diff --git a/static/style.css b/static/style.css index 650f108..6b084e5 100644 --- a/static/style.css +++ b/static/style.css @@ -18,6 +18,7 @@ body{margin:0} .message-options-showhide::before{content:'\2026'} .message-options{display:none} .create_text{width:100%;height:8em} +.biography_text{height:4em} .follow_button,input[type="submit"]{background-color:#ff3018;color:white;border-radius:3px;border:1px solid #ff3018} .follow_button.following{background-color:transparent;color:#ff3018;border-color:#ff3018} .copyright{font-size:smaller;text-align:center;color:#808080} diff --git a/templates/edit_profile.html b/templates/edit_profile.html index 7475d4f..c173260 100644 --- a/templates/edit_profile.html +++ b/templates/edit_profile.html @@ -6,7 +6,14 @@
Username:
-
+
+ {% set profile = current_user.profile %} +
Full name:
+
+
Biography:
+
+
Website:
+