diff options
author | Nicolas Lœuillet <nicolas@loeuillet.org> | 2013-06-01 08:23:37 +0200 |
---|---|---|
committer | Nicolas Lœuillet <nicolas@loeuillet.org> | 2013-06-01 08:23:37 +0200 |
commit | da368cc84f4d79afc30052a209502fa8fd17241e (patch) | |
tree | 14c551e39ae97dc19b1a6a7fb4343e8ed10f209f | |
parent | aa8c9f2a32ea75278d52c86c6a3a39d34bce5cc7 (diff) | |
download | wallabag-da368cc84f4d79afc30052a209502fa8fd17241e.tar.gz wallabag-da368cc84f4d79afc30052a209502fa8fd17241e.tar.zst wallabag-da368cc84f4d79afc30052a209502fa8fd17241e.zip |
update password in config screen
-rw-r--r-- | index.php | 18 | ||||
-rw-r--r-- | tpl/config.html | 19 |
2 files changed, 32 insertions, 5 deletions
@@ -25,11 +25,6 @@ $ref = empty($_SERVER['HTTP_REFERER']) ? '' : $_SERVER['HTTP_REFERER']; | |||
25 | if (isset($_GET['login'])) { | 25 | if (isset($_GET['login'])) { |
26 | // Login | 26 | // Login |
27 | if (!empty($_POST['login']) && !empty($_POST['password'])) { | 27 | if (!empty($_POST['login']) && !empty($_POST['password'])) { |
28 | // echo $_SESSION['login']."<br>"; | ||
29 | // echo $_SESSION['pass']."<br>"; | ||
30 | // echo $_POST['login']."<br>"; | ||
31 | // echo encode_string($_POST['password'] . $_POST['login']); | ||
32 | // die; | ||
33 | if (Session::login($_SESSION['login'], $_SESSION['pass'], $_POST['login'], encode_string($_POST['password'] . $_POST['login']))) { | 28 | if (Session::login($_SESSION['login'], $_SESSION['pass'], $_POST['login'], encode_string($_POST['password'] . $_POST['login']))) { |
34 | logm('login successful'); | 29 | logm('login successful'); |
35 | $msg->add('s', 'welcome in your poche!'); | 30 | $msg->add('s', 'welcome in your poche!'); |
@@ -55,6 +50,19 @@ elseif (isset($_GET['logout'])) { | |||
55 | Session::logout(); | 50 | Session::logout(); |
56 | MyTool::redirect(); | 51 | MyTool::redirect(); |
57 | } | 52 | } |
53 | elseif (isset($_GET['config'])) { | ||
54 | if (isset($_POST['password']) && isset($_POST['password_repeat'])) { | ||
55 | if ($_POST['password'] == $_POST['password_repeat'] && $_POST['password'] != "") { | ||
56 | logm('password updated'); | ||
57 | $store->updatePassword(encode_string($_POST['password'] . $_SESSION['login'])); | ||
58 | $msg->add('s', 'your password has been updated'); | ||
59 | } | ||
60 | else | ||
61 | $msg->add('e', 'your password can\'t be empty and you have to repeat it in the second field'); | ||
62 | } | ||
63 | else | ||
64 | $msg->add('e', 'error in your password update'); | ||
65 | } | ||
58 | 66 | ||
59 | # Traitement des paramètres et déclenchement des actions | 67 | # Traitement des paramètres et déclenchement des actions |
60 | $view = (isset ($_REQUEST['view'])) ? htmlentities($_REQUEST['view']) : 'index'; | 68 | $view = (isset ($_REQUEST['view'])) ? htmlentities($_REQUEST['view']) : 'index'; |
diff --git a/tpl/config.html b/tpl/config.html index 7d1c6afe..1100d455 100644 --- a/tpl/config.html +++ b/tpl/config.html | |||
@@ -3,6 +3,25 @@ | |||
3 | <p>Thanks to the bookmarklet, you will be able to easily add a link to your poche. If you don't know how use a bookmarklet, <a href="http://support.mozilla.org/en-US/kb/bookmarklets-perform-common-web-page-tasks">have a look here</a>.</p> | 3 | <p>Thanks to the bookmarklet, you will be able to easily add a link to your poche. If you don't know how use a bookmarklet, <a href="http://support.mozilla.org/en-US/kb/bookmarklets-perform-common-web-page-tasks">have a look here</a>.</p> |
4 | <p>Drag & drop this link to your bookmarks bar and have fun with poche.</p> | 4 | <p>Drag & drop this link to your bookmarks bar and have fun with poche.</p> |
5 | <p><a style="cursor: move; border: 1px dashed grey; background: white;" title="i am a bookmarklet, use me !" href="javascript:(function(){var%20url%20=%20location.href%20||%20url;window.open('{$poche_url}?action=add&url='%20+%20encodeURIComponent(url),'_self');})();">poche it !</a></p> | 5 | <p><a style="cursor: move; border: 1px dashed grey; background: white;" title="i am a bookmarklet, use me !" href="javascript:(function(){var%20url%20=%20location.href%20||%20url;window.open('{$poche_url}?action=add&url='%20+%20encodeURIComponent(url),'_self');})();">poche it !</a></p> |
6 | |||
7 | <h2>Password</h2> | ||
8 | <form method="post" action="?config" name="loginform"> | ||
9 | <fieldset class="w500p"> | ||
10 | <div class="row"> | ||
11 | <label class="col w150p" for="password">New password</label> | ||
12 | <input class="col" type="password" id="password" name="password" placeholder="Password" tabindex="2"> | ||
13 | </div> | ||
14 | <div class="row"> | ||
15 | <label class="col w150p" for="password_repeat">Repeat your new password</label> | ||
16 | <input class="col" type="password" id="password_repeat" name="password_repeat" placeholder="Password" tabindex="3"> | ||
17 | </div> | ||
18 | <div class="row mts txtcenter"> | ||
19 | <button class="bouton" type="submit" tabindex="4">Update</button> | ||
20 | </div> | ||
21 | </fieldset> | ||
22 | <input type="hidden" name="returnurl" value="<?php echo htmlspecialchars($referer);?>"> | ||
23 | <input type="hidden" name="token" value="<?php echo Session::getToken(); ?>"> | ||
24 | </form> | ||
6 | <h2>Export</h2> | 25 | <h2>Export</h2> |
7 | <p><a href="?view=export" target="_blank">Click here</a> to export your poche datas.</p> | 26 | <p><a href="?view=export" target="_blank">Click here</a> to export your poche datas.</p> |
8 | </div> \ No newline at end of file | 27 | </div> \ No newline at end of file |