reimplement remember_me

master
Andrew Dolgov 12 years ago
parent 3f0094189c
commit f231f438ba

@ -500,6 +500,12 @@ class Handler_Public extends Handler {
$password = $_POST["password"]; $password = $_POST["password"];
$remember_me = $_POST["remember_me"]; $remember_me = $_POST["remember_me"];
if ($remember_me) {
session_set_cookie_params(SESSION_COOKIE_LIFETIME);
} else {
session_set_cookie_params(0);
}
@session_start(); @session_start();
if (authenticate_user($this->link, $login, $password)) { if (authenticate_user($this->link, $login, $password)) {

@ -129,7 +129,7 @@
// Default lifetime of a session (e.g. login) cookie. In seconds, // Default lifetime of a session (e.g. login) cookie. In seconds,
// 0 means cookie will be deleted when browser closes. // 0 means cookie will be deleted when browser closes.
// Setting this to zero will affect several user preferences // 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); define('SESSION_EXPIRE_TIME', 86400*30);
// Hard expiration limit for sessions. Should be // Hard expiration limit for sessions. Should be

@ -221,6 +221,16 @@ function bwLimitChange(elem) {
<label style='display : inline' for="bw_limit"><?php echo __("Use less traffic") ?></label> <label style='display : inline' for="bw_limit"><?php echo __("Use less traffic") ?></label>
</div> </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'> <div class="row" style='text-align : right'>
<button dojoType="dijit.form.Button" type="submit"><?php echo __('Log in') ?></button> <button dojoType="dijit.form.Button" type="submit"><?php echo __('Log in') ?></button>
<?php if (defined('ENABLE_REGISTRATION') && ENABLE_REGISTRATION) { ?> <?php if (defined('ENABLE_REGISTRATION') && ENABLE_REGISTRATION) { ?>

@ -102,8 +102,6 @@
"ttrss_destroy", "ttrss_gc"); "ttrss_destroy", "ttrss_gc");
} }
session_set_cookie_params(SESSION_COOKIE_LIFETIME);
if (!defined('TTRSS_SESSION_NAME') || TTRSS_SESSION_NAME != 'ttrss_api_sid') { if (!defined('TTRSS_SESSION_NAME') || TTRSS_SESSION_NAME != 'ttrss_api_sid') {
if ($_COOKIE[$session_name]) { if ($_COOKIE[$session_name]) {
@session_start(); @session_start();

Loading…
Cancel
Save