Automatically Disable Users after 30 Days of not being Logged In
Hello. Is there a way to automatically disable all users that haven't logged in for more than 30 days? I have been looking through the Documentation, but I have only found how to do it manually.
If not, do you have any pointers on how I might achieve this?
You can call a scheduler service and executes below code that checks for Last Login Date greater than or equal to 30 days and Lock the User.
IUserService us = Services.UserService;
var userList = us.GetAll(1,100,out int totalRecords);
foreach(var u in userList)
{
if ((DateTime.Now - u.LastLoginDate).TotalDays>=30) {
u.IsLockedOut = true;
us.Save(u);
}
}
Automatically Disable Users after 30 Days of not being Logged In
Hello. Is there a way to automatically disable all users that haven't logged in for more than 30 days? I have been looking through the Documentation, but I have only found how to do it manually.
If not, do you have any pointers on how I might achieve this?
Hi,
You can call a scheduler service and executes below code that checks for Last Login Date greater than or equal to 30 days and Lock the User.
Cheers,
Shaishav
is working on a reply...