1
I need to create a simple internal login system to apply to a blog. I can’t make my code work at all, and I need help.
This is the Code:
<script language="JavaScript">
function Login(){
var done=0;
var usuario=document.login-inputs.usuario.value;
usuario=usuario.toLowerCase();
var senha=document.login-inputs.senha.value;
seha=senha.toLowerCase();
if (usuario=="admin" && senha=="admin") {
window.location="/p/admin.html"; done=1;
}
if (done==0) { alert("Dados incorretos, tente novamente"); }
}
</script>
<div id="all">
<div id="login-box">
<div id="login-header">
Faça login no sistema
</div>
<div id="login-inputs">
<input type="text" placeholder="Nome de usuário" name=usuario>
<br />
<input type="password" placeholder="Senha" name=senha>
</div>
<div id="enviar">
<input type="button" onclick="Login()" class="botao" value=Login>
<a href="#">Esqueceu a sua senha?</a>
</div>
</div>
</div>
Will someone please tidy up the script? (I can’t modify the HTML)
If you really do it for Javascript, it’s good that you obfuscate the script after you’re done, but remember to keep a readable copy
– Rafael Almeida
Yes, in this case this login system would be for internal use even in a school content blog. My idea was to link the JS and encrypt the src just to not leave exposed.
– Daniel Bonifácio
@Danielbonifacio, never doubt the craftiness of the User, they are capable of amazing things to break or bular a system. Believe me, there’s always a curious one to poke around the JS.
– Tobias Mesquita
@Tobymosque, I understand that. It turns out that there really is no one who has this knowledge who will access the blog, and aside from that there will be no need to grab the password of X or Y user, since they are only redirected to a page with their pending notes and notices / work pending.
– Daniel Bonifácio
@Danielbonifácio, perhaps a viable way out, is to create a domain for your school (if it doesn’t exist), associate it with google apps and authenticate using Google Oauth.
– Tobias Mesquita
@Tobymosque, did not know this tool. Interesting and efficient. Thanks for the tip :D
– Daniel Bonifácio