mirror of
https://github.com/KevinMidboe/zoff.git
synced 2025-10-29 18:00:23 +00:00
Started refactoring
This commit is contained in:
@@ -1,22 +1,21 @@
|
||||
$(document).on("click", "#login_button", function(e){
|
||||
e.preventDefault();
|
||||
$("#login_form").submit();
|
||||
})
|
||||
window.addEventListener("DOMContentLoaded", function() {
|
||||
document.getElementById("login_button").addEventListener("click", function(event) {
|
||||
this.preventDefault();
|
||||
document.querySelector("#login_form").submit();
|
||||
});
|
||||
|
||||
$(document).ready(function(){
|
||||
if(window.location.pathname == "/signup/" || window.location.pathname == "/signup"){
|
||||
$("#login_form").prepend("<input type='text' name='token' placeholder='Token' required autocomplete='off' />");
|
||||
$("#login_form").attr("action", "/signup");
|
||||
}
|
||||
if(window.location.hash == "#failed") {
|
||||
window.location.hash = "";
|
||||
Materialize.toast("Couldn't find a user with that username or password..", 4000, "red lighten");
|
||||
}
|
||||
document.getElementById("login_form").addEventListener("submit", function(event) {
|
||||
if(this.password.value == "" || this.username.value == ""){
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
|
||||
if(window.location.pathname == "/signup/" || window.location.pathname == "/signup"){
|
||||
document.querySelector("#login_form").insertAdjacentHTML("afterbegin", "<input type='text' name='token' placeholder='Token' required autocomplete='off' />");
|
||||
document.querySelector("#login_form").setAttribute("action", "/signup");
|
||||
}
|
||||
if(window.location.hash == "#failed") {
|
||||
window.location.hash = "";
|
||||
M.toast({ html: "Couldn't find a user with that username or password..", displayLength: 4000, classes: "red lighten"});
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
$(document).on("submit", "#login_form", function(e){
|
||||
if(this.password.value == "" || this.username.value == ""){
|
||||
e.preventDefault();
|
||||
}
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user