added xsl login form, fixed register action

git-svn-id: http://yolanda.mister-muffin.de/svn@49 7eef14d0-6ed0-489d-bf55-20463b2d70db
This commit is contained in:
josch 2007-10-12 00:44:24 +00:00
parent 6933085e94
commit 1437a10178
3 changed files with 37 additions and 9 deletions

View file

@ -1,5 +1,6 @@
#!/usr/bin/perl #!/usr/bin/perl
require "include.pl"; require "include.pl";
require "functions.pl";
#initialize session data #initialize session data
CGI::Session->name($session_name); CGI::Session->name($session_name);
@ -65,12 +66,15 @@ if($query->param('action'))
} }
else else
{ {
#print login form #if not, print login form
print $session->header();
print '<form action="" method="POST"><p> $page = XMLin("$gnutube_root/login.xml", ForceArray => 1, KeyAttr => {} );
<input name="action" type="hidden" value="login">
<input name="user" type="text" size="30" maxlength="30"> #if a username is associated with session id, username is nonempty
<input name="pass" type="password" size="30" maxlength="30"> $page->{username} = get_username_from_sid($session->id);
<input type="submit" name="login" value=" login ">
</p></form>'; #print xml http header along with session cookie
print $session->header(-type=>'text/xml');
print XMLout($page, KeyAttr => {}, XMLDecl => $XMLDecl, RootName => 'page');
} }

7
trunk/login.xml Normal file
View file

@ -0,0 +1,7 @@
<page
locale="en-US"
stylesheet="./style/gnutube.css"
username=""
>
<loginform />
</page>

View file

@ -237,7 +237,7 @@
<div class="registerform"> <div class="registerform">
<form action="" method="post"> <form action="register.pl" method="post">
<fieldset> <fieldset>
<input name="user" type="text" size="30" maxlength="30" /> <input name="user" type="text" size="30" maxlength="30" />
<input name="pass" type="password" size="30" maxlength="30" /> <input name="pass" type="password" size="30" maxlength="30" />
@ -249,4 +249,21 @@
</xsl:template> </xsl:template>
<xsl:template match="loginform">
<div class="loginform">
<form action="login.pl" method="POST">
<fieldset>
<input name="action" type="hidden" value="login" />
<input name="user" type="text" size="30" maxlength="30" />
<input name="pass" type="password" size="30" maxlength="30" />
<input type="submit" name="login" value=" login " />
</fieldset>
</form>
</div>
</xsl:template>
</xsl:stylesheet> </xsl:stylesheet>