Add sametarget query parameter to not have discord login open in new tab

This commit is contained in:
Jeremy Zhang 2017-11-13 22:01:34 +00:00
parent 6dd7f17fb6
commit b1186fecfe
3 changed files with 15 additions and 2 deletions

View File

@ -74,7 +74,8 @@ def guild_embed(guild_id):
client_id=config['client-id'], client_id=config['client-id'],
recaptcha_site_key=config["recaptcha-site-key"], recaptcha_site_key=config["recaptcha-site-key"],
css=customcss, css=customcss,
cssvariables=parse_css_variable(customcss) cssvariables=parse_css_variable(customcss),
same_target=request.args.get("sametarget", False) == "true"
) )
abort(404) abort(404)

View File

@ -30,6 +30,18 @@
<hr> <hr>
<em>Eg: noscroll=true</em> <em>Eg: noscroll=true</em>
</li> </li>
<li class="collection-item">
<strong>sametarget=&lt;boolean&gt;</strong> <br>
For those who don't want the Discord Login to open in a new tab/window... (<em>Does not work for iframe loaded embeds!!!</em> This is a direct link option only.)
<hr>
<strong>Avaliable Options:</strong>
<ul class="browser-default">
<li><strong>true</strong></li>
<li><strong>false</strong> (default)</li>
</ul>
<hr>
<em>Eg: sametarget=true</em>
</li>
<li class="collection-item"> <li class="collection-item">
<strong>theme=&lt;string&gt;</strong> <br> <strong>theme=&lt;string&gt;</strong> <br>
Want your embed to use one of our premade themes? Look no further! <br> Want your embed to use one of our premade themes? Look no further! <br>

View File

@ -102,7 +102,7 @@
</div> </div>
<div class="row"> <div class="row">
<div class="col s12 l4"> <div class="col s12 l4">
<a id="discordlogin_btn" href="{{ url_for("embed.login_discord", _external=True) }}" class="waves-effect waves-light btn-large" target="_blank">Discord Login</a> <a id="discordlogin_btn" href="{% if not same_target %}{{ url_for("embed.login_discord", _external=True) }}{% else %}{{ url_for("user.login_authenticated", redirect=request.url, _external=True) }}{% endif %}" class="waves-effect waves-light btn-large" {% if not same_target %}target="_blank"{% endif %}>Discord Login</a>
<p>*You will be invited into this server.</p> <p>*You will be invited into this server.</p>
</div> </div>
{% if unauth_enabled %} {% if unauth_enabled %}