| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- <?php
- if(core::ifGet("add")) {
- $id_form = '<input type="hidden" name="id" value="add">';
- $submit = "Ajouter un profil";
- $titre = "Ajouter un profil";
- } else {
-
- if(core::ifGet("id") == FALSE OR (core::ifGet("id") AND session::getId() == core::getGet("id"))){
- $user = user::getUserById(session::getId());
- $submit = "Modifier votre profil";
- $titre = "Votre fiche de profil";
- $protect = 1;
- } else {
- $user = user::getUserById(core::getGet("id"));
- $submit = "Modifier ce profil";
- $titre = "Fiche de " . $user["prenom"] . " " . $user["nom"];
- $protect = 0;
- }
- $id_form = '<input type="hidden" name="id" value="' . $user["id"] . '">';
- }
- ?>
- <header class="d-flex flex-column flex-md-row align-items-md-center p-3 bg-light row">
- <div class="col-11">
- <h2 class="bd-title" id="content">
- <span><?php echo $titre ?></span>
- </h2>
- <?php if(isset($user["id"]) AND session::getId() != $user["id"]){ ?>
- <div style="float:right; margin: -30px;">
- <a href="/submit.php?from=user-delete&id=<?php echo $user["id"] ?>" onclick="return confirm('Voulez-vous supprimer le compte de <?php echo $user["prenom"] . " " . $user["nom"]; ?> ?')" style="position: absolute; right: 0; margin: 0 40px 0 0;"><button type="submit" class="btn btn-outline-danger btn-sm"><span data-feather="trash-2"></span> Supprimer</button></a>
- </div>
- <?php } ?>
- <?php if(isset($user["last_connect"])){ echo '<h6>Dernière connexion : ' . $user["last_connect"] .'</h6>'; } ?>
- </div>
- </header>
- <br />
- <form method="post" action="/submit.php" oninput='password2.setCustomValidity(password2.value != password.value ? "Les mots de passe ne sont pas identiques" : "")'>
- <input type="hidden" name="from" value="user">
-
- <?php
- echo $id_form;
- ?>
-
- <div class="form-group">
- <label>Type de compte</label>
- <?php if($protect == 0): ?>
- <select name="id_type" class="form-select">
- <option value="2"<?php if(isset($user["id_type"]) AND $user["id_type"] == 2){ echo " selected"; } ?>>Contrôleur QRCode (émargement)</option>
- <option value="3"<?php if(isset($user["id_type"]) AND $user["id_type"] == 3){ echo " selected"; } ?>>Assitance sociale</option>
- <option value="1"<?php if(isset($user["id_type"]) AND $user["id_type"] == 1){ echo " selected"; } ?>>Administrateur</option>
- </select>
- <?php endif; ?>
- <?php if($protect == 1): ?>
- <input type="text" class="form-control" value="<?php
- if($user["id_type"] == 1){ echo "Administrateur"; }
- elseif($user["id_type"] == 2){ echo "Contrôleur QRCode (émargement)"; }
- elseif($user["id_type"] == 3){ echo "Assitance sociale"; }
- ?>" readonly="readonly" />
- <input type="hidden" name="id_type" value="<?php echo $user["id_type"] ?>">
- <?php endif; ?>
- </div>
- <br />
- <div class="form-group">
- <label>Prénom</label>
- <input type="text" class="form-control" value="<?php
- if (isset($user["prenom"])) {
- echo $user["prenom"];
- }
- ?>" name="prenom" placeholder="" required>
- </div>
- <br />
-
- <div class="form-group">
- <label>nom</label>
- <input type="text" class="form-control" value="<?php
- if (isset($user["nom"])) {
- echo $user["nom"];
- }
- ?>" name="nom" placeholder="" required>
- </div>
- <br />
-
- <div class="form-group">
- <label>Email</label>
- <input type="email" class="form-control" value="<?php
- if (isset($user["email"])) {
- echo $user["email"];
- }
- ?>" name="email" placeholder="" required>
- </div>
- <br />
-
- <div class="form-group">
- <label>Mot de passe</label>
- <input type="password" class="form-control" minlength="8" maxlength="25" value="" name="password" placeholder="" <?php if(core::ifGet("add")){ echo "required"; } ?>>
- </div>
- <br />
-
- <div class="form-group">
- <label>Confirmation du mot de passe</label>
- <input type="password" class="form-control" value="" name="password2" placeholder="" <?php if(core::ifGet("add")){ echo "required"; } ?>>
- </div>
- <br />
- <div class="form-group">
- <label>Google Authenticator</label>
- <select name="googleAuthenticator" class="form-select">
- <option value="0"<?php if(isset($user["googleAuthenticator"]) AND $user["googleAuthenticator"] == 0){ echo " selected"; } ?>>Désactivée</option>
- <option value="1"<?php if(isset($user["googleAuthenticator"]) AND $user["googleAuthenticator"] == 1){ echo " selected"; } ?>>Activée</option>
- </select>
- </div>
- <br />
- <?php if(isset($user["googleAuthenticator"]) AND $user["googleAuthenticator"] == 1 AND $protect == 1) { ?>
- <div class="card text-center" style="width: 18rem;">
- <?php
- $qrCodeUrl = googleAuthenticator::getGoogleUrl("CMS CSE Invent: " . ENVIRONNEMENT, user::getMyGoogleAuthenticator(session::getId()));
- myQrcode::printQRCode($qrCodeUrl);
- ?>
- <div class="card-footer text-body-secondary">
- QRCode à scanner dans votre application Google Authenticator<br />
- <a href="https://play.google.com/store/apps/details?id=com.google.android.apps.authenticator2" target="_blank">android</a> <a href="https://apps.apple.com/fr/app/google-authenticator/id388497605" target="_blank">iOS</a>
- </div>
- </div>
- <br />
- <?php } ?>
- <?php if($protect == 0): ?>
- <div class="form-group">
- <label>Etat du compte</label>
- <select name="actif" class="form-select">
- <option value="0"<?php if(isset($user["actif"]) AND $user["actif"] == 0){ echo " selected"; } ?>>Compte désactivé</option>
- <option value="1"<?php if(isset($user["actif"]) AND $user["actif"] == 1){ echo " selected"; } ?>>Compte activé</option>
- </select>
- </div>
- <br />
- <?php endif; ?>
- <?php if($protect == 1): ?>
- <input type="hidden" name="actif" value="<?php echo $user["actif"] ?>">
- <?php endif; ?>
-
- <input class="btn btn-primary btn-lg" style="width: 100%" type="submit" value="<?php echo $submit ?>">
- <br />
- <br />
-
- </form>
|