Can I validate the number of times a user can login (eg user can login with their details up to 5times after that login won't be possible ) I also haven't seen any validation of fields or any time
validation of user login
-
- User
- Posts: 416
- Location: Nürnberg/Germany
You could use a field in databasetable USER that contains the logincount. Each login the value increase. If the limit is reached, the user can't login.
You have to use the server events. Take a look at the helpfile, the server events are well documented.
-
- User
- Posts: 1601
Are you talking about the Maximum failed attempts? You can click [Advanced]->[User Login Options]. Then enable [Track failed attempts] and set [Maximum failed attempts] to 5 (up to 5 times).
If you need to have other than password validation, you may setup Form_CustomValidate server event under Server Events->Other->Login Page. See Server event and Client script in help file.
-
- User
- Posts: 9430
Enable Audit Trail -> Track login/logout activities and use database table for Audit Trail (see PHP Settings -> General -> Audit Trail in the help file). Then use User_LoggingIn server event (see Server Events and Client Scripts in the help file) to query the audit trail table and get the number of login, if more than what you allowed (including the just successful login), call setFailureMessage and redirect user to the logout page, e.g.
$count = ew_ExecuteScalar("SELECT COUNT(*) FROM YourAuditTrailTable WHERE YourUserNameField = '" . ew_AdjustSql($usr) . "'");
if ($count > 6) {
$this->setFailureMessage("Your Message");
return FALSE;
}