Changeset 462 for trunk/services


Ignore:
Timestamp:
Feb 7, 2014 7:17:49 PM (10 years ago)
Author:
anonymous
Message:

Added 'Remember me' checkbox to login form. Renamed 'persistent' key to 'saved' in Prefs.inc.php.

Location:
trunk/services
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/services/login.php

    r396 r462  
    44 * For details visit the project site: <http://trac.strangecode.com/codebase/>
    55 * Copyright 2001-2012 Strangecode, LLC
    6  * 
     6 *
    77 * This file is part of The Strangecode Codebase.
    88 *
     
    1111 * Free Software Foundation, either version 3 of the License, or (at your option)
    1212 * any later version.
    13  * 
     13 *
    1414 * The Strangecode Codebase is distributed in the hope that it will be useful, but
    1515 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
    1616 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
    1717 * details.
    18  * 
     18 *
    1919 * You should have received a copy of the GNU General Public License along with
    2020 * The Strangecode Codebase. If not, see <http://www.gnu.org/licenses/>.
     
    3232$app->sslOn();
    3333
    34 $frm['username'] = getFormdata('username');
     34require_once 'codebase/lib/Prefs.inc.php';
     35$login_prefs = new Prefs('login');
     36$login_prefs->setDefaults(array('username' => ''));
     37
     38if ('' != $login_prefs->get('username')) {
     39    $frm['remember_me'] = '1';
     40}
     41
     42$frm['username'] = getFormdata('username', $login_prefs->get('username'));
    3543$frm['password'] = getFormdata('password');
    3644
     
    3947
    4048    if ($auth->login($frm['username'], $frm['password'])) {
     49        if (getFormData('remember_me')) {
     50            $login_prefs->set('username', getFormData('username'));
     51        } else {
     52            $login_prefs->set('username', '');
     53        }
    4154        $app->raiseMsg(_("You are now logged in."), MSG_SUCCESS, __FILE__, __LINE__);
    4255        $app->dieBoomerangURL('login');
  • trunk/services/templates/login_form.ihtml

    r421 r462  
    1717        </td>
    1818    </tr>
     19    <tr class="sc-form-row">
     20        <td class="sc-right">&nbsp;</td>
     21        <td>
     22            <label class="sc-label-secondary"><input type="checkbox" name="remember_me" id="remember_me" value="1"<?php frmChecked($frm['remember_me']) ?> /> <?php echo _("Remember my username"); ?></label>
     23        </td>
     24    </tr>
    1925    <tr>
    2026        <td>&nbsp;</td>
     
    2329</table>
    2430</form>
     31<script type="text/javascript" charset="utf-8">
     32/* <![CDATA[ */
     33$(document).ready(function() {
     34    if ($('input[name="username"]').val() != '') {
     35        $('input[name="password"]').focus();
     36    } else {
     37        $('input[name="username"]').focus();
     38    }
     39});
     40/* ]]> */
     41</script>
Note: See TracChangeset for help on using the changeset viewer.