]> git.wh0rd.org Git - tt-rss.git/commitdiff
reimplement remember_me
authorAndrew Dolgov <fox@fakecake.org>
Thu, 28 Mar 2013 05:48:58 +0000 (09:48 +0400)
committerAndrew Dolgov <fox@fakecake.org>
Thu, 28 Mar 2013 05:48:58 +0000 (09:48 +0400)
classes/handler/public.php
config.php-dist
include/login_form.php
include/sessions.php

index 798e96343ceb98e441c19d8ab4ab4f3c40854b95..84d6aa18ee368534828880212c8a8894c5790919 100644 (file)
@@ -500,6 +500,12 @@ class Handler_Public extends Handler {
                        $password = $_POST["password"];
                        $remember_me = $_POST["remember_me"];
 
+                       if ($remember_me) {
+                               session_set_cookie_params(SESSION_COOKIE_LIFETIME);
+                       } else {
+                               session_set_cookie_params(0);
+                       }
+
                        @session_start();
 
                        if (authenticate_user($this->link, $login, $password)) {
index 192cb15f923139ab6722f3d8f33bac2382670ee8..3e67a24871915c14bd9a03b3339f58a56ae9ad3d 100644 (file)
        // Default lifetime of a session (e.g. login) cookie. In seconds, 
        // 0 means cookie will be deleted when browser closes.
        // Setting this to zero will affect several user preferences
-       // like widescreen mode not saving.
+       // like widescreen mode not saving and disable "remember me".
 
        define('SESSION_EXPIRE_TIME', 86400*30);
        // Hard expiration limit for sessions. Should be
index af451239d7e42510eb8780f3176adc4e7a9e077b..4fc08261abb58d068afac7c31d8e3e915c76316f 100644 (file)
@@ -221,6 +221,16 @@ function bwLimitChange(elem) {
                        <label style='display : inline' for="bw_limit"><?php echo __("Use less traffic") ?></label>
                </div>
 
+               <?php if (SESSION_COOKIE_LIFETIME > 0) { ?>
+
+               <div class="row">
+                       <label>&nbsp;</label>
+                       <input dojoType="dijit.form.CheckBox" name="remember_me" id="remember_me" type="checkbox">
+                       <label style='display : inline' for="remember_me"><?php echo __("Remember me") ?></label>
+               </div>
+
+               <?php } ?>
+
                <div class="row" style='text-align : right'>
                        <button dojoType="dijit.form.Button" type="submit"><?php echo __('Log in') ?></button>
                        <?php if (defined('ENABLE_REGISTRATION') && ENABLE_REGISTRATION) { ?>
index acb2fc38df78f1f7609d23f48eacd79c6f2dd48b..7ea319e36d635b32f577fc265b7f2dbb02c93fca 100644 (file)
                        "ttrss_destroy", "ttrss_gc");
        }
 
-       session_set_cookie_params(SESSION_COOKIE_LIFETIME);
-
        if (!defined('TTRSS_SESSION_NAME') || TTRSS_SESSION_NAME != 'ttrss_api_sid') {
                if ($_COOKIE[$session_name]) {
                        @session_start();