use abort instead of sending raw text lol
parent
7cca8274f0
commit
3d1c16044a
|
@ -170,7 +170,7 @@ def random_user(v:User):
|
|||
u = g.db.query(User.username).filter(User.song != None, User.shadowbanned == None).order_by(func.random()).first()
|
||||
|
||||
if u: u = u[0]
|
||||
else: return "No users have set a profile anthem so far!"
|
||||
else: abort(404, "No users have set a profile anthem so far!")
|
||||
|
||||
return redirect(f"/@{u}")
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ def login_post():
|
|||
|
||||
if "@" in username:
|
||||
try: account = g.db.query(User).filter(User.email.ilike(username)).one_or_none()
|
||||
except: return "Multiple users use this email!"
|
||||
except: abort(400, "Multiple usernames have this email attached;<br>Please specify the username you want to login to!")
|
||||
else: account = get_user(username, graceful=True)
|
||||
|
||||
if not account:
|
||||
|
|
|
@ -399,7 +399,7 @@ def post_sub_sidebar(v, sub):
|
|||
|
||||
sub.sidebar = request.values.get('sidebar', '').strip()[:10000]
|
||||
sub.sidebar_html = sanitize(sub.sidebar)
|
||||
if len(sub.sidebar_html) > 20000: return "Sidebar is too big!"
|
||||
if len(sub.sidebar_html) > 20000: abort(400, "Sidebar is too big!")
|
||||
|
||||
g.db.add(sub)
|
||||
|
||||
|
|
Loading…
Reference in New Issue