Which parameter counts users web-logins

You can share your Lua Scripts with everybody here.
Post Reply
Broemmelhaus
Posts: 12
Joined: Tue Nov 29, 2011 12:00 pm
Location: Bonn, Germany

Which parameter counts users web-logins

Post by Broemmelhaus »

In domain->General Setting-> Password Security we have activate the Option "Need to change the password on the first logon".

Which parameter causes the question for a new Password at the first login?
I've logged in with an FTP-Client first time and in the user account statistic the counter shows 1 login.
After that I logged in using a web browser and the prompt for password-change pops up.

So it looks, as if there is a special parameter for counting the users web-logins, but I couldn't find the right.
Thank you for your help!

Best regards
Meik
FTP
Site Admin
Posts: 2080
Joined: Tue Sep 29, 2009 6:09 am

Re: Which parameter counts users web-logins

Post by FTP »

OK, it depends on the last login IP, if the last login IP is empty, then logged in web client user will be forced to change his password. You can use this Lua API to reset the last login IP: c_ResetUserLoginIP("DomainName", "UserName")
Broemmelhaus
Posts: 12
Joined: Tue Nov 29, 2011 12:00 pm
Location: Bonn, Germany

Re: Which parameter counts users web-logins

Post by Broemmelhaus »

Thanks! That makes sense and is exactly what I was looking for.
Broemmelhaus
Posts: 12
Joined: Tue Nov 29, 2011 12:00 pm
Location: Bonn, Germany

Re: Which parameter counts users web-logins

Post by Broemmelhaus »

One last additional question:
If I see it correctly, this is the "last_loginip"-value that is being allocated/deleted in the user account.
Is it possible to change the value manually?

Our workflow involves deleting all users and then creating them again. If we do this with function "Need to change the password on the first logon" activated, all users will have to repeatedly assign new passwords. We would simply read out the login value from the existing ones and insert them again. So that only new and not yet logged in users receive the request to change their password. It probably sounds strange, but that's how it is :-)
Broemmelhaus
Posts: 12
Joined: Tue Nov 29, 2011 12:00 pm
Location: Bonn, Germany

Re: Which parameter counts users web-logins

Post by Broemmelhaus »

It's cleared up. I hadn't thought that the value could simply be written to the user account:

local str_user = c_GetUser(domain,username)
str_user.last_loginip = '123.123.123.123'
AddUser(domain,str_user)

Thank you again for your support!
Broemmelhaus
Posts: 12
Joined: Tue Nov 29, 2011 12:00 pm
Location: Bonn, Germany

Re: Which parameter counts users web-logins

Post by Broemmelhaus »

My previous entry was wrong. The value cannot be changed via the AddUser. Apparently I found no way to set this value manually.
I would be very grateful if someone could tell me if and how I can set the value manually.

Best regards
Meik
FTP
Site Admin
Posts: 2080
Joined: Tue Sep 29, 2009 6:09 am

Re: Which parameter counts users web-logins

Post by FTP »

You can't set the attribute "last_loginip", it is a read-only attribute.

And you can't edit the user account like that, you should handle it like this:

Code: Select all

	local user = c_GetUser(strDomain,strUsername)

	for k,v in pairs(user) do
		if type(v) == "boolean" then
			if v == true then
				user[k] = 1
			else
				user[k] = 0
			end
		end
	end

	...
	AddUser(strDomain, user)
Post Reply