function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Kuljit Singh TomarKuljit Singh Tomar 

Display number of attempts remaining on customer portal login page

Hi, 
Is there a way to display the number of login attempts remaining when a user enters invalid password on the customer portal login page before the user account would get locked?

I was hoping to access NumberOfFailedLogins field from the User object, but the SOQL does not fetch this field upon querying even in 'without sharing' mode in the Apex controller. When I query this field via SOQL Query, it does show up, but not when the SOQL is part of the Apex controller. I am guessing its hidden from the view of unauthenticated user, but is someone able to confirm this or suggest a solution that worked for you?

Thank you! 

Cheers,

Kulit
 

Hitesh chaudhariHitesh chaudhari
  • First, you have to set or get the maximum number of attempts allowed, By going to Password Policies, 
  • To get how many users had made invalid login queries on the user and got Failed Login Attempt Field,
  • Compare username and show respected message.

Failed Number of Count