splent-feature-github 0.2.1__tar.gz → 0.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {splent_feature_github-0.2.1/src/splent_feature_github.egg-info → splent_feature_github-0.4.0}/PKG-INFO +1 -1
- {splent_feature_github-0.2.1 → splent_feature_github-0.4.0}/pyproject.toml +14 -2
- {splent_feature_github-0.2.1 → splent_feature_github-0.4.0/src/splent_feature_github.egg-info}/PKG-INFO +1 -1
- {splent_feature_github-0.2.1 → splent_feature_github-0.4.0}/src/splent_io/splent_feature_github/config.py +6 -0
- {splent_feature_github-0.2.1 → splent_feature_github-0.4.0}/src/splent_io/splent_feature_github/hooks.py +6 -1
- {splent_feature_github-0.2.1 → splent_feature_github-0.4.0}/src/splent_io/splent_feature_github/templates/hooks/github_profile_row.html +9 -2
- {splent_feature_github-0.2.1 → splent_feature_github-0.4.0}/src/splent_io/splent_feature_github/translations/es/LC_MESSAGES/messages.mo +0 -0
- {splent_feature_github-0.2.1 → splent_feature_github-0.4.0}/src/splent_io/splent_feature_github/translations/es/LC_MESSAGES/messages.po +2 -0
- {splent_feature_github-0.2.1 → splent_feature_github-0.4.0}/COPYING +0 -0
- {splent_feature_github-0.2.1 → splent_feature_github-0.4.0}/COPYING.LESSER +0 -0
- {splent_feature_github-0.2.1 → splent_feature_github-0.4.0}/MANIFEST.in +0 -0
- {splent_feature_github-0.2.1 → splent_feature_github-0.4.0}/README.md +0 -0
- {splent_feature_github-0.2.1 → splent_feature_github-0.4.0}/setup.cfg +0 -0
- {splent_feature_github-0.2.1 → splent_feature_github-0.4.0}/src/splent_feature_github.egg-info/SOURCES.txt +0 -0
- {splent_feature_github-0.2.1 → splent_feature_github-0.4.0}/src/splent_feature_github.egg-info/dependency_links.txt +0 -0
- {splent_feature_github-0.2.1 → splent_feature_github-0.4.0}/src/splent_feature_github.egg-info/top_level.txt +0 -0
- {splent_feature_github-0.2.1 → splent_feature_github-0.4.0}/src/splent_io/splent_feature_github/__init__.py +0 -0
- {splent_feature_github-0.2.1 → splent_feature_github-0.4.0}/src/splent_io/splent_feature_github/assets/css/github.css +0 -0
- {splent_feature_github-0.2.1 → splent_feature_github-0.4.0}/src/splent_io/splent_feature_github/migrations/alembic.ini +0 -0
- {splent_feature_github-0.2.1 → splent_feature_github-0.4.0}/src/splent_io/splent_feature_github/migrations/env.py +0 -0
- {splent_feature_github-0.2.1 → splent_feature_github-0.4.0}/src/splent_io/splent_feature_github/migrations/script.py.mako +0 -0
- {splent_feature_github-0.2.1 → splent_feature_github-0.4.0}/src/splent_io/splent_feature_github/migrations/versions/7ace6050fb3f_splent_feature_github.py +0 -0
- {splent_feature_github-0.2.1 → splent_feature_github-0.4.0}/src/splent_io/splent_feature_github/migrations/versions/github0002_into_ext_identity.py +0 -0
- {splent_feature_github-0.2.1 → splent_feature_github-0.4.0}/src/splent_io/splent_feature_github/models.py +0 -0
- {splent_feature_github-0.2.1 → splent_feature_github-0.4.0}/src/splent_io/splent_feature_github/routes.py +0 -0
- {splent_feature_github-0.2.1 → splent_feature_github-0.4.0}/src/splent_io/splent_feature_github/services.py +0 -0
- {splent_feature_github-0.2.1 → splent_feature_github-0.4.0}/src/splent_io/splent_feature_github/templates/hooks/github_login_button.html +0 -0
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "splent_feature_github"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.4.0"
|
|
8
8
|
readme = "README.md"
|
|
9
9
|
requires-python = ">=3.13"
|
|
10
10
|
license = "LGPL-3.0-or-later"
|
|
@@ -48,7 +48,7 @@ translations = ["es"]
|
|
|
48
48
|
docker = []
|
|
49
49
|
|
|
50
50
|
[tool.splent.contract.requires]
|
|
51
|
-
features = ["auth", "identities", "profile"]
|
|
51
|
+
features = ["auth>=1.23.0", "identities>=0.3.0", "profile"]
|
|
52
52
|
features_manual = ["profile"]
|
|
53
53
|
features_optional = ["signup"]
|
|
54
54
|
env_vars = ["GITHUB_CLIENT_ID", "GITHUB_CLIENT_SECRET", "GITHUB_SCOPE"]
|
|
@@ -85,3 +85,15 @@ GITHUB_CLIENT_SECRET = ""
|
|
|
85
85
|
# person's addresses it verified; without it every new account asks for an
|
|
86
86
|
# address, which then has to be confirmed by mail.
|
|
87
87
|
GITHUB_SCOPE = "user:email"
|
|
88
|
+
|
|
89
|
+
# ── Parameters ────────────────────────────────────────────────────────────────
|
|
90
|
+
# The type of each key above, which product:validate checks a product's
|
|
91
|
+
# value against and the framework (1.22.0 and later) resolves at boot:
|
|
92
|
+
# default < product < environment. An older framework ignores it. deploy:
|
|
93
|
+
# the deployment's .env decides it; derivation: the product decides it, and
|
|
94
|
+
# an environment that changes it is drift. A secret never goes in a
|
|
95
|
+
# committed file: product:validate refuses it in the product's pyproject.
|
|
96
|
+
[tool.splent.config_schema]
|
|
97
|
+
GITHUB_CLIENT_ID = { type = "str", bind = "deploy", help = "The client ID of the OAuth app registered at https://github.com/settings/developers." }
|
|
98
|
+
GITHUB_CLIENT_SECRET = { type = "secret", help = "The client secret of that OAuth app." }
|
|
99
|
+
GITHUB_SCOPE = { type = "str", bind = "derivation", help = "What the sign-in asks GitHub for." }
|
|
@@ -4,6 +4,12 @@ github feature configuration.
|
|
|
4
4
|
The OAuth app registered at https://github.com/settings/developers.
|
|
5
5
|
Without both values GitHub sign-in is off: the app logs a warning at start,
|
|
6
6
|
and whoever tries is told it is not available.
|
|
7
|
+
|
|
8
|
+
[tool.splent.config_schema] in pyproject.toml declares each one's type, the
|
|
9
|
+
secret among them. A framework that reads it (1.22.0 and later) resolves
|
|
10
|
+
them itself right after inject_config, and the product's value reaches
|
|
11
|
+
app.config as written, so services.py reads the scope with its default. An
|
|
12
|
+
older one leaves them to this module.
|
|
7
13
|
"""
|
|
8
14
|
|
|
9
15
|
import os
|
|
@@ -37,11 +37,16 @@ def github_profile_row():
|
|
|
37
37
|
from splent_io.splent_feature_github.services import PROVIDER, github_url
|
|
38
38
|
from splent_io.splent_feature_identities.services import IdentitiesService
|
|
39
39
|
|
|
40
|
-
|
|
40
|
+
identities = IdentitiesService()
|
|
41
|
+
identity = identities.identity_of(current_user.id, PROVIDER)
|
|
41
42
|
return render_template(
|
|
42
43
|
"hooks/github_profile_row.html",
|
|
43
44
|
identity=identity,
|
|
44
45
|
github_url=github_url(identity) if identity else None,
|
|
46
|
+
# The only way the account signs in is not disconnected: the row
|
|
47
|
+
# offers to set a password first.
|
|
48
|
+
can_disconnect=identity is not None
|
|
49
|
+
and identities.keeps_a_way_in(current_user, PROVIDER, identity.provider_id),
|
|
45
50
|
)
|
|
46
51
|
|
|
47
52
|
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
{# A section of profile's edit page (profile.edit.sections), below the
|
|
2
2
|
profile form. The login links to the account on GitHub. The disconnect
|
|
3
3
|
button opens identities' modal, which posts the provider and account id
|
|
4
|
-
it carries
|
|
5
|
-
|
|
4
|
+
it carries; for the only way the account signs in, a link to set a
|
|
5
|
+
password comes first. The colours are in assets/css/github.css, and the
|
|
6
|
+
mark is drawn in currentColor. #}
|
|
6
7
|
{% if identity %}
|
|
7
8
|
<div class="mb-4 profile-identity" data-identity="github">
|
|
8
9
|
<label class="form-label fw-semibold">GitHub</label>
|
|
@@ -15,12 +16,18 @@
|
|
|
15
16
|
{% else %}
|
|
16
17
|
<span class="github-identity__value">{{ identity.provider_id }}</span>
|
|
17
18
|
{% endif %}
|
|
19
|
+
{% if can_disconnect %}
|
|
18
20
|
<button type="button" class="btn btn-sm p-0 github-identity__disconnect" title="{{ _('Disconnect') }}" aria-label="{{ _('Disconnect') }}" data-bs-toggle="modal" data-bs-target="#disconnectModal" data-provider="github" data-provider-id="{{ identity.provider_id }}">
|
|
19
21
|
<svg width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">
|
|
20
22
|
<line x1="18" y1="6" x2="6" y2="18"></line>
|
|
21
23
|
<line x1="6" y1="6" x2="18" y2="18"></line>
|
|
22
24
|
</svg>
|
|
23
25
|
</button>
|
|
26
|
+
{% else %}
|
|
27
|
+
{# The only way the account signs in: a password of its own comes
|
|
28
|
+
first, on My account, and then it can be disconnected. #}
|
|
29
|
+
<a class="ms-auto small github-identity__set-password" href="{{ url_for('auth.my_account', _anchor='password') }}" data-set-password-first>{{ _('Set a password to disconnect it') }}</a>
|
|
30
|
+
{% endif %}
|
|
24
31
|
</div>
|
|
25
32
|
</div>
|
|
26
33
|
{% else %}
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|