mirror of
https://gitlab.com/animath/si/plateforme.git
synced 2025-08-25 00:12:53 +02:00
Compare commits
2 Commits
502b066311
...
91d39b44a2
Author | SHA1 | Date | |
---|---|---|---|
|
91d39b44a2
|
||
|
d3631877c4
|
@@ -23,14 +23,18 @@ class Matrix:
|
|||||||
Retrieve the bot account.
|
Retrieve the bot account.
|
||||||
If not logged, log in and store access token.
|
If not logged, log in and store access token.
|
||||||
"""
|
"""
|
||||||
if not os.getenv("SYNAPSE_PASSWORD"):
|
if not os.getenv("SYNAPSE_PASSWORD") and not os.getenv("SYNAPSE_TOKEN"):
|
||||||
return FakeMatrixClient()
|
return FakeMatrixClient()
|
||||||
|
|
||||||
from nio import AsyncClient
|
from nio import AsyncClient
|
||||||
client = AsyncClient("https://tfjm.org", "@tfjmbot:tfjm.org")
|
client = AsyncClient("https://tfjm.org", "@tfjmbot:tfjm.org")
|
||||||
client.user_id = "@tfjmbot:tfjm.org"
|
client.user_id = "@tfjmbot:tfjm.org"
|
||||||
|
|
||||||
if os.path.isfile(".matrix_token"):
|
if os.getenv("SYNAPSE_TOKEN"):
|
||||||
|
client.access_token = os.getenv("SYNAPSE_TOKEN")
|
||||||
|
client.device_id = os.getenv("SYNAPSE_DEVICE")
|
||||||
|
return client
|
||||||
|
elif os.path.isfile(".matrix_token"):
|
||||||
with open(".matrix_device", "r") as f:
|
with open(".matrix_device", "r") as f:
|
||||||
cls._device_id = f.read().rstrip(" \t\r\n")
|
cls._device_id = f.read().rstrip(" \t\r\n")
|
||||||
client.device_id = cls._device_id
|
client.device_id = cls._device_id
|
||||||
|
@@ -20,7 +20,7 @@ SPDX-License-Identifier: GPL-2.0-or-later
|
|||||||
<div id="form-content">
|
<div id="form-content">
|
||||||
{% csrf_token %}
|
{% csrf_token %}
|
||||||
{{ form | crispy }}
|
{{ form | crispy }}
|
||||||
<a href="{% url 'password_reset' %}" class="badge badge-light">{% trans 'Forgotten your password or username?' %}</a>
|
<a href="{% url 'password_reset' %}" class="badge text-bg-warning">{% trans 'Forgotten your password or username?' %}</a>
|
||||||
</div>
|
</div>
|
||||||
<input type="submit" value="{% trans 'Log in' %}" class="btn btn-primary">
|
<input type="submit" value="{% trans 'Log in' %}" class="btn btn-primary">
|
||||||
</form>
|
</form>
|
||||||
|
Reference in New Issue
Block a user