resetpassword.php 1.1 KB

12345678910111213141516171819202122232425262728
  1. <?php
  2. /**
  3. * Copyright (c) 2012 Frank Karlitschek frank@owncloud.org
  4. * This file is licensed under the Affero General Public License version 3 or
  5. * later.
  6. * See the COPYING-README file.
  7. */
  8. $RUNTIME_NOAPPS = TRUE; //no apps
  9. require_once('../../lib/base.php');
  10. // Someone wants to reset their password:
  11. if(isset($_GET['token']) && isset($_GET['user']) && OC_Preferences::getValue($_GET['user'], 'owncloud', 'lostpassword') === $_GET['token']) {
  12. if (isset($_POST['password'])) {
  13. if (OC_User::setPassword($_GET['user'], $_POST['password'])) {
  14. OC_Preferences::deleteKey($_GET['user'], 'owncloud', 'lostpassword');
  15. OC_Template::printGuestPage('core/lostpassword', 'resetpassword', array('success' => true));
  16. } else {
  17. OC_Template::printGuestPage('core/lostpassword', 'resetpassword', array('success' => false));
  18. }
  19. } else {
  20. OC_Template::printGuestPage('core/lostpassword', 'resetpassword', array('success' => false));
  21. }
  22. } else {
  23. // Someone lost their password
  24. OC_Template::printGuestPage('core/lostpassword', 'lostpassword', array('error' => false, 'requested' => false));
  25. }