complete_phone_number.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. /* For licensing terms, see /license.txt */
  3. require_once __DIR__.'/../../inc/global.inc.php';
  4. $url = api_get_path(WEB_PATH).'main/auth/conditional_login/complete_phone_number.php';
  5. if (!isset($_SESSION['conditional_login']['uid'])) {
  6. die("Not Authorised");
  7. }
  8. ?>
  9. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  10. <html lang="fr" xml:lang="fr" xmlns="http://www.w3.org/1999/xhtml">
  11. <head>
  12. <meta content="text/html; charset=UTF-8" http-equiv="Content-Type">
  13. </head>
  14. <body>
  15. <form id="data_completion" name="data_completion" method="post" action="<?php echo $url; ?>">
  16. Téléphone : <input type="text" name="phone_number" />
  17. <input type="submit" name="submit" value="Submit" />
  18. </form>
  19. </body>
  20. </html>
  21. <?php
  22. if (isset($_POST['submit'])) {
  23. $u = api_get_user_info($_SESSION['conditional_login']['uid']);
  24. $u['phone'] = $_POST['phone_number'];
  25. $password = null; // we don't want to change the password
  26. $updated = UserManager::update_user(
  27. $u['user_id'],
  28. $u['firstname'],
  29. $u['lastname'],
  30. $u['username'],
  31. $password,
  32. $u['auth_source'],
  33. $u['email'],
  34. $u['status'],
  35. $u['official_code'],
  36. $u['phone'],
  37. $u['picture_uri'],
  38. $u['expiration_date'],
  39. $u['active'],
  40. $u['creator_id'],
  41. $u['hr_dept_id'],
  42. $u['extra'],
  43. $u['language'],
  44. ''
  45. );
  46. if ($updated) {
  47. ConditionalLogin::login();
  48. }
  49. }