removed action=login

git-svn-id: http://yolanda.mister-muffin.de/svn@267 7eef14d0-6ed0-489d-bf55-20463b2d70db
This commit is contained in:
josch 2008-04-03 13:47:12 +00:00
parent 45d1cf5d7a
commit 861e15f468
4 changed files with 131 additions and 202 deletions

View file

@ -10,7 +10,6 @@
<string id="register">register</string> <string id="register">register</string>
<string id="login">login</string> <string id="login">login</string>
<string id="login_openid">login with OpenID</string>
<string id="header_upload-video">upload video</string> <string id="header_upload-video">upload video</string>
<string id="settings_details">settings details</string> <string id="settings_details">settings details</string>

View file

@ -9,9 +9,6 @@ $session = new CGI::Session;
@page = get_page_array(@userinfo); @page = get_page_array(@userinfo);
#check if action is set
if($query->param('action'))
{
if($query->param('action') eq "logout") if($query->param('action') eq "logout")
{ {
#if logout is requested #if logout is requested
@ -28,11 +25,8 @@ if($query->param('action'))
print output_page(); print output_page();
} }
#if login is requested
elsif($query->param('action') eq "login")
{
#if password is empty and username begins with http:// or ret is specified, then it's an openid login #if password is empty and username begins with http:// or ret is specified, then it's an openid login
if($query->param('pass') eq '' and ($query->param('user')=~m/^http:\/\// or $query->param('ret'))) elsif($query->param('pass') eq '' and ($query->param('user')=~m/^http:\/\// or $query->param('ret')))
{ {
#create our openid consumer object #create our openid consumer object
$con = Net::OpenID::Consumer->new( $con = Net::OpenID::Consumer->new(
@ -104,13 +98,13 @@ if($query->param('action'))
else else
{ {
#if not, print login form #if not, print login form
$page->{'loginform'}->{'action'} = 'openid'; $page->{'loginform'} = [''];
print output_page(); print output_page();
} }
} }
#else it's a normal login #else it's a normal login
else elsif($query->param('pass') ne '' and $query->param('user')!~m/^http:\/\// and $query->param('user') ne '')
{ {
#prepare query - empty password are openid users so omit those entries #prepare query - empty password are openid users so omit those entries
my $sth = $dbh->prepare(qq{select id from users my $sth = $dbh->prepare(qq{select id from users
@ -135,24 +129,6 @@ if($query->param('action'))
print output_page(); print output_page();
} }
} }
}
else
{
#something ugly was passed
$page->{'message'}->{'type'} = "error";
$page->{'message'}->{'text'} = "error_202c";
print output_page();
}
}
#check if user is logged in
elsif($userinfo->{'username'})
{
$page->{'message'}->{'type'} = "error";
$page->{'message'}->{'text'} = "error_already_logged_in";
print output_page();
}
else else
{ {
#if not, print login form #if not, print login form

View file

@ -30,10 +30,10 @@
<li> <li>
<a> <a>
<xsl:attribute name="href"> <xsl:attribute name="href">
<xsl:value-of select="$site_strings[@id='path_login-openid']" /> <xsl:value-of select="$site_strings[@id='path_login']" />
</xsl:attribute> </xsl:attribute>
<xsl:value-of select="$locale_strings[@id='login_openid']" /> <xsl:value-of select="$locale_strings[@id='login']" />
</a> </a>
</li> </li>

View file

@ -18,12 +18,6 @@
<xsl:value-of select="$site_strings[@id='path_login']" /> <xsl:value-of select="$site_strings[@id='path_login']" />
</xsl:attribute> </xsl:attribute>
<fieldset> <fieldset>
<!--
why do we need this hidden input ?
-->
<input name="action" type="hidden" value="login" />
<label for="user"> <label for="user">
<xsl:value-of select="$locale_strings[@id='username']" />: <xsl:value-of select="$locale_strings[@id='username']" />:
</label> </label>
@ -104,42 +98,11 @@
the loginform template is deprecated the loginform template is deprecated
--> -->
<div class="loginform"> <div class="loginform">
<xsl:choose>
<xsl:when test="//loginform/@action='openid'">
<form method="post"> <form method="post">
<xsl:attribute name="action"> <xsl:attribute name="action">
<xsl:value-of select="$site_strings[@id='path_login']" /> <xsl:value-of select="$site_strings[@id='path_login']" />
</xsl:attribute> </xsl:attribute>
<fieldset> <fieldset>
<input name="action" type="hidden" value="openid" />
OpenID:
<br />
<input name="user" type="text" style="background: url(http://stat.livejournal.com/img/openid-inputicon.gif) no-repeat; background-color: #fff; background-position: 0 50%; padding-left: 18px;" />
<br />
e.g. http://username.myopenid.com
<br />
<input type="submit" name="login" >
<xsl:attribute name="value">
<xsl:value-of select="$locale_strings[@id='button_login']" />
</xsl:attribute>
</input>
<br />
<a>
<xsl:attribute name="href">
<xsl:value-of select="$site_strings[@id='path_login']" />
</xsl:attribute>
login with normal account
</a>
</fieldset>
</form>
</xsl:when>
<xsl:otherwise>
<form method="post">
<xsl:attribute name="action">
<xsl:value-of select="$site_strings[@id='path_login']" />
</xsl:attribute>
<fieldset>
<input name="action" type="hidden" value="login" />
<xsl:value-of select="$locale_strings[@id='username']" />: <xsl:value-of select="$locale_strings[@id='username']" />:
<br /> <br />
<input name="user" type="text" size="30" maxlength="30" /> <input name="user" type="text" size="30" maxlength="30" />
@ -153,17 +116,8 @@
<xsl:value-of select="$locale_strings[@id='button_login']" /> <xsl:value-of select="$locale_strings[@id='button_login']" />
</xsl:attribute> </xsl:attribute>
</input> </input>
<br />
<a>
<xsl:attribute name="href">
<xsl:value-of select="$site_strings[@id='path_login-openid']" />
</xsl:attribute>
login with openid
</a>
</fieldset> </fieldset>
</form> </form>
</xsl:otherwise>
</xsl:choose>
</div> </div>
</xsl:template> </xsl:template>