disable password field on openid detection via javascript
git-svn-id: http://yolanda.mister-muffin.de/svn@280 7eef14d0-6ed0-489d-bf55-20463b2d70db
This commit is contained in:
parent
f779418312
commit
031a198e83
6 changed files with 89 additions and 51 deletions
|
@ -112,10 +112,12 @@
|
|||
|
||||
<!-- login / register page -->
|
||||
<string id="username">username</string>
|
||||
<string id="password">password</string>
|
||||
<string id="username_or_openid">Username or OpenID</string>
|
||||
<string id="password">Password</string>
|
||||
<string id="password_repeat">repeat password</string>
|
||||
<string id="button_register">register</string>
|
||||
<string id="button_login">login</string>
|
||||
<string id="input_password_not_required">No password required.</string>
|
||||
<string id="button_register">Register</string>
|
||||
<string id="button_login">Login</string>
|
||||
|
||||
<!-- upload page -->
|
||||
<string id="file">file</string>
|
||||
|
|
|
@ -29,12 +29,14 @@
|
|||
<xsl:include href="./xhtml/settings.xsl" />
|
||||
<xsl:include href="./xhtml/splash.xsl" />
|
||||
<xsl:include href="./xhtml/searchbar.xsl" />
|
||||
<xsl:include href="./xhtml/tagbar.xsl" />
|
||||
<xsl:include href="./xhtml/tagcloud.xsl" />
|
||||
<xsl:include href="./xhtml/upload.xsl" />
|
||||
<xsl:include href="./xhtml/video.xsl" />
|
||||
<xsl:include href="./xhtml/xhtml-body.xsl" />
|
||||
<xsl:include href="./xhtml/xhtml-head.xsl" />
|
||||
|
||||
|
||||
<xsl:variable name="locale">
|
||||
<xsl:choose>
|
||||
<xsl:when test="document(concat('../locale/', //@locale, '.xml'))">
|
||||
|
|
|
@ -8,57 +8,73 @@
|
|||
>
|
||||
|
||||
<xsl:template name="loginbox">
|
||||
|
||||
<div class="loginbox">
|
||||
|
||||
<xsl:choose>
|
||||
<xsl:when test="string-length(//@username)=0">
|
||||
<form method="post">
|
||||
<xsl:attribute name="action">
|
||||
<xsl:value-of select="$site_strings[@id='path_login']" />
|
||||
</xsl:attribute>
|
||||
<fieldset>
|
||||
<label for="user">
|
||||
<xsl:value-of select="$locale_strings[@id='username_or_openid']" />:
|
||||
</label>
|
||||
<br />
|
||||
<input id="username" name="user" onkeyup="check_openid();" type="text" />
|
||||
<br />
|
||||
|
||||
<form method="post">
|
||||
<xsl:attribute name="action">
|
||||
<xsl:value-of select="$site_strings[@id='path_login']" />
|
||||
<label for="pass">
|
||||
<xsl:value-of select="$locale_strings[@id='password']" />:
|
||||
</label>
|
||||
<br />
|
||||
<input id="password" name="pass" type="password" />
|
||||
|
||||
<input type="submit" name="login" >
|
||||
<xsl:attribute name="value">
|
||||
<xsl:value-of select="$locale_strings[@id='button_login']" />
|
||||
</xsl:attribute>
|
||||
<fieldset>
|
||||
<label for="user">
|
||||
<xsl:value-of select="$locale_strings[@id='username']" />:
|
||||
</label>
|
||||
<br />
|
||||
<input name="user" type="text" />
|
||||
<br />
|
||||
</input>
|
||||
|
||||
<label for="pass">
|
||||
<xsl:value-of select="$locale_strings[@id='password']" />:
|
||||
</label>
|
||||
<br />
|
||||
<input name="pass" type="password" />
|
||||
|
||||
<input type="submit" name="login" >
|
||||
<xsl:attribute name="value">
|
||||
<xsl:value-of select="$locale_strings[@id='button_login']" />
|
||||
</xsl:attribute>
|
||||
</input>
|
||||
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
</xsl:when>
|
||||
<xsl:otherwise>
|
||||
|
||||
<!--
|
||||
<xsl:value-of select="$locale_strings[@id='logged_in_as']" />
|
||||
<a>
|
||||
<xsl:attribute name="href">
|
||||
user/<xsl:value-of select="//@username" />
|
||||
</xsl:attribute>
|
||||
<xsl:value-of select="//@username" />
|
||||
</a>
|
||||
-->
|
||||
|
||||
|
||||
</xsl:otherwise>
|
||||
</xsl:choose>
|
||||
</fieldset>
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
<script type="text/javascript">
|
||||
|
||||
<!--
|
||||
this looks awfully ugly, but nevertheless generates javascript inside _valid_ XHTML
|
||||
kudos to toby white who details the solution on http://scispace.net/tow21/weblog/718.html
|
||||
-->
|
||||
|
||||
<xsl:text disable-output-escaping="yes"><![CDATA[
|
||||
<![CDATA[
|
||||
|
||||
function check_openid()
|
||||
{
|
||||
password = document.getElementById('password');
|
||||
if (
|
||||
document.getElementById('username').value.substring(7,0).toLowerCase() == "http://"
|
||||
||
|
||||
document.getElementById('username').value.substring(8,0).toLowerCase() == "https://"
|
||||
)
|
||||
{
|
||||
password.disabled = true;
|
||||
password.type = 'input';
|
||||
password.value = ']]></xsl:text><xsl:value-of select="$locale_strings[@id='input_password_not_required']" /><xsl:text disable-output-escaping="yes"><![CDATA[';
|
||||
}
|
||||
else
|
||||
{
|
||||
password.disabled = false;
|
||||
password.type = 'password';
|
||||
password.value = '';
|
||||
}
|
||||
}
|
||||
|
||||
]]]]></xsl:text>
|
||||
<xsl:text disable-output-escaping="yes">></xsl:text>
|
||||
</script>
|
||||
|
||||
</xsl:template>
|
||||
|
||||
<xsl:template name="loginform">
|
||||
|
|
13
trunk/xsl/xhtml/tagbar.xsl
Normal file
13
trunk/xsl/xhtml/tagbar.xsl
Normal file
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<xsl:stylesheet version="1.0"
|
||||
xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://web.resource.org/cc/"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
>
|
||||
|
||||
<xsl:template name="tagbar">
|
||||
</xsl:template>
|
||||
|
||||
</xsl:stylesheet>
|
|
@ -38,14 +38,14 @@
|
|||
|
||||
function hide_movie()
|
||||
{
|
||||
document.getElementById('video').style.display = 'none';
|
||||
document.getElementById('preview').style.display = 'block';
|
||||
document.getElementById('video').style.display = 'none';
|
||||
document.getElementById('preview').style.display = 'block';
|
||||
}
|
||||
|
||||
function show_movie()
|
||||
{
|
||||
document.getElementById('video').style.display = 'inline';
|
||||
document.getElementById('preview').style.display = 'none';
|
||||
document.getElementById('video').style.display = 'inline';
|
||||
document.getElementById('preview').style.display = 'none';
|
||||
window.setTimeout("hide_movie()",
|
||||
]]>
|
||||
</xsl:text>
|
||||
|
|
|
@ -22,7 +22,12 @@
|
|||
<xsl:choose>
|
||||
<xsl:when test="//frontpage">
|
||||
<xsl:call-template name="searchbar" />
|
||||
<xsl:call-template name="loginbox" />
|
||||
|
||||
<xsl:if test="string-length(//@username)=0">
|
||||
<xsl:call-template name="loginbox" />
|
||||
</xsl:if>
|
||||
|
||||
|
||||
<xsl:call-template name="tagcloud" />
|
||||
|
||||
<xsl:if test="//message">
|
||||
|
|
Loading…
Reference in a new issue