Adding the login form to the top of every page.

Discussion forum for MOD Writers regarding MOD Development.
Locked
LoseTheGame
Registered User
Posts: 7
Joined: Thu Aug 26, 2010 3:46 am

Adding the login form to the top of every page.

Post by LoseTheGame »

Hi guys,

I've modified overall_header to have a login form at the top of every page when not logged in (like Facebook for example). I stripped down the code on login_body to...

Code: Select all

<form action="{S_LOGIN_ACTION}" method="post">
          username<input class="post" type="text" name="{USERNAME_CREDENTIAL}" size="25" value="{USERNAME}" tabindex="1" />
		  password:<input class="post" type="password" name="{PASSWORD_CREDENTIAL}" size="25" tabindex="2" />
<input type="submit" name="login" class="btnmain" value="{L_LOGIN}" tabindex="5" />
</form>
...and added it to to the title table in overall_header.

When I try to use this new form to log in, from any page other than the mode=login page, it redirects me to the mode=login page and says "You cannot login without a password."

If I use this new login form at the top of the mode=login page, then it works. So I'm guessing there is something else I have to copy over from login_body to make the new form work from any page.

Any ideas? Let me know if I haven't explained my situation well enough.

Thanks.
User avatar
Marc
Development Team Leader
Development Team Leader
Posts: 5457
Joined: Tue Oct 30, 2007 10:57 pm
Location: Munich, Germany
Name: Marc
Contact:

Re: Adding the login form to the top of every page.

Post by Marc »

I think {USERNAME_CREDENTIAL} and {PASSWORD_CREDENTIAL} will be undefined on the other pages.
Try if that works better for you:

Code: Select all

	<form method="post" action="{S_LOGIN_ACTION}" class="headerspace">
	<h3><a href="{U_LOGIN_LOGOUT}">{L_LOGIN_LOGOUT}</a></h3>
		<fieldset class="quick-login">
			<label for="username">{L_USERNAME}:</label>&nbsp;<input type="text" name="username" id="username" size="10" class="inputbox" title="{L_USERNAME}" />
			<label for="password">{L_PASSWORD}:</label>&nbsp;<input type="password" name="password" id="password" size="10" class="inputbox" title="{L_PASSWORD}" />
			<!-- IF S_AUTOLOGIN_ENABLED -->
				| <label for="autologin">{L_LOG_ME_IN} <input type="checkbox" name="autologin" id="autologin" /></label>
			<!-- ENDIF -->
			<input type="submit" name="login" value="{L_LOGIN}" class="button2" />
			{S_LOGIN_REDIRECT}
		</fieldset>
	</form>
edit:
For subsilver2-based styles use this:

Code: Select all

<form action="{S_LOGIN_ACTION}" method="post">
          username<input class="post" type="text" name="username" size="25" value="{USERNAME}" tabindex="1" />
		  password:<input class="post" type="password" name="password" size="25" tabindex="2" />
<input type="submit" name="login" class="btnmain" value="{L_LOGIN}" tabindex="5" />
{S_FORM_TOKEN}
{S_LOGIN_REDIRECT}
</form>
Drummer
Registered User
Posts: 199
Joined: Wed Jul 21, 2010 11:49 am

Re: Adding the login form to the top of every page.

Post by Drummer »

LoseTheGame
Registered User
Posts: 7
Joined: Thu Aug 26, 2010 3:46 am

Re: Adding the login form to the top of every page.

Post by LoseTheGame »

Awesome guys :) I just changed the name of each field to "username" and "password" like you suggested and it's working fine.

Thanks for the help.
Locked

Return to “[3.0.x] MOD Writers Discussion”