mirror of
https://github.com/TitanEmbeds/Titan.git
synced 2024-12-24 14:07:03 +01:00
Make 422 status when titan failed to add user to guild
This commit is contained in:
parent
ff4d6a405a
commit
f6b354f10d
@ -390,7 +390,9 @@ def create_authenticated_user():
|
|||||||
if not check_user_in_guild(guild_id):
|
if not check_user_in_guild(guild_id):
|
||||||
add_member = discord_api.add_guild_member(guild_id, session['user_id'], session['user_keys']['access_token'])
|
add_member = discord_api.add_guild_member(guild_id, session['user_id'], session['user_keys']['access_token'])
|
||||||
if not add_member["success"]:
|
if not add_member["success"]:
|
||||||
abort(403)
|
response = jsonify(add_member)
|
||||||
|
response.status_code = 422
|
||||||
|
return response
|
||||||
db_user = db.session.query(AuthenticatedUsers).filter(and_(AuthenticatedUsers.guild_id == guild_id, AuthenticatedUsers.client_id == session['user_id'])).first()
|
db_user = db.session.query(AuthenticatedUsers).filter(and_(AuthenticatedUsers.guild_id == guild_id, AuthenticatedUsers.client_id == session['user_id'])).first()
|
||||||
if not db_user:
|
if not db_user:
|
||||||
db_user = AuthenticatedUsers(guild_id, session['user_id'])
|
db_user = AuthenticatedUsers(guild_id, session['user_id'])
|
||||||
|
@ -969,6 +969,8 @@
|
|||||||
Materialize.toast('Authentication error! You have been banned.', 10000);
|
Materialize.toast('Authentication error! You have been banned.', 10000);
|
||||||
} else if (data.status == 406) {
|
} else if (data.status == 406) {
|
||||||
Materialize.toast('Illegal username provided! Only alphanumeric, spaces, dashes, and underscores allowed in usernames.', 10000);
|
Materialize.toast('Illegal username provided! Only alphanumeric, spaces, dashes, and underscores allowed in usernames.', 10000);
|
||||||
|
} else if (data.status == 422) {
|
||||||
|
Materialize.toast("Attempting to add you into the server has failed. Either you are banned, reached 100 servers in Discord, or something else bad has happened.", 10000);
|
||||||
}
|
}
|
||||||
unlock_login_fields();
|
unlock_login_fields();
|
||||||
setVisitorMode(true);
|
setVisitorMode(true);
|
||||||
|
Loading…
Reference in New Issue
Block a user