6👍
We used django-lockout and it worked really well
UPDATE: django-lockout’s last release was 2011: https://pypi.org/project/django-lockout/. The Github project does not exist anymore (404).
- Django annotate groupings by month
- Is it possible to disable django related_name for a specific field?
- Django HTML E-mail template doesn't load css in the e-mail
- Django admin not serving static files?
- Instantiate model instance with manytomany field in Django
4👍
One simple solution would be to create a variable in the User Profile that is initialy 0 and increased by 1 every time the user unsuccessfully tries to login. If this variable reaches a certain threshold(which is checked every time the user tries to login), the user account can be suspended. Of course when the user does succesfully login, the variable must be set back to 0.
3👍
Create model called “failed_logins” with two fields, a “User” field/foreign key and a “Timestamp” field.
When a user successfully logs in, delete all “failed_logins” entries for that user.
When a user unsuccessfully logs in, create an entry in “failed_logins” for that user with the current timestamp.
On every login attempt for a given user, BEFORE checking to see if password is correct/incorrect:
-
run a query deleting all “failed_logins” entries older than 15 minutes (or w/e time period).
-
run a query checking the count of entries in failed_logins for the user attempting to login. If it’s 5, kill the login attempt, notifying the user they have been locked out of their account and to try back in a little while.
Result:
Users are locked out after 5 failed login attempts for a short while.
- How to make Django Password Reset Email Beautiful HTML?
- Format of timesince filter
- Django template {%for%} tag add li every 4th element
- Can we have Django DateTimeField without timezone?
-10👍
You can try this snippet:
<?php
session_start();
$conn = mysql_connect("localhost","root","root");
$select = mysql_select_db("Gayathri",$conn) or die("connection error");
if(isset($_COOKIE['login'])&&$_COOKIE['login']>=3){
echo " you have to wait for sometimes to enable your login"."<br>";
}
if(isset($_POST["username"],$_POST["userpassword"])){
$username = $_POST['username'];
$userpassword = $_POST['userpassword'];
$query = "SELECT * from userlogin where username='".$username."' and userpassword='".$userpassword."'";
$result = mysql_query($query);
$row = mysql_fetch_assoc($result);
if($row){
echo"login successfull";
}
else{
echo"Invalid password"."<br>";
if(isset($_COOKIE['login'])){
$attempts=$_COOKIE['login']+1;
}else{
$attempts=1;
}
setcookie('login', $attempts, time()+60*60);
}
}
?>
<form method = "post" action = "">
<table border=1>
<tr>
<td>Username:</td>
<td><input type="text" name="username" value=""></td>
</tr>
<tr>
<td>Userpassword:</td>
<td><input type="password" name="userpassword" value=""></td>
</tr>
<tr>
<td colspan="2" align=center><input type="submit" name="submit" value="login"></td>
</tr>
</table>
- Psycopg2.OperationalError: FATAL: password authentication failed for user "<my UNIX user>"
- Rendering individual fields in template in a custom form
- Class based generic views extra context
- Django Rest Ordering custom
- Adding forgot-password feature to Django admin site