Tópico Original (http://www.costaweb.net/forum/index.php?topic=46.0) | Mais truques e dicas (http://www.costaweb.net/forum/index.php?board=8.0) | Costa Web (http://www.costaweb.net/forum)
Este truque irá criar uma janela flutuante para fazer autenticação. Não é complicado e é uma alternativa à opção de ter a autenticção rápida em todas as páginas.
(https://www.simplemachines.org/community/proxy.php?request=http%3A%2F%2Fi.imgur.com%2F3wkx4a2.png&hash=e0fe084df0a391b125d80c66c9c7365f1ef43d5b)
./Themes/default/index.template.php
// Otherwise they're a guest - this time ask them to either register or login - lazy bums...
elseif (!empty($context['show_login_bar']))
{
echo '
<script type="text/javascript" src="', $settings['default_theme_url'], '/scripts/sha1.js"></script>
<form id="guest_form" action="', $scripturl, '?action=login2" method="post" accept-charset="', $context['character_set'], '" ', empty($context['disable_login_hashing']) ? ' onsubmit="hashLoginPassword(this, \'' . $context['session_id'] . '\');"' : '', '>
<div class="info">', sprintf($txt['welcome_guest'], $txt['guest_title']), '</div>
<input type="text" name="user" size="10" class="input_text" />
<input type="password" name="passwrd" size="10" class="input_password" />
<select name="cookielength">
<option value="60">', $txt['one_hour'], '</option>
<option value="1440">', $txt['one_day'], '</option>
<option value="10080">', $txt['one_week'], '</option>
<option value="43200">', $txt['one_month'], '</option>
<option value="-1" selected="selected">', $txt['forever'], '</option>
</select>
<input type="submit" value="', $txt['login'], '" class="button_submit" /><br />
<div class="info">', $txt['quick_login_dec'], '</div>';
if (!empty($modSettings['enableOpenID']))
echo '
<br /><input type="text" name="openid_identifier" id="openid_url" size="25" class="input_text openid_login" />';
echo '
<input type="hidden" name="hash_passwrd" value="" />
</form>';
}
// Otherwise they're a guest - this time ask them to either register or login - lazy bums...
if (!empty($context['user']['is_guest']))
{
echo '<div id="janela-login">';
echo '
<form action="', $scripturl, '?action=login2" method="post" accept-charset="', $context['character_set'], '" ', empty($context['disable_login_hashing']) ? ' onsubmit="hashLoginPassword(this, \'' . $context['session_id'] . '\');"' : '', '>
<h2>', $txt['login'], '</h2>
<div class="campo"><span class="etiqueta">', $txt['username'], ':</span><input type="text" name="user" size="10" class="input_text" /></div>
<div class="campo"><span class="etiqueta">', $txt['password'], ':</span><input type="password" name="passwrd" size="10" class="input_password" /></div>
<div class="campo">
<span class="etiqueta">Duração:</span><select name="cookielength">
<option value="60">', $txt['one_hour'], '</option>
<option value="1440">', $txt['one_day'], '</option>
<option value="10080">', $txt['one_week'], '</option>
<option value="43200">', $txt['one_month'], '</option>
<option value="-1" selected="selected">', $txt['forever'], '</option>
</select>
</div>
<div class="campo button"><input type="submit" value="', $txt['login'], '" class="button_submit" /></div>
<div class="info">', sprintf($txt['welcome_guest'], $txt['guest_title']), '</div>';
if (!empty($modSettings['enableOpenID']))
echo '
<br /><input type="text" name="openid_identifier" id="openid_url" size="25" class="input_text openid_login" />';
echo '
<input type="hidden" name="hash_passwrd" value="" />
</form>';
echo '</div>';
}
./Themes/default/css/index.css
#janela-login{
background: #fff;
border: 3px solid black;
padding: 10px;
position: fixed;
right: 70px;
top: 200px;
width: 300px;
}
#janela-login h2{
border-bottom: 1px solid black;
text-align: center;
}
#janela-login .campo{
margin-top: 10px;
}
#janela-login .campo input{
width: 150px;
}
#janela-login .button{
text-align: center;
}
#janela-login .button input{
width: 150px;
}
#janela-login .etiqueta{
display: inline-block;
margin-right: 30px;
text-align: right;
width: 90px;
}
#janela-login .info{
border-top: 1px solid black;
margin-top: 10px;
}