Results 1 to 9 of 9

Thread: "Remember Me" checkbox

  1. #1
    New user
    Join Date
    02-06-10.
    Posts
    8

    Default "Remember Me" checkbox

    Is it possible to have some remember me checkbox?

    I found an extension that is called "recall", but I don't like how it works, and it's system.
    So, is there a possibility to have a checkbox like that? People check it BEFORE login, and can select it each time after they logout, whether they want to change their remember me status, or not.

    As I understand, TL uses sessions in stead of cookies?

    Thanks in advance

  2. #2
    New user
    Join Date
    02-06-10.
    Posts
    8

    Default Re: "Remember Me" checkbox

    If there is no existing extension, then I'd like some help making one, what files and modules should I call to login?

  3. #3
    Experienced user
    Join Date
    06-10-09.
    Location
    Atlanta, Georgia
    Posts
    611

    Default Re: "Remember Me" checkbox

    Dima - the Recall extension is the only thing I know of to keep people logged in. You may want to contact Acenes to see if he will add your feature request.

  4. #4
    New user
    Join Date
    02-06-10.
    Posts
    8

    Default Re: "Remember Me" checkbox

    Meanwhile I solved it.

    For people that are intrested in how I did it:

    1) Install recall extension

    2) Comment everything in DCA of recall(as we don't need these options)

    3) Add to modules/frontend/languages/??/default.php
    Code:
    $GLOBALS['TL_LANG']['MSC']['remember'] = 'Remember Me';
    4) Change your mod_login template (in my case mod_login_1cl.tpl). I added:
    Code:
    <input type="checkbox" name="remember" id="remember" /><?php echo $this->remember; ?>
    5) Edit modules/frontend/ModuleLogin.php and add AFTER line 257
    Code:
    $this->Template->password = $GLOBALS['TL_LANG']['MSC']['password'][0];
    this:
    Code:
    $this->Template->remember = $GLOBALS['TL_LANG']['MSC']['remember'];
    And add after line 74-75
    Code:
    if ($this->Input->post('FORM_SUBMIT') == 'tl_login')
    {
    this:
    Code:
    //Check: remember me?
    if ($this->Input->post('remember')){
    $_SESSION['remember'] = "1";
    }
    else{
    $_SESSION['remember'] = "0";
    }
    6) Change Line 98 in modules/recall/Recall.php from
    Code:
    if (intval($user->recall)) {
    to
    Code:
    if ($_SESSION['remember'] == "1") {
    And it works! Yes, this is hard coding, and I'm messing up main files, but if there are any tips to not mess up the main files, they are for sure very very very welcome!
    What should you do for example, to use another file to add something to ModuleLogin.php? Or is it impossible?

  5. #5
    Experienced user
    Join Date
    06-20-09.
    Posts
    1,311

    Default Re: "Remember Me" checkbox

    It sounds like it would make a great extension...
    you need to read this to answer most of your questions:
    http://www.typolight.org/developers-guide.html. It'll tell you how to write code that doesn't interfere with other code.
    Probably you'd start with the recall extension, modify it as needed, add your stuff in, name it "remember me" and publish it in the extension repository.
    Cheers, murray

  6. #6

    Default Re: "Remember Me" checkbox

    You can achive this whithout hacking all over the recall extension.

    - Make DCA modifications in dcaconfig.php. But basically there is no need, just dont publish the recall field in the menber settings module.
    - Instead of hacking all over the other code, set database field tl_member.recall = '1' in the form processing when the checkbox was set
    Extensions: avatar, cron, dlstats, editarea, geshi, helpdesk, recall, rep_*, smhcheck.
    FAQ's - Documents - Tickets
    Please no help requests by PM, use the forum or ticket link above instead!

  7. #7
    New user
    Join Date
    02-06-10.
    Posts
    8

    Default Re: "Remember Me" checkbox

    Quote Originally Posted by ramjet
    It sounds like it would make a great extension...
    you need to read this to answer most of your questions:
    http://www.typolight.org/developers-guide.html. It'll tell you how to write code that doesn't interfere with other code.
    Probably you'd start with the recall extension, modify it as needed, add your stuff in, name it "remember me" and publish it in the extension repository.
    Cheers, murray
    Thanks, I'll do it when I have some more time, because this site that I run now is just a hobby, but I still have work to do. But soon I'll upgrade to Typoolight 2.8.1 (I run TL 2.7.6 now) and I'll change all my changes into extensions. "remember me" will be one of them.

    Quote Originally Posted by acenes
    - Instead of hacking all over the other code, set database field tl_member.recall = '1' in the form processing when the checkbox was set
    No, this is just it. I didn't like that you set the database field, for one simple reason: what if the person when he logs out, doesn't want to autologin next time, then he has to go to his profile editing page.
    This checkbox decides time by time when he wants to be remembered.

    And one of the most important things: what if he's at an internet-cafe, then he's beeing automaticly remembered, because he wants to be remembered at home!

    But I'll look at the dev-guide, try to find out to edit all these things without code hacking. And btw: is it also possible to soft-add fields in templates?

  8. #8

    Default Re: "Remember Me" checkbox

    Quote Originally Posted by Dima_2005
    No, this is just it. I didn't like that you set the database field, for one simple reason: what if the person when he logs out, doesn't want to autologin next time, then he has to go to his profile editing page.
    ...
    And one of the most important things: what if he's at an internet-cafe, then he's beeing automaticly remembered, because he wants to be remembered at home!
    You are making false assumptions, thats not the way it works and you obviously did not try it out.

    - When logging out, the cookie is cleared and you wont be logged in automatically next time.
    No need to go in the member settings here.

    - Internet cafe and home pc's are different machines, so the cookies at home wont work
    for the internet cafe and vice versa.

    Of course you can also set the field to '0' on login and logout. Check out the typolight hooks.

    Quote Originally Posted by Dima_2005
    but I don't like how it works, and it's system.
    I dont like your solution. Why should everybody have to check that stupid checkbox every time when logging in. :roll:
    Extensions: avatar, cron, dlstats, editarea, geshi, helpdesk, recall, rep_*, smhcheck.
    FAQ's - Documents - Tickets
    Please no help requests by PM, use the forum or ticket link above instead!

  9. #9
    New user
    Join Date
    02-06-10.
    Posts
    8

    Default Re: "Remember Me" checkbox

    Quote Originally Posted by acenes
    I dont like your solution. Why should everybody have to check that stupid checkbox every time when logging in. :roll:
    Ok, that's true, I didn't understand it, but almost every site works with a checkbox, that's why I want to have a checkbox. My public for the site, mostly is scared of the web, so making them stuff difficult is just not fun

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •