Skip to content

Commit

Permalink
Merge pull request #758 from Irtesaam/fix-csrf_token-in-sign-in-modal
Browse files Browse the repository at this point in the history
Removed {% csrf_token %} line from sign-in modal
  • Loading branch information
PriyaGhosal authored Oct 21, 2024
2 parents 50f8bab + f3e2dfa commit 944e791
Showing 1 changed file with 17 additions and 18 deletions.
35 changes: 17 additions & 18 deletions signin.html
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,16 @@
</ul>
</nav>
</header>

<div class="container">
<div class="form-container">
<!-- Add SkillWise Icon/Logo -->
<img src="assets/images/Skillwise_logo.jpg" alt="SkillWise Logo" class="logo">

<h1>Welcome to <span class="brand">SkillWise</span></h1>
<p><strong>Sign in</strong> to access your learning dashboard</p>

<form action="#" method="POST">
{% csrf_token %}
<div class="input-group">
<label for="username">Username</label>
<input type="text" id="username" name="username" placeholder="Enter your username" required>
Expand All @@ -53,7 +52,7 @@ <h1>Welcome to <span class="brand">SkillWise</span></h1>
<small>Use special characters and numbers for a strong password</small>
</p> -->

<button type="submit" class="signin-btn" id="submit">Sign In</button>

<p class="signup-link">Don't have an account? <a href="./signup.html">Sign up here</a></p>
Expand All @@ -67,28 +66,28 @@ <h1>Welcome to <span class="brand">SkillWise</span></h1>
const passwordInput = document.querySelector("#password");
const submitBtn = document.querySelector("#submit");
const emailInput = document.querySelector("#email");

togglePassword.addEventListener("click", function () {
const type = passwordInput.getAttribute("type") === "password" ? "text" : "password";
passwordInput.setAttribute("type", type);

this.classList.toggle("fa-eye-slash");
this.classList.toggle("fa-eye");
});



submitBtn.addEventListener("click", (e) => {
e.preventDefault();

const email = emailInput.value;
const emailError = document.getElementById("emailError");


const emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,6}$/;

if (!emailPattern.test(email)) {

if (!emailError) {
const errorMsg = document.createElement("p");
errorMsg.id = "emailError";
Expand All @@ -97,17 +96,17 @@ <h1>Welcome to <span class="brand">SkillWise</span></h1>
emailInput.parentElement.appendChild(errorMsg);
}
} else {

if (emailError) {
emailError.remove();
}

e.target.closest("form").submit();
}
});

</script>


</body>
</html>

0 comments on commit 944e791

Please sign in to comment.