authn tél : rendre paramétrable dans le BO la durée de vie des codes SMS reçus (#88786) #287

Merged
pmarillonnet merged 1 commits from wip/88786-phone-authn-sms-code-duration-through-authenticator into main 2024-04-04 10:51:09 +02:00
Owner
No description provided.
pmarillonnet added 1 commit 2024-03-28 09:53:14 +01:00
gitea/authentic/pipeline/head There was a failure building this commit Details
a486ac3490
[wip] base field in login/pwd authenticator
pmarillonnet added 1 commit 2024-03-28 09:58:51 +01:00
gitea/authentic/pipeline/head There was a failure building this commit Details
bfbe4449c9
[wip] min max value validator w/ custom message
pmarillonnet force-pushed wip/88786-phone-authn-sms-code-duration-through-authenticator from bfbe4449c9 to 5ce081ecbc 2024-03-28 10:05:53 +01:00 Compare
pmarillonnet added 1 commit 2024-03-28 10:20:22 +01:00
gitea/authentic/pipeline/head There was a failure building this commit Details
115d7f2a8a
[wip] replace occurrences of hardcoded values
pmarillonnet force-pushed wip/88786-phone-authn-sms-code-duration-through-authenticator from 115d7f2a8a to 16ad3236e1 2024-03-28 10:28:16 +01:00 Compare
pmarillonnet force-pushed wip/88786-phone-authn-sms-code-duration-through-authenticator from 16ad3236e1 to 5c9ec86f03 2024-03-28 10:38:52 +01:00 Compare
pmarillonnet added 1 commit 2024-03-28 11:10:02 +01:00
gitea/authentic/pipeline/head This commit looks good Details
96a3e2eba3
[wip] test authenticator
pmarillonnet force-pushed wip/88786-phone-authn-sms-code-duration-through-authenticator from 96a3e2eba3 to 264073a783 2024-03-28 11:27:07 +01:00 Compare
pmarillonnet changed title from WIP: authn tél : rendre paramétrable dans le BO la durée de vie des codes SMS reçus (#88786) to authn tél : rendre paramétrable dans le BO la durée de vie des codes SMS reçus (#88786) 2024-03-28 11:31:49 +01:00
tnoel requested changes 2024-03-29 18:07:27 +01:00
Dismissed
@ -409,1 +410,4 @@
)
sms_code_duration = models.PositiveSmallIntegerField(
_('SMS codes lifetime (in seconds)'),
default='180',
Owner

En posant un default ici, ça fait qu'il n'y aura pas de valeur par défaut qu'on pourra changer ensuite chez tous nos clients. Il serait préférable d'avoir un settings.SMS_CODE_DURATION qui sera la durée à prendre en compte si sms_code_duration est à None (quand aucune valeur n'aura été posée). Genre
self.sms_code_duration or getattr(settings, 'SMS_CODE_DURATION', None) or 180

En posant un default ici, ça fait qu'il n'y aura pas de valeur par défaut qu'on pourra changer ensuite chez tous nos clients. Il serait préférable d'avoir un settings.SMS_CODE_DURATION qui sera la durée à prendre en compte si sms_code_duration est à None (quand aucune valeur n'aura été posée). Genre `self.sms_code_duration or getattr(settings, 'SMS_CODE_DURATION', None) or 180`
Author
Owner

Ok très bien, je vais faire ainsi.

Ok très bien, je vais faire ainsi.
Author
Owner

C’est corrigé et visible dans la branche.

C’est corrigé et visible dans la branche.
pmarillonnet changed title from authn tél : rendre paramétrable dans le BO la durée de vie des codes SMS reçus (#88786) to WIP: authn tél : rendre paramétrable dans le BO la durée de vie des codes SMS reçus (#88786) 2024-04-02 14:46:01 +02:00
pmarillonnet force-pushed wip/88786-phone-authn-sms-code-duration-through-authenticator from 264073a783 to 705791f1f0 2024-04-02 14:47:09 +02:00 Compare
pmarillonnet added 1 commit 2024-04-02 15:00:51 +02:00
gitea/authentic/pipeline/head There was a failure building this commit Details
ffd6e5db6a
[wip/tosquash] model field becomes optional
pmarillonnet force-pushed wip/88786-phone-authn-sms-code-duration-through-authenticator from ffd6e5db6a to 0687a4c06f 2024-04-02 15:06:47 +02:00 Compare
pmarillonnet force-pushed wip/88786-phone-authn-sms-code-duration-through-authenticator from 0687a4c06f to 4f8099d296 2024-04-02 15:11:06 +02:00 Compare
pmarillonnet force-pushed wip/88786-phone-authn-sms-code-duration-through-authenticator from 4f8099d296 to 6f01cc73cc 2024-04-02 15:14:23 +02:00 Compare
pmarillonnet force-pushed wip/88786-phone-authn-sms-code-duration-through-authenticator from 6f01cc73cc to a70de53b22 2024-04-02 15:19:50 +02:00 Compare
pmarillonnet changed title from WIP: authn tél : rendre paramétrable dans le BO la durée de vie des codes SMS reçus (#88786) to authn tél : rendre paramétrable dans le BO la durée de vie des codes SMS reçus (#88786) 2024-04-02 15:20:12 +02:00
pmarillonnet requested review from tnoel 2024-04-02 15:20:40 +02:00
tnoel reviewed 2024-04-02 17:33:38 +02:00
@ -428,1 +429,4 @@
)
sms_code_duration = models.PositiveSmallIntegerField(
_('SMS codes lifetime (in seconds)'),
help_text=_('Time (in seconds, between 60 and 3600) after which SMS codes expire.'),
Owner

Ajoutons "la valeur par défaut est " settings.SMS_DURATION_MACHIN

Ajoutons "la valeur par défaut est " settings.SMS_DURATION_MACHIN
Author
Owner

C’est fait, avec un help_text qui est maintenant un callable (sinon juste avec une fstring c’est la valeur évaluée au moment de la génération de la migration qui se retrouve définitivement utilisée).

Edit: j’ai aussi remplacé le validateur custom par une combinaison du MinValueValidator et du MaxValueValidator de Django, qui font très bien l’affaire (et qui disposent déjà de la sérialisation nécessaire à leur déclaration dans la migration).

C’est fait, avec un help_text qui est maintenant un callable (sinon juste avec une fstring c’est la valeur évaluée au moment de la génération de la migration qui se retrouve définitivement utilisée). Edit: j’ai aussi remplacé le validateur custom par une combinaison du MinValueValidator et du MaxValueValidator de Django, qui font très bien l’affaire (et qui disposent déjà de la sérialisation nécessaire à leur déclaration dans la migration).
pmarillonnet added 2 commits 2024-04-02 17:48:07 +02:00
pmarillonnet force-pushed wip/88786-phone-authn-sms-code-duration-through-authenticator from 313de2a763 to ea5bfc9c7c 2024-04-03 10:24:59 +02:00 Compare
pmarillonnet force-pushed wip/88786-phone-authn-sms-code-duration-through-authenticator from ea5bfc9c7c to 7f5b49fb58 2024-04-03 10:27:30 +02:00 Compare
pmarillonnet force-pushed wip/88786-phone-authn-sms-code-duration-through-authenticator from 7f5b49fb58 to f3e57d5089 2024-04-03 10:42:41 +02:00 Compare
tnoel reviewed 2024-04-03 17:50:03 +02:00
@ -235,1 +236,4 @@
def sms_code_duration_help_text():
return _(
f'Time (in seconds, between 60 and 3600) after which SMS codes expire. Default is {settings.SMS_CODE_DURATION}.'
Owner

Ah ouais carrément. Trop fort les f-strings.

Ah ouais carrément. Trop fort les f-strings.
tnoel approved these changes 2024-04-03 17:50:57 +02:00
pmarillonnet merged commit f3e57d5089 into main 2024-04-04 10:51:09 +02:00
pmarillonnet deleted branch wip/88786-phone-authn-sms-code-duration-through-authenticator 2024-04-04 10:51:09 +02:00
Sign in to join this conversation.
No reviewers
No Label
No Milestone
No Assignees
2 Participants
Notifications
Due Date
The due date is invalid or out of range. Please use the format 'yyyy-mm-dd'.

No due date set.

Dependencies

No dependencies set.

Reference: entrouvert/authentic#287
No description provided.