diff options
Diffstat (limited to 'src/view/password.php')
-rw-r--r-- | src/view/password.php | 155 |
1 files changed, 0 insertions, 155 deletions
diff --git a/src/view/password.php b/src/view/password.php deleted file mode 100644 index 77f8736..0000000 --- a/src/view/password.php +++ /dev/null | |||
@@ -1,155 +0,0 @@ | |||
1 | <?php | ||
2 | // src/view/password.php | ||
3 | // | ||
4 | // ce fichier contient le HTML de deux pages du site: | ||
5 | // - connexion au mode admin | ||
6 | // - changement de mot de passe | ||
7 | // | ||
8 | // rajouter la page "créationn du mot de passe"? | ||
9 | |||
10 | declare(strict_types=1); | ||
11 | |||
12 | // insertion du captcha | ||
13 | $captchaHtml = ''; | ||
14 | if(isset($captcha)) // instance de Captcha? | ||
15 | { | ||
16 | ob_start(); | ||
17 | ?> | ||
18 | <p>Montrez que vous n'êtes pas un robot.<br> | ||
19 | <label for="captcha" >Combien font <?= $captcha->getA() ?> fois <?= $captcha->getB() ?>?</label> | ||
20 | <input required type="text" id="captcha" name="captcha" autocomplete="off" size="1"> | ||
21 | </p> | ||
22 | <?php | ||
23 | $captchaHtml = ob_get_clean(); | ||
24 | } | ||
25 | |||
26 | |||
27 | // formulaire connexion | ||
28 | $link = new URL(['page' => 'connexion']); | ||
29 | isset($_GET['from']) ? $link->addParams(['from' => $_GET['from']]) : ''; | ||
30 | isset($_GET['id']) ? $link->addParams(['id' => $_GET['id']]) : ''; | ||
31 | ob_start(); | ||
32 | ?> | ||
33 | <form class="connexionFormulaire" method="post" action="<?= $link ?>" > | ||
34 | <p><label for="login" >Identifiant (E-mail):</label> | ||
35 | <input id="login" type="text" name="login" autofocus required></p> | ||
36 | <p><label for="password" >Mot de passe:</label> | ||
37 | <input id="password" type="password" name="password" required></p> | ||
38 | |||
39 | <?= $captchaHtml ?> | ||
40 | |||
41 | <input type="submit" value="Valider"> | ||
42 | </form> | ||
43 | <?php | ||
44 | $formulaireConnexion = ob_get_clean(); | ||
45 | |||
46 | // formulaire création du mot de passe | ||
47 | ob_start(); | ||
48 | ?> | ||
49 | <form class="connexionFormulaire" method="post" action="index.php" > | ||
50 | <p><label for="login" >Identifiant (e-mail):</label> | ||
51 | <input id="login" type="text" name="login" autofocus required></p> | ||
52 | <p><label for="password" >Mot de passe:</label> | ||
53 | <input id="password" type="password" name="password" required></p> | ||
54 | |||
55 | <?= $captchaHtml ?> | ||
56 | |||
57 | <input type="submit" value="Valider"> | ||
58 | </form> | ||
59 | <?php | ||
60 | $formulaireNouveauMDP = ob_get_clean(); | ||
61 | |||
62 | // formulaire changement de mot de passe | ||
63 | $link = new URL(['action' => 'modif_mdp']); | ||
64 | isset($_GET['from']) ? $link->addParams(['from' => $_GET['from']]) : ''; | ||
65 | isset($_GET['id']) ? $link->addParams(['id' => $_GET['id']]) : ''; | ||
66 | ob_start(); | ||
67 | ?> | ||
68 | <form class="connexionFormulaire" method="post" action="<?= $link ?>" > | ||
69 | <label for="login" >Identifiant (e-mail):</label> | ||
70 | <input id="login" type="login" name="login" autofocus required ><br><br> | ||
71 | <label for="old_password" >Ancien mot de passe:</label> | ||
72 | <input id="old_password" type="password" name="old_password" required ><br><br> | ||
73 | <label for="new_password" >Nouveau mot de passe:</label> | ||
74 | <input id="new_password" type="password" name="new_password" required autocomplete="off"> | ||
75 | <input type="hidden" name="modify_password_hidden"> | ||
76 | <br><br> | ||
77 | <input type="submit" value="Valider" > | ||
78 | </form> | ||
79 | <?php | ||
80 | $formulaireModifMDP = ob_get_clean(); | ||
81 | |||
82 | // en-tête | ||
83 | ob_start(); | ||
84 | ?> | ||
85 | <!DOCTYPE html> | ||
86 | |||
87 | <html lang="fr"> | ||
88 | <head> | ||
89 | <meta charset="utf-8"> | ||
90 | <title><?= $title ?></title> | ||
91 | |||
92 | <link rel="icon" type="image/png" href="assets/favicon48x48.png"> | ||
93 | <script src="js/main.js" ></script> | ||
94 | <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
95 | <style> | ||
96 | body{background-color: #E3F3FF;} | ||
97 | #bloc_page{text-align: center;} | ||
98 | .avertissement{color: red;} | ||
99 | </style> | ||
100 | </head> | ||
101 | |||
102 | <body> | ||
103 | <div id="bloc_page" > | ||
104 | <h2 class="connexionTitre" ><?= $title ?></h2> | ||
105 | <p class="connexionP" ><?= $subHeading ?></p> | ||
106 | <?php | ||
107 | $header = ob_get_clean(); | ||
108 | |||
109 | |||
110 | $error_messages = [ | ||
111 | 'error_non_valid_captcha' => '<p class="avertissement" >Erreur au test anti-robot, veuillez saisir un nombre entier.</p>', | ||
112 | 'bad_solution_captcha' => '<p class="avertissement" >Erreur au test anti-robot, veuillez réessayer.</p>', | ||
113 | 'bad_login_or_password' => '<p class="avertissement" >Mauvais identifiant ou mot de passe, veuillez réessayer.</p>', // ne pas indiquer où est l'erreur | ||
114 | 'forbidden_characters' => '<p class="avertissement" >Caractères interdits: espaces, tabulations, sauts CR/LF.</p>' | ||
115 | ]; | ||
116 | |||
117 | $warning_messages = [ | ||
118 | 'message_disconnect' => "<p class='connexionP' ><i>N'oubliez de cliquer sur 'déconnexion' quand vous aurez fini.</i></p>", | ||
119 | //'message_cookie' => "<p class='connexionP' style='color: red;'>Ce site utilise un cookie « obligatoire » lorsque vous êtes connecté ainsi que sur cette page.<br>Il sera supprimé à votre déconnexion ou dès que vous aurez quitté le site.</p>", | ||
120 | 'private_browsing' =>"<p class='connexionP' >Au fait? Vous n'utilisez pas votre propre ordinateur ou téléphone?<br/> | ||
121 | Utilisez la navigation privée.</p>" | ||
122 | ]; | ||
123 | |||
124 | |||
125 | // confirmation modification du mot de passe | ||
126 | $page = isset($_GET['from']) ? $_GET['from'] : 'accueil'; | ||
127 | $id = isset($_GET['id']) ? ', \'' . $_GET['id'] . '\'' : ''; | ||
128 | $js = "newPassword('" . $page . "'" . $id . ");"; | ||
129 | ob_start(); | ||
130 | ?> | ||
131 | <script><?= $js ?></script> | ||
132 | <noscript> | ||
133 | <p class="avertissement" >Le mot de passe a été modifié<br> | ||
134 | <a href="<?= $link ?>" ><button>Retour au site.</button></a></p> | ||
135 | </noscript> | ||
136 | <?php | ||
137 | $alertJSNewPassword = ob_get_clean(); | ||
138 | |||
139 | |||
140 | // bas de la page | ||
141 | $link = new URL(); | ||
142 | isset($_GET['from']) ? $link->addParams(['page' => $_GET['from'] ]) : ''; | ||
143 | isset($_GET['id']) ? $link->addParams(['id' => $_GET['id']]) : ''; | ||
144 | ob_start(); | ||
145 | if(isset($_GET['from'])) // exclue la "création du mot de passe" | ||
146 | { | ||
147 | ?> | ||
148 | <p class="connexionP connexionFooter" > | ||
149 | <a href="<?= $link ?>" > | ||
150 | <button>Retour au site.</button> | ||
151 | </a> | ||
152 | </p> | ||
153 | <?php | ||
154 | } | ||
155 | $footer = ob_get_clean(); \ No newline at end of file | ||