Browse Source

Ajout de l'attribut secure:true aux cookies

Lou 3 years ago
parent
commit
ba53b57221
2 changed files with 5 additions and 2 deletions
  1. 4
    1
      src/components/forms/LoginForm/index.jsx
  2. 1
    1
      src/pages/Login/index.jsx

+ 4
- 1
src/components/forms/LoginForm/index.jsx View File

@@ -34,7 +34,10 @@ const LoginForm = () => {
34 34
 			const response = await post("/tokens", body);
35 35
 			// Pareil ici, utiliser une fonction qui vérifie la validité des données
36 36
 			if (response != null) {
37
-				Cookies.set("token", response.data.token, { sameSite: "strict" });
37
+				Cookies.set("token", response.data.token, {
38
+					sameSite: "strict",
39
+					Secure: true
40
+				});
38 41
 				const payload = {
39 42
 					type: "user",
40 43
 					id: jwt_decode(response.data.token).user_id,

+ 1
- 1
src/pages/Login/index.jsx View File

@@ -1,4 +1,4 @@
1
-import React, { useEffect } from "react";
1
+import React from "react";
2 2
 import LoginForm from "../../components/forms/LoginForm/";
3 3
 
4 4
 const LoginPage = () => {

Loading…
Cancel
Save