Auto logs user in with prefilled guest username if no captcha is present

This commit is contained in:
Jeremy Zhang 2018-02-16 01:12:25 +00:00
parent e8ecacb9be
commit 9e53f16eb2
3 changed files with 4 additions and 2 deletions

View File

@ -73,7 +73,7 @@ QUERY_PARAMETERS = [
{ {
"name": "username", "name": "username",
"type": "string", "type": "string",
"description": "Prefills the guest username field with the given username.", "description": "Prefills the guest username field with the given username. If the guest captcha is disabled and that the user has not been logged in yet, it automatically logs the user in with the specified username.",
"example": "Rainbow%20Dash", "example": "Rainbow%20Dash",
}, },
{ {

View File

@ -415,6 +415,8 @@
unlock_login_fields(); unlock_login_fields();
if (data.status == 403 && getParameterByName("create_authenticated_user") == "true" && getParameterByName("sametarget") == "true") { if (data.status == 403 && getParameterByName("create_authenticated_user") == "true" && getParameterByName("sametarget") == "true") {
wait_for_discord_login(); wait_for_discord_login();
} else if (!unauth_captcha_enabled && $("#custom_username_field").val().trim() !== "") {
$("#custom_username_field").trigger(jQuery.Event("keyup", { keyCode: 13 } ));
} else if (visitors_enabled) { } else if (visitors_enabled) {
setVisitorMode(true); setVisitorMode(true);
var guild2 = query_guild(); var guild2 = query_guild();

View File

@ -411,7 +411,7 @@
const guild_id = "{{ guild_id }}"; const guild_id = "{{ guild_id }}";
const bot_client_id = "{{ client_id }}"; const bot_client_id = "{{ client_id }}";
const visitors_enabled = {% if visitors_enabled %}true{% else %}false{% endif %}; const visitors_enabled = {% if visitors_enabled %}true{% else %}false{% endif %};
const unauth_captcha_enabled = {% if unauth_captcha_enabled %}true{% else %}false{% endif %} const unauth_captcha_enabled = {% if unauth_captcha_enabled %}true{% else %}false{% endif %};
</script> </script>
<script type="text/javascript" src="{{ url_for('static', filename='js/embed.js') }}"></script> <script type="text/javascript" src="{{ url_for('static', filename='js/embed.js') }}"></script>