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