4.21.3
This commit is contained in:
14
app/templates/developer/client_details/advanced.html
Normal file
14
app/templates/developer/client_details/advanced.html
Normal file
@ -0,0 +1,14 @@
|
||||
{% extends "developer/client_details/base.html" %}
|
||||
|
||||
{% set client_details_page = "advanced" %}
|
||||
{% block client_details_content %}
|
||||
|
||||
<h1 class="h2">Danger Zone</h1>
|
||||
<form method="post">
|
||||
{{ form.csrf_token }}
|
||||
<div class="alert alert-danger">
|
||||
When your website is deleted, users can no longer log into it. This operation is not reversible!
|
||||
</div>
|
||||
<button type="submit" class="btn btn-danger">Delete "{{ client.name }}"</button>
|
||||
</form>
|
||||
{% endblock %}
|
50
app/templates/developer/client_details/base.html
Normal file
50
app/templates/developer/client_details/base.html
Normal file
@ -0,0 +1,50 @@
|
||||
{% extends "default.html" %}
|
||||
|
||||
{% set active_page = "developer" %}
|
||||
{% block title %}Developer - App {{ client.name }}{% endblock %}
|
||||
{% block default_content %}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-lg-3 order-lg-1 mb-4">
|
||||
<div class="list-group list-group-transparent mb-0">
|
||||
<a href="{{ url_for('developer.client_detail', client_id=client.id) }}"
|
||||
class="list-group-item list-group-item-action {{ 'active' if client_details_page == 'basic_info' }}">
|
||||
<span class="icon mr-3"><i class="fe fe-flag"></i></span>Info
|
||||
</a>
|
||||
<a href="{{ url_for('developer.client_detail_oauth_setting', client_id=client.id) }}"
|
||||
class="list-group-item list-group-item-action {{ 'active' if client_details_page == 'oauth_setting' }}">
|
||||
<span class="icon mr-3"><i class="fe fe-settings"></i></span>OAuth Settings
|
||||
</a>
|
||||
<a href="{{ url_for('developer.client_detail_oauth_endpoint', client_id=client.id) }}"
|
||||
class="list-group-item list-group-item-action {{ 'active' if client_details_page == 'oauth_endpoint' }}">
|
||||
<span class="icon mr-3"><i class="fe fe-shield"></i></span>OAuth Endpoints
|
||||
</a>
|
||||
{% if current_user.referrals|count > 0 %}
|
||||
|
||||
<a href="{{ url_for('developer.client_detail_referral', client_id=client.id) }}"
|
||||
class="list-group-item list-group-item-action {{ 'active' if client_details_page == 'referral' }}">
|
||||
<span class="icon mr-3"><i class="fe fe-share"></i></span>Referral
|
||||
</a>
|
||||
{% endif %}
|
||||
<a href="{{ url_for('developer.client_detail_advanced', client_id=client.id) }}"
|
||||
class="list-group-item list-group-item-action {{ 'active' if client_details_page == 'advanced' }}">
|
||||
<span class="icon mr-3"><i class="fe fe-alert-octagon"></i></span>Danger
|
||||
</a>
|
||||
</div>
|
||||
<a href="https://docs.simplelogin.io"
|
||||
target="_blank"
|
||||
class="btn btn-block btn-secondary mt-4">
|
||||
Documentation <i class="fe fe-external-link"></i>
|
||||
</a>
|
||||
</div>
|
||||
<div class="col-lg-9">
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<div class="text-wrap p-lg-6">
|
||||
{% block client_details_content %}{% endblock %}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
78
app/templates/developer/client_details/basic_info.html
Normal file
78
app/templates/developer/client_details/basic_info.html
Normal file
@ -0,0 +1,78 @@
|
||||
{% extends "developer/client_details/base.html" %}
|
||||
|
||||
{% set client_details_page = "basic_info" %}
|
||||
{% block client_details_content %}
|
||||
|
||||
{% if is_new %}
|
||||
|
||||
<div class="alert alert-warning alert-dismissible fade show mb-4"
|
||||
role="alert">
|
||||
<h4 class="alert-heading">Well done!</h4>
|
||||
<p>
|
||||
Please head to our
|
||||
<a href="https://docs.simplelogin.io" target="_blank" rel="noopener">
|
||||
documentation <i class="fe fe-external-link"></i>
|
||||
</a>
|
||||
to see how to add SIWSL into your app.
|
||||
</p>
|
||||
<button type="button" class="close" data-dismiss="alert" aria-label="Close">
|
||||
<span aria-hidden="true"></span>
|
||||
</button>
|
||||
</div>
|
||||
{% endif %}
|
||||
<form method="post"
|
||||
enctype="multipart/form-data"
|
||||
action="{{ url_for('developer.client_detail', client_id=client.id, action="edit") }}">
|
||||
{{ form.csrf_token }}
|
||||
<h1 class="h2">Info</h1>
|
||||
<div class="form-group">
|
||||
<label class="form-label">Name</label>
|
||||
{{ form.name(class="form-control", value=client.name) }}
|
||||
{{ render_field_errors(form.name) }}
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label">Url</label>
|
||||
{{ form.url(class="form-control", value=client.home_url) }}
|
||||
{{ render_field_errors(form.url) }}
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label">
|
||||
Icon
|
||||
<span class="text-muted small-text">The icon is displayed on the authorization page</span>
|
||||
</label>
|
||||
{{ form.icon(class="form-control-file") }}
|
||||
{{ render_field_errors(form.icon) }}
|
||||
{% if client.icon_id %}<img src="{{ client.icon.get_url() }}" class="client-icon">{% endif %}
|
||||
</div>
|
||||
<button type="submit" class="mt-2 btn btn-primary">Update</button>
|
||||
</form>
|
||||
{# <hr />#}
|
||||
{# <h3>Submit for approval</h3>#}
|
||||
{##}
|
||||
{# <div class="alert alert-info">#}
|
||||
{# Approval is only needed when you deploy the <b>Sign in with SimpleLogin</b> integration#}
|
||||
{# in production. <br />#}
|
||||
{# For local/testing/staging environment, you don't have to submit your app/website for approval. <br />#}
|
||||
{# </div>#}
|
||||
{##}
|
||||
{# <form method="post" enctype="multipart/form-data"#}
|
||||
{# action="{{ url_for('developer.client_detail', client_id=client.id, action="submit") }}">#}
|
||||
{# {{ approval_form.csrf_token }}#}
|
||||
{##}
|
||||
{# <div class="form-group">#}
|
||||
{# <label class="form-label">Tell us about your app</label>#}
|
||||
{# {{ approval_form.description(#}
|
||||
{# class="form-control", rows="10",#}
|
||||
{# placeholder="This information is used for approving your application. Please give us as much info as you can, for example where you plan to use SimpleLogin, for which community, etc."#}
|
||||
{# ) }}#}
|
||||
{# {{ render_field_errors(approval_form.description) }}#}
|
||||
{# </div>#}
|
||||
{##}
|
||||
{# <div class="alert alert-warning">#}
|
||||
{# Don't make this frequent mistake: make sure to add your production URL to the <b>Authorized Redirect URIs</b> on#}
|
||||
{# <a href="{{ url_for('developer.client_detail_oauth_setting', client_id=client.id) }}">OAuth Settings</a>.#}
|
||||
{# </div>#}
|
||||
{##}
|
||||
{# <button type="submit" class="btn btn-success">Submit</button>#}
|
||||
{# </form>#}
|
||||
{% endblock %}
|
71
app/templates/developer/client_details/oauth_endpoint.html
Normal file
71
app/templates/developer/client_details/oauth_endpoint.html
Normal file
@ -0,0 +1,71 @@
|
||||
{% extends "developer/client_details/base.html" %}
|
||||
|
||||
{% set client_details_page = "oauth_endpoint" %}
|
||||
{% block client_details_content %}
|
||||
|
||||
<h1 class="h2">OAuth2 endpoints</h1>
|
||||
<div class="form-group">
|
||||
<label class="form-label">OpenID Connect Discovery Document</label>
|
||||
<div class="input-group mt-2">
|
||||
<input type="text"
|
||||
disabled
|
||||
value="{{ URL + "/.well-known/openid-configuration" }}"
|
||||
class="form-control">
|
||||
<span class="input-group-append">
|
||||
<button data-clipboard-text="{{ URL + "/.well-known/openid-configuration" }}"
|
||||
class="clipboard btn btn-primary"
|
||||
type="button">
|
||||
<i class="fe fe-clipboard"></i>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label">Authorization endpoint</label>
|
||||
<div class="input-group mt-2">
|
||||
<input type="text"
|
||||
disabled
|
||||
value="{{ URL + "/oauth2/authorize" }}"
|
||||
class="form-control">
|
||||
<span class="input-group-append">
|
||||
<button data-clipboard-text="{{ URL + "/oauth2/authorize" }}"
|
||||
class="clipboard btn btn-primary"
|
||||
type="button">
|
||||
<i class="fe fe-clipboard"></i>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label">Token endpoint</label>
|
||||
<div class="input-group mt-2">
|
||||
<input type="text"
|
||||
disabled
|
||||
value="{{ URL + "/oauth2/token" }}"
|
||||
class="form-control">
|
||||
<span class="input-group-append">
|
||||
<button data-clipboard-text="{{ URL + "/oauth2/token" }}"
|
||||
class="clipboard btn btn-primary"
|
||||
type="button">
|
||||
<i class="fe fe-clipboard"></i>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label">UserInfo endpoint</label>
|
||||
<div class="input-group mt-2">
|
||||
<input type="text"
|
||||
disabled
|
||||
value="{{ URL + "/oauth2/userinfo" }}"
|
||||
class="form-control">
|
||||
<span class="input-group-append">
|
||||
<button data-clipboard-text="{{ URL + "/oauth2/userinfo" }}"
|
||||
class="clipboard btn btn-primary"
|
||||
type="button">
|
||||
<i class="fe fe-clipboard"></i>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
130
app/templates/developer/client_details/oauth_setting.html
Normal file
130
app/templates/developer/client_details/oauth_setting.html
Normal file
@ -0,0 +1,130 @@
|
||||
{% extends "developer/client_details/base.html" %}
|
||||
|
||||
{% set client_details_page = "oauth_setting" %}
|
||||
{% block client_details_content %}
|
||||
|
||||
<form method="post">
|
||||
{{ form.csrf_token }}
|
||||
<h1 class="h2">OAuth2 Settings</h1>
|
||||
<div class="form-group">
|
||||
<label class="form-label">AppID / OAuth2 Client ID</label>
|
||||
<div class="input-group mt-2">
|
||||
<input disabled
|
||||
type="text"
|
||||
value="{{ client.oauth_client_id }}"
|
||||
class="form-control">
|
||||
<span class="input-group-append">
|
||||
<button data-clipboard-text="{{ client.oauth_client_id }}"
|
||||
class="clipboard btn btn-primary"
|
||||
type="button">
|
||||
<i class="fe fe-clipboard"></i>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label">AppSecret / OAuth2 Client Secret</label>
|
||||
<div class="input-group mt-2">
|
||||
<input disabled
|
||||
type="password"
|
||||
value="{{ client.oauth_client_secret }}"
|
||||
class="form-control">
|
||||
<span class="input-group-append">
|
||||
<button data-clipboard-text="{{ client.oauth_client_secret }}"
|
||||
class="clipboard btn btn-primary"
|
||||
type="button">
|
||||
<i class="fe fe-clipboard"></i>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
<hr />
|
||||
<div class="form-group">
|
||||
<label class="form-label">Authorized Redirect URIs</label>
|
||||
<small class="text-muted">
|
||||
By default <b>localhost</b> is whitelisted.
|
||||
<br />
|
||||
A <b>redirect_uri</b> must be <b>HTTPS</b> for security reason.
|
||||
</small>
|
||||
{% if not client.redirect_uris %}
|
||||
|
||||
<div class="alert alert-warning alert-dismissible fade show mb-4"
|
||||
role="alert">
|
||||
<p>
|
||||
You haven't added any
|
||||
<a href="https://www.oauth.com/oauth2-servers/redirect-uris/">redirect_uri</a>
|
||||
,
|
||||
that is the url that will receive the <b>code</b> or <b>access-token</b> in OAuth2 flow.
|
||||
</p>
|
||||
<p>
|
||||
There's NO NEED to add <em>http://localhost:*</em> as by default,
|
||||
SimpleLogin <b>whitelists</b> localhost (unlike Facebook).
|
||||
</p>
|
||||
<p>
|
||||
You DO need to add your <b>redirect_uri</b> once your app goes live (i.e. deployed on production).
|
||||
</p>
|
||||
<p>
|
||||
The <b>redirect_uri</b> needs to be <b>HTTPS</b> for security reason.
|
||||
</p>
|
||||
<p>
|
||||
Start by adding your first <b>redirect_uri</b> here 👇
|
||||
</p>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% for redirect_uri in client.redirect_uris %}
|
||||
|
||||
<div class="input-group mt-2">
|
||||
<input type="url"
|
||||
name="uri"
|
||||
class="form-control"
|
||||
value="{{ redirect_uri.uri }}"
|
||||
required
|
||||
pattern="^https:\/\/.*"
|
||||
title="redirect_uri must be https">
|
||||
<span class="input-group-append">
|
||||
<button class="remove-uri btn btn-primary" type="button">
|
||||
<i class="fe fe-x"></i>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
{% endfor %}
|
||||
<div id="new-uris">
|
||||
<!-- New uri will be put here -->
|
||||
</div>
|
||||
<button type="button" id="create-new-uri" class="mt-2 btn btn-secondary">Add new uri</button>
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Update</button>
|
||||
</form>
|
||||
<!-- template for new uri -->
|
||||
<div class="input-group mt-2" id="hidden-uri" style="display: none">
|
||||
<input type="url"
|
||||
name="uri"
|
||||
class="form-control"
|
||||
required
|
||||
pattern="^https:\/\/.*"
|
||||
title="redirect_uri must be https">
|
||||
<span class="input-group-append">
|
||||
<button class="remove-uri btn btn-primary" type="button">
|
||||
<i class="fe fe-x"></i>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% block script %}
|
||||
|
||||
<script>
|
||||
$("#create-new-uri").on("click", function (e) {
|
||||
var clone = $("#hidden-uri").clone(true, true); // (true, true) to clone withDataAndEvents, deepWithDataAndEvents
|
||||
clone.removeAttr("id");
|
||||
|
||||
$("#new-uris").append(clone);
|
||||
clone.show();
|
||||
});
|
||||
|
||||
$(".remove-uri").click(function (e) {
|
||||
var currentElement = $(this);
|
||||
currentElement.parent().parent().remove();
|
||||
});
|
||||
|
||||
</script>
|
||||
{% endblock %}
|
35
app/templates/developer/client_details/referral.html
Normal file
35
app/templates/developer/client_details/referral.html
Normal file
@ -0,0 +1,35 @@
|
||||
{% extends "developer/client_details/base.html" %}
|
||||
|
||||
{% set client_details_page = "referral" %}
|
||||
{% block client_details_content %}
|
||||
|
||||
<h1 class="h2">Referral</h1>
|
||||
<div>
|
||||
If you are in the
|
||||
<a href="{{ url_for('dashboard.referral_route') }}">referral</a>
|
||||
program, you can attach a
|
||||
referral to this website.
|
||||
Any SimpleLogin sign up thanks to the SIWSL on your website will be counted towards this referral.
|
||||
</div>
|
||||
<form method="post" class="mt-3">
|
||||
<div class="form-group">
|
||||
<label class="form-label" for="client-select">Referral</label>
|
||||
<select class="form-control" name="referral-id" id="client-select">
|
||||
{% for referral in current_user.referrals %}
|
||||
|
||||
<option value="{{ referral.id }}"
|
||||
{% if client.referral_id == referral.id %} selected{% endif %}>
|
||||
{{ referral.name }}
|
||||
</option>
|
||||
{% endfor %}
|
||||
{% if client.referral_id is none %}
|
||||
|
||||
<option value="" selected>
|
||||
No referral selected
|
||||
</option>
|
||||
{% endif %}
|
||||
</select>
|
||||
</div>
|
||||
<input type="submit" class="btn btn-primary" value="Update">
|
||||
</form>
|
||||
{% endblock %}
|
91
app/templates/developer/index.html
Normal file
91
app/templates/developer/index.html
Normal file
@ -0,0 +1,91 @@
|
||||
{% extends "default.html" %}
|
||||
|
||||
{% set active_page = "developer" %}
|
||||
{% block title %}Sign in with SimpleLogin{% endblock %}
|
||||
{% block default_content %}
|
||||
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<h1 class="h3">
|
||||
Sign in with SimpleLogin (SIWSL)
|
||||
<a class="ml-3 text-info"
|
||||
style="font-size: 12px"
|
||||
data-toggle="collapse"
|
||||
href="#howtouse"
|
||||
role="button"
|
||||
aria-expanded="false"
|
||||
aria-controls="collapseExample">
|
||||
How to use <i class="fe fe-chevrons-down"></i>
|
||||
</a>
|
||||
</h1>
|
||||
<div class="alert alert-primary collapse {% if not clients %} show{% endif %}"
|
||||
id="howtouse"
|
||||
role="alert">
|
||||
If you want to integrate SIWSL into your website,
|
||||
this page is for you.
|
||||
<br />
|
||||
<br />
|
||||
If you are using a CMS or any system that supports a OpenID Connect plugin, you can just point
|
||||
it to SimpleLogin OpenID Configuration endpoint 👇
|
||||
<div class="input-group mt-2">
|
||||
<input type="text"
|
||||
disabled
|
||||
value="{{ URL + "/.well-known/openid-configuration" }}"
|
||||
class="form-control">
|
||||
<span class="input-group-append">
|
||||
<button data-clipboard-text="{{ URL + "/.well-known/openid-configuration" }}"
|
||||
class="clipboard btn btn-primary"
|
||||
type="button">
|
||||
<i class="fe fe-clipboard"></i>
|
||||
</button>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="btn-group" role="group" aria-label="Basic example">
|
||||
<a href="{{ url_for('developer.new_client') }}" class="btn btn-primary">New website</a>
|
||||
<a href="https://docs.simplelogin.io"
|
||||
target="_blank"
|
||||
class="ml-2 btn btn-secondary">
|
||||
Docs <i class="fe fe-external-link"></i>
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row row-cards row-deck mt-4">
|
||||
{% for client in clients %}
|
||||
|
||||
<div class="col-12 col-lg-6">
|
||||
<div class="card" style="">
|
||||
<div class="card-body">
|
||||
<h5 class="card-title">
|
||||
<a href="{{ url_for('developer.client_detail', client_id=client.id) }}">{{ client.name }}</a>
|
||||
{% if client.approved %}
|
||||
|
||||
<span class="cursor" data-toggle="tooltip" data-original-title="Approved">✅</span>
|
||||
{% else %}
|
||||
<span class="cursor"
|
||||
data-toggle="tooltip"
|
||||
data-original-title="In Dev mode. Please contact us to publish your app.">
|
||||
<a href="{{ url_for('developer.client_detail', client_id=client.id) }}"
|
||||
class="text-decoration-none">🚫</a>
|
||||
</span>
|
||||
{% endif %}
|
||||
</h5>
|
||||
<h6 class="card-subtitle mb-4 text-muted">
|
||||
Created {{ client.created_at | dt }}
|
||||
<br />
|
||||
<span class="font-weight-bold">{{ client.nb_user() }}</span> users
|
||||
<br />
|
||||
</h6>
|
||||
<a href="{{ url_for('developer.client_detail', client_id=client.id) }}"
|
||||
class="mt-3">Details ➡</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endblock %}
|
26
app/templates/developer/new_client.html
Normal file
26
app/templates/developer/new_client.html
Normal file
@ -0,0 +1,26 @@
|
||||
{% extends "default.html" %}
|
||||
|
||||
{% set active_page = "developer" %}
|
||||
{% block title %}Developer - Create new website{% endblock %}
|
||||
{% block default_content %}
|
||||
|
||||
<div class="card">
|
||||
<div class="card-body">
|
||||
<h1 class="h3">New website</h1>
|
||||
<form method="post" enctype="multipart/form-data">
|
||||
{{ form.csrf_token }}
|
||||
<div class="form-group">
|
||||
<label class="form-label">Name</label>
|
||||
{{ form.name(class="form-control", placeholder="My Community Forum") }}
|
||||
{{ render_field_errors(form.name) }}
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label class="form-label">Url</label>
|
||||
{{ form.url(class="form-control", type="url", placeholder="https://forum.com") }}
|
||||
{{ render_field_errors(form.url) }}
|
||||
</div>
|
||||
<button type="submit" class="btn btn-primary">Create</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
{% endblock %}
|
Reference in New Issue
Block a user