Juergen Posted February 20, 2016 Share Posted February 20, 2016 Hello @ all, on my frontend form I use a login throttle with "try" and "catch" and it works well. What I want is to add a counter of the failed login attempts displayed for the user, so the user can always see how many login attempts were done. Example: Login attempt 1, 2, 3 and so on. How can I count the number of attempts and output it on the frontend (nothing to store in the database). Has anyone done something similar in the past and can help me? Best regards Link to comment Share on other sites More sharing options...
LostKobrakai Posted February 20, 2016 Share Posted February 20, 2016 https://github.com/ryancramerdesign/ProcessWire/blob/master/wire/modules/Session/SessionLoginThrottle/SessionLoginThrottle.module#L85-L90 1 Link to comment Share on other sites More sharing options...
Juergen Posted February 20, 2016 Author Share Posted February 20, 2016 Now I got it working ! I check again the username in this case, therefore I grab the username at the beginning of this code. $usernamevalue = $sanitizer->username($input->post->user);//grab the username after submit $database = $this->wire('database'); $name = $usernamevalue; $query = $database->prepare("SELECT attempts FROM session_login_throttle WHERE name=:name"); $query->bindValue(":name", $name); $query->execute(); $numRows = $query->rowCount(); if ($numRows) list($attempts) = $query->fetch(PDO::FETCH_NUM); echo $attempts;//this outputs the login attempts Hope this helps others with the same problem. 2 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now