splent_feature_reset
The reset feature of a SPLENT product line.
A password reset by mail. Without it a person who forgets their password
needs an administrator. With it, a "Forgot your password?" link appears
under the login form and the sign-up form, and leads to a page that mails a
link to set a new password. It needs auth, which owns the account, and
mail, which sends the link.
A SPLENT feature is a Python package that a product composes with others.
Its models, routes, services, templates and hooks are registered when the
product starts. What this feature provides and requires is listed in the
[tool.splent.contract] section of pyproject.toml, which
splent feature:contract --write keeps in sync with the source.
What a reset does
/reset/forgotasks for an address. On submit,reset-submittingis sent, and any listener may refuse (see below).- The address finds the account by its canonical form (auth compares it byte for byte, so an accented look-alike finds nothing), and the link goes to the address the account has, never to the one typed. A switched off account gets no link. The page answers the same whether or not the address has an account, so it does not tell anyone which addresses are registered.
- The link carries one of auth's one-time tokens (auth 1.22 or later): 32
random bytes, of which auth keeps only the SHA-256, with the account, the
address it went to and its expiry.
/reset/password/<token>opens forRESET_TOKEN_MAX_AGEseconds (an hour). It asks for the new password twice and follows auth's password policy, the same as every other form that sets a password (with auth 1.23, its breach check too). The page sends no Referer, is not cached and, with auth 1.23, runs no script of another site. - In one transaction the link is spent, with the account's other reset links, the password changes, every session of the account ends and the address is marked confirmed, since the link reached it. A mail tells the account its password was changed.
| Case | Result |
|---|---|
| A link used, expired, of the old signed kind, or not a link at all | 410, a page that says so and asks for a new link |
| The same link followed twice at once | One sets the password, the other gets the 410 page |
| A password the policy refuses, or two that differ | The page again, with why, and 400 |
The texts are translated to Spanish.
Password
| Setting (auth) | Default | On the reset page |
|---|---|---|
AUTH_PASSWORD_MIN_LENGTH |
8 | The shortest password accepted |
The page always asks twice, whatever AUTH_PASSWORD_CONFIRM says. With an
auth older than its password policy, which has no passwords module, the
page asks for at least 8 characters.
Checks before a link is sent
reset-submitting is sent when someone asks for a link, before the address
is looked up and before any mail goes out, with form (the posted form) and
remoteip (the visitor's address). A listener that returns False refuses
the request: no mail goes out, and the form comes back with the address
typed and "We could not verify this request. Please try again.", which says
nothing about the account. None or True let it through.
A listener draws what it needs in the reset.form_fields slot, inside the
form and right above the button. A callback takes no arguments and returns
HTML, or an empty string to add nothing on this request.
splent_feature_captcha listens here and fills the slot, once the product
names the form:
[tool.splent.config]
CAPTCHA_PROTECTED_FORMS = ["signup", "reset"]
A feature of its own listens the same way:
# signals.py of a feature that checks the request
from splent_framework.signals.signal_utils import connect_signal
@connect_signal("reset-submitting", "splent_feature_mycheck")
def check_the_request(sender, form=None, remoteip=None, **kwargs):
return form.get("my-answer") == "..."
The signal and the slot exist from the release after 1.5.0. With 1.5.0 or
older the form cannot be protected, and naming reset in
CAPTCHA_PROTECTED_FORMS protects nothing (captcha's log says so).
Slots
| Slot | Opened by | What reset puts there |
|---|---|---|
reset.form_fields |
The page that asks for a link | Nothing. It is for a check's widget |
auth.login.form_footer |
auth's login form | "Forgot your password? Click here!" |
signup.form_footer |
signup's form | The same link |
layout.scripts |
The layout | reset.bundle.js, which keeps the button of the new password off until both boxes match |
Not yet
- Nothing limits how many links one address can ask for, apart from a
check on
reset-submitting, such as a captcha. A throttle per address and per account, with the same answer either way, is still to come. - The texts of the pages and the mails are in English, with no translations.
Use it in a product
splent feature:add splent_feature_reset
Develop
splent feature:test splent_feature_reset
splent feature:contract splent_feature_reset
Release
splent feature:release splent_feature_reset --dry-run --bump minor
splent feature:release splent_feature_reset
The first command rehearses the release and changes nothing. The second publishes it to the git forge and to PyPI, and a PyPI version is permanent.
Metadata
Release files for splent-feature-reset 2.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | |
|---|---|---|---|---|
| splent_feature_reset-2.1.0.tar.gz | 30.4 kB | Without provenance | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| splent_feature_reset-2.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 69.8 kB
Release files / splent_feature_reset-2.1.0.tar.gz
| Download URL | splent_feature_reset-2.1.0.tar.gz |
|---|---|
| Size | 30.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
38fb4efef2dad289012d7e77e328c9682b10590db18bab9709e30ca7e5d1712a
|
|
BLAKE2b-256 checksum How to use checksums |
52b81947840c0fc6b257922c9ac13a86f0e71ffa8337abceb8ea2275bdf4074d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.16
|
Release files / splent_feature_reset-2.1.0-py3-none-any.whl
| Download URL | splent_feature_reset-2.1.0-py3-none-any.whl |
|---|---|
| Size | 39.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
7f354d7f243016347668e26c05c66d75941da0015e291f27b167d443442b696a
|
|
BLAKE2b-256 checksum How to use checksums |
dc1d9a33db2637aafc96dcf997918ba01811be42275664f0ddc4b3f4698a680d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.13.16
|
Security for splent-feature-reset 2.1.0
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.