]> source.dussan.org Git - nextcloud-server.git/commitdiff
Move lostpassword to core dir
authorBart Visscher <bartv@thisnet.nl>
Mon, 3 Oct 2011 18:41:52 +0000 (20:41 +0200)
committerBart Visscher <bartv@thisnet.nl>
Mon, 3 Oct 2011 18:44:01 +0000 (20:44 +0200)
core/lostpassword/index.php [new file with mode: 0644]
core/lostpassword/resetpassword.php [new file with mode: 0644]
core/lostpassword/templates/email.php [new file with mode: 0644]
core/lostpassword/templates/lostpassword.php [new file with mode: 0644]
core/lostpassword/templates/resetpassword.php [new file with mode: 0644]
core/templates/login.php
lostpassword/index.php [deleted file]
lostpassword/resetpassword.php [deleted file]
lostpassword/templates/email.php [deleted file]
lostpassword/templates/lostpassword.php [deleted file]
lostpassword/templates/resetpassword.php [deleted file]

diff --git a/core/lostpassword/index.php b/core/lostpassword/index.php
new file mode 100644 (file)
index 0000000..de0d393
--- /dev/null
@@ -0,0 +1,32 @@
+<?php
+/**
+ * Copyright (c) 2010 Frank Karlitschek karlitschek@kde.org
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+*/
+
+$RUNTIME_NOAPPS = TRUE; //no apps
+require_once('../../lib/base.php');
+
+// Someone lost their password:
+if (isset($_POST['user'])) {
+       if (OC_User::userExists($_POST['user'])) {
+               $token = sha1($_POST['user']+uniqId());
+               OC_Preferences::setValue($_POST['user'], 'owncloud', 'lostpassword', $token);
+               $email = OC_Preferences::getValue($_POST['user'], 'lostpassword', 'email', '');
+               if (!empty($email)) {
+                       $link = OC_Helper::linkTo('core/lostpassword', 'resetpassword.php', null, true).'?user='.$_POST['user'].'&token='.$token;
+                       $tmpl = new OC_Template('core/lostpassword', 'email');
+                       $tmpl->assign('link', $link);
+                       $msg = $tmpl->fetchPage();
+                       $l = new OC_L10N('core');
+                       mail($email, $l->t('Owncloud password reset'), $msg);
+               }
+               OC_Template::printGuestPage('core/lostpassword', 'lostpassword', array('error' => false, 'requested' => true));
+       } else {
+               OC_Template::printGuestPage('core/lostpassword', 'lostpassword', array('error' => true, 'requested' => false));
+       }
+} else {
+       OC_Template::printGuestPage('core/lostpassword', 'lostpassword', array('error' => false, 'requested' => false));
+}
diff --git a/core/lostpassword/resetpassword.php b/core/lostpassword/resetpassword.php
new file mode 100644 (file)
index 0000000..1c78d72
--- /dev/null
@@ -0,0 +1,27 @@
+<?php
+/**
+ * Copyright (c) 2010 Frank Karlitschek karlitschek@kde.org
+ * This file is licensed under the Affero General Public License version 3 or
+ * later.
+ * See the COPYING-README file.
+*/
+
+$RUNTIME_NOAPPS = TRUE; //no apps
+require_once('../../lib/base.php');
+
+// Someone wants to reset their password:
+if(isset($_GET['token']) && isset($_GET['user']) && OC_Preferences::getValue($_GET['user'], 'owncloud', 'lostpassword') === $_GET['token']) {
+       if (isset($_POST['password'])) {
+               if (OC_User::setPassword($_GET['user'], $_POST['password'])) {
+                       OC_Preferences::deleteKey($_GET['user'], 'owncloud', 'lostpassword');
+                       OC_Template::printGuestPage('core/lostpassword', 'resetpassword', array('success' => true));
+               } else {
+                       OC_Template::printGuestPage('core/lostpassword', 'resetpassword', array('success' => false));
+               }
+       } else {
+               OC_Template::printGuestPage('core/lostpassword', 'resetpassword', array('success' => false));
+       }
+} else {
+       // Someone lost their password
+       OC_Template::printGuestPage('core/lostpassword', 'lostpassword', array('error' => false, 'requested' => false));
+}
diff --git a/core/lostpassword/templates/email.php b/core/lostpassword/templates/email.php
new file mode 100644 (file)
index 0000000..d146d8e
--- /dev/null
@@ -0,0 +1 @@
+<?php echo str_replace('{link}', $_['link'], $l->t('Use the following link to reset your password: {link}')) ?>
diff --git a/core/lostpassword/templates/lostpassword.php b/core/lostpassword/templates/lostpassword.php
new file mode 100644 (file)
index 0000000..4b87196
--- /dev/null
@@ -0,0 +1,17 @@
+<form action="index.php" method="post">
+       <fieldset>
+               <?php echo $l->t('You will receive a link to reset your password via Email.'); ?>
+               <?php if ($_['requested']): ?>
+                       <?php echo $l->t('Requested'); ?>
+               <?php else: ?>
+                       <?php if ($_['error']): ?>
+                               <?php echo $l->t('Login failed!'); ?>
+                       <?php endif; ?>
+                       <p class="infield">
+                               <label for="user" class="infield"><?php echo $l->t( 'Username' ); ?></label>
+                               <input type="text" name="user" id="user" value="" autocomplete="off" required autofocus />
+                       </p>
+                       <input type="submit" id="submit" value="<?php echo $l->t('Request reset'); ?>" />
+               <?php endif; ?>
+       </fieldset>
+</form>
diff --git a/core/lostpassword/templates/resetpassword.php b/core/lostpassword/templates/resetpassword.php
new file mode 100644 (file)
index 0000000..56257de
--- /dev/null
@@ -0,0 +1,14 @@
+<form action="<?php echo 'resetpassword.php?'.$_SERVER['QUERY_STRING']; ?>" method="post">
+       <fieldset>
+               <?php if($_['success']): ?>
+                       <h1><?php echo $l->t('Your password was reset'); ?></h1>
+                       <p><a href="<?php echo OC::$WEBROOT ?>/"><?php echo $l->t('To login page'); ?></a></p>
+               <?php else: ?>
+                       <p class="infield">
+                               <label for="password" class="infield"><?php echo $l->t( 'New password' ); ?></label>
+                               <input type="password" name="password" id="password" value="" required />
+                       </p>
+                       <input type="submit" id="submit" value="<?php echo $l->t('Reset password'); ?>" />
+               <?php endif; ?>
+       </fieldset>
+</form>
index 46b44c24d78d18c7b08c841663f2b8be5ee432ee..aff0afac20389dc0a9cbeadcedc2c82df9b637f4 100644 (file)
@@ -1,7 +1,7 @@
 <form action="index.php" method="post">
        <fieldset>
                <?php if($_['error']): ?>
-                       <a href="./lostpassword/"><?php echo $l->t('Lost your password?'); ?></a>
+                       <a href="./core/lostpassword/"><?php echo $l->t('Lost your password?'); ?></a>
                <?php endif; ?>
                <p class="infield">
                        <label for="user" class="infield"><?php echo $l->t( 'Username' ); ?></label>
diff --git a/lostpassword/index.php b/lostpassword/index.php
deleted file mode 100644 (file)
index 6d629a7..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-<?php
-/**
- * Copyright (c) 2010 Frank Karlitschek karlitschek@kde.org
- * This file is licensed under the Affero General Public License version 3 or
- * later.
- * See the COPYING-README file.
-*/
-
-$RUNTIME_NOAPPS = TRUE; //no apps
-require_once('../lib/base.php');
-
-// Someone lost their password:
-if (isset($_POST['user'])) {
-       if (OC_User::userExists($_POST['user'])) {
-               $token = sha1($_POST['user']+uniqId());
-               OC_Preferences::setValue($_POST['user'], 'owncloud', 'lostpassword', $token);
-               $email = OC_Preferences::getValue($_POST['user'], 'lostpassword', 'email', '');
-               if (!empty($email)) {
-                       $link = OC_Helper::linkTo('lostpassword', 'resetpassword.php', null, true).'?user='.$_POST['user'].'&token='.$token;
-                       $tmpl = new OC_Template('lostpassword', 'email');
-                       $tmpl->assign('link', $link);
-                       $msg = $tmpl->fetchPage();
-                       $l = new OC_L10N('core');
-                       mail($email, $l->t('Owncloud password reset'), $msg);
-               }
-               OC_Template::printGuestPage('lostpassword', 'lostpassword', array('error' => false, 'requested' => true));
-       } else {
-               OC_Template::printGuestPage('lostpassword', 'lostpassword', array('error' => true, 'requested' => false));
-       }
-} else {
-       OC_Template::printGuestPage('lostpassword', 'lostpassword', array('error' => false, 'requested' => false));
-}
diff --git a/lostpassword/resetpassword.php b/lostpassword/resetpassword.php
deleted file mode 100644 (file)
index 1a6a74e..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-<?php
-/**
- * Copyright (c) 2010 Frank Karlitschek karlitschek@kde.org
- * This file is licensed under the Affero General Public License version 3 or
- * later.
- * See the COPYING-README file.
-*/
-
-$RUNTIME_NOAPPS = TRUE; //no apps
-require_once('../lib/base.php');
-
-// Someone wants to reset their password:
-if(isset($_GET['token']) && isset($_GET['user']) && OC_Preferences::getValue($_GET['user'], 'owncloud', 'lostpassword') === $_GET['token']) {
-       if (isset($_POST['password'])) {
-               if (OC_User::setPassword($_GET['user'], $_POST['password'])) {
-                       OC_Preferences::deleteKey($_GET['user'], 'owncloud', 'lostpassword');
-                       OC_Template::printGuestPage('lostpassword', 'resetpassword', array('success' => true));
-               } else {
-                       OC_Template::printGuestPage('lostpassword', 'resetpassword', array('success' => false));
-               }
-       } else {
-               OC_Template::printGuestPage('lostpassword', 'resetpassword', array('success' => false));
-       }
-} else {
-       // Someone lost their password
-       OC_Template::printGuestPage('lostpassword', 'lostpassword', array('error' => false, 'requested' => false));
-}
diff --git a/lostpassword/templates/email.php b/lostpassword/templates/email.php
deleted file mode 100644 (file)
index d146d8e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-<?php echo str_replace('{link}', $_['link'], $l->t('Use the following link to reset your password: {link}')) ?>
diff --git a/lostpassword/templates/lostpassword.php b/lostpassword/templates/lostpassword.php
deleted file mode 100644 (file)
index 4b87196..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-<form action="index.php" method="post">
-       <fieldset>
-               <?php echo $l->t('You will receive a link to reset your password via Email.'); ?>
-               <?php if ($_['requested']): ?>
-                       <?php echo $l->t('Requested'); ?>
-               <?php else: ?>
-                       <?php if ($_['error']): ?>
-                               <?php echo $l->t('Login failed!'); ?>
-                       <?php endif; ?>
-                       <p class="infield">
-                               <label for="user" class="infield"><?php echo $l->t( 'Username' ); ?></label>
-                               <input type="text" name="user" id="user" value="" autocomplete="off" required autofocus />
-                       </p>
-                       <input type="submit" id="submit" value="<?php echo $l->t('Request reset'); ?>" />
-               <?php endif; ?>
-       </fieldset>
-</form>
diff --git a/lostpassword/templates/resetpassword.php b/lostpassword/templates/resetpassword.php
deleted file mode 100644 (file)
index 56257de..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-<form action="<?php echo 'resetpassword.php?'.$_SERVER['QUERY_STRING']; ?>" method="post">
-       <fieldset>
-               <?php if($_['success']): ?>
-                       <h1><?php echo $l->t('Your password was reset'); ?></h1>
-                       <p><a href="<?php echo OC::$WEBROOT ?>/"><?php echo $l->t('To login page'); ?></a></p>
-               <?php else: ?>
-                       <p class="infield">
-                               <label for="password" class="infield"><?php echo $l->t( 'New password' ); ?></label>
-                               <input type="password" name="password" id="password" value="" required />
-                       </p>
-                       <input type="submit" id="submit" value="<?php echo $l->t('Reset password'); ?>" />
-               <?php endif; ?>
-       </fieldset>
-</form>