Skip to content

Commit 685bcae

Browse files
refacto: improvement after review
1 parent 38f9b04 commit 685bcae

File tree

4 files changed

+4
-11
lines changed

4 files changed

+4
-11
lines changed

cypress/e2e/signin_with_totp/index.cy.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
describe("sign-in with TOTP on untrusted browser", () => {
2-
it.only("should seed the database once", function () {
2+
it("should seed the database once", function () {
33
cy.seed();
44
});
55

@@ -36,7 +36,7 @@ describe("sign-in with TOTP on untrusted browser", () => {
3636
cy.contains('"amr": [\n "pwd",\n "totp",\n "mfa"\n ],');
3737
});
3838

39-
it.only("should sign-in with TOTP when forced by SP, password only otherwise", function () {
39+
it("should sign-in with TOTP when forced by SP, password only otherwise", function () {
4040
cy.visit("http://localhost:4000");
4141
cy.get("button.proconnect-button").click();
4242

src/controllers/user/two-factors-authentication-configuration.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -53,9 +53,7 @@ export const getIsTotpAppInstalledController = async (
5353
next: NextFunction,
5454
) => {
5555
try {
56-
const schema = z.object({
57-
"2fa_force": optionalBooleanSchema(),
58-
});
56+
const schema = z.object({ "2fa_force": optionalBooleanSchema() });
5957

6058
const { "2fa_force": temporaryForce2fa } = await schema.parseAsync(
6159
req.query,

src/managers/totp.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,11 +64,7 @@ export const confirmTotpRegistration = async (
6464
totp_key_verified_at: new Date(),
6565
});
6666

67-
if (temporaryForce2fa) {
68-
return await enableForce2fa(user_id);
69-
} else {
70-
return await disableForce2fa(user_id);
71-
}
67+
return temporaryForce2fa ? enableForce2fa(user_id) : disableForce2fa(user_id);
7268
};
7369

7470
export const deleteTotpConfiguration = async (user_id: number) => {

src/views/user/double-authentication-choice.ejs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,6 @@
5050
<div class="fr-checkbox-group fr-pl-1w fr-pb-2w">
5151
<input name="2fa_force" id="mfa-proconnect-config" type="checkbox" aria-describedby="mfa-proconnect-config-messages">
5252
<label class="fr-label" for="mfa-proconnect-config">Je configure la 2FA sur l'ensemble des sites que j'utilise avec ProConnect<span class="fr-hint-text">Par défaut, la 2FA s'applique uniquement aux sites qui l'exigent</span></label>
53-
<div class="fr-messages-group" id="mfa-proconnect-config-messages" aria-live="polite">
5453
</div>
5554
</div>
5655
</fieldset>

0 commit comments

Comments
 (0)