You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

resetpassword.php 1.1KB

123456789101112131415161718192021222324252627
  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') === hash("sha256", $_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. }