MyBB Community Forums

Full Version: Force password remember upon login
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
So I've made my own welcome block menus

I have a visible login box as opposed to the please click here to login or whatever. And i did have a checkbox, but i wanted to hide it and just have the login button.

I did this:

<div class="welcomemenu" style="padding-top: 0px; padding-right: 4px"><span style="float: right; padding-right: 4px;">{$lang->welcome_current_time}
</span>
<form action="member.php" method="post" style="padding-left: 5px; padding-top:0 px">
<input type="text" class="logintextbox" name="username" size="12" value="{$username}" />
<input type="password" class="logintextbox" name="password" size="12" value="{$password}" />
<input type="submit" class="loginbutton" name="submit" value="{$lang->login}" />
<input type="hidden" name="action" value="do_login" />
<input type="checkbox" class="checkbox" style="display:none;" value="{$lang->remember_me}" name="remember" checked="checked" value="yes" />
<a>&mdash;</a>
<a href="{$mybb->settings['bburl']}/member.php?action=lostpw">{$lang->lost_password}</a>
<a>&mdash;</a>
<a href="{$mybb->settings['bburl']}/member.php?action=register">{$lang->welcome_register}</a></div>
</form>

However once I close the browser it does not keep the cookie and therefore logs out Sad Doesn't stay logged in which means that checkbox is not really doing it's job... even though I did the checked=checked

WOW!! 1800 views on this thread and not a single response lol

8000 views and no one seriously Sad Bump

Wow support sucked.. well turns out i copied someone else's code trying to do the same thing so i altered it to mine, then realized i realized comparing the two the 'value' was mentioned twice and pointing to no where in my original code should have just had one value as yes.

Here is the revised code based on what i copied elsewhere:

<div class="welcomemenu" style="padding-top: 0px; padding-right: 4px"><span style="float: right; padding-right: 4px;">{$lang->welcome_current_time}
</span>

<form action="member.php" method="post" style="padding-left: 5px; padding-top:0 px">
<input type="hidden" name="action" value="do_login" />
<span class="smalltext"><strong>{$lang->quick_login}</strong></span>

<input type="text" class="logintextbox" name="username" title="{$login_username}" value="{$lang->login_username}" onfocus="if(this.value == '{$lang->login_username}') { this.value=''; }" onblur="if(this.value=='') { this.value='{$lang->login_username}'; }"/>

<input type="password" class="logintextbox" name="password" title="{$lang->login_password}" value="{$lang->login_password}" onfocus="if(this.value == '{$lang->login_password}') { this.value=''; }" onblur="if(this.value=='') { this.value='{$lang->login_password}'; }"/>

<input type="submit" class="loginbutton" name="submit" value="Login"/>

<label for="remember">
<input type="checkbox" name="remember" id="remember" value="yes" checked="checked" style="display:none;"/></label>

<a href="{$mybb->settings['bburl']}/member.php?action=lostpw">{$lang->lost_password}</a>

<a>&mdash;</a>

<a href="{$mybb->settings['bburl']}/member.php?action=register">{$lang->welcome_register}</a>
</form>

Solved by myself again... slow support/responses on this forum even for something simple Sad