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
 			const response = await post("/tokens", body);
34
 			const response = await post("/tokens", body);
35
 			// Pareil ici, utiliser une fonction qui vérifie la validité des données
35
 			// Pareil ici, utiliser une fonction qui vérifie la validité des données
36
 			if (response != null) {
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
 				const payload = {
41
 				const payload = {
39
 					type: "user",
42
 					type: "user",
40
 					id: jwt_decode(response.data.token).user_id,
43
 					id: jwt_decode(response.data.token).user_id,

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

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

Loading…
Cancel
Save