Page 1 of 1

Add a "Forget Password" function in the web client

Posted: Mon May 30, 2022 7:05 am
by FTP
First, replace the login page with a modified version for the web client, just download and unzip this zip file into the folder "/webclient": https://www.wftpserver.com/bbsres/resetpass.zip

Then the web client's login page will look like this:
Image

If your clients forget the login password, they can click the button "Forget Password", fill out the form and click the button "Reset Password". If the requested name and email address are correct, a new password will be sent to client's mailbox.

So the client's email address must be defined at "Domain -> Users -> Edit a user -> Notes -> Email address".


Next, you should insert the below Lua script into "Event Manager -> HTTP Events -> BeforeUserLoggedIn":

Code: Select all

local domain = "MyDomain"
local SMTPConf = "MySmtpConf"
local username = "%Name"
local user = c_GetUser(domain, username)
if user ~= nil then
  local pass = Split("%Password", ":")
  if table.maxn(pass) == 2 and pass[1] == "emailaddress" and pass[2] ~= "" and pass[2] == user.note_email then
	if user.last_loginip == "" then
		bCancelEvent = true
		return
	end

	local strNewPass = ""
	local charArray = {'0','1','2','3','4','5','6','7','8','9','a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z','~','!','@','#','$','^','&'}
	math.randomseed(c_GetRandom())
	math.random()
	for i=1,10 do
		local nowindex = math.random(1,table.maxn(charArray))
		strNewPass = strNewPass..charArray[nowindex]
	end

	local bMailSent = c_SendMail(user.note_email,"Your password has been changed in WingFTP","Your password has been changed in WingFTP. \nThe new password is: "..strNewPass,"",SMTPConf)
	if bMailSent == true then
		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

		user.password = strNewPass
		AddUser(domain, user)
		c_ResetUserLoginIP(domain, username)
	end
	bSelfAuthenticated = true
  else
    bSelfAuthenticated = false
  end
else
  bSelfAuthenticated = false
end
Here, "MyDomain" is the current domain name, you need to change it into your own. And "MySmtpConf" is the SMTP configuration name which defined under "Server -> Settings -> SMTP configuration manager".


Image

Re: Add a "Forget Password" function in the web client

Posted: Fri Jun 13, 2025 5:10 am
by ABSFTP
Hi
So this Change made the Login Website unavailable when updating to v7.4.4.
Your Workaround (https://bbs.wftpserver.com/viewtopic.php?t=4110) removes the reset Password button.

does the Function still work as its written above with the current Version of WingFTP?

Re: Add a "Forget Password" function in the web client

Posted: Sat Jun 14, 2025 12:30 pm
by FTP
OK, after installing the latest version 7.4.4, please unzip the zip file into the folder "/webclient" again.

Re: Add a "Forget Password" function in the web client

Posted: Thu Jun 19, 2025 1:41 pm
by ABSFTP
When i do this the website is again unavailable and i have to revert back by installing WingFTP again

Re: Add a "Forget Password" function in the web client

Posted: Thu Feb 19, 2026 6:44 am
by ABSFTP
Hi,
Is there any update for the current 8.x.x version?
The issue still hasn’t been resolved since version 7.4.4.
We have a large number of users, and a self-service password reset feature would be extremely helpful in our case.
It would be great if this functionality could be integrated directly into the client, so that an administrator can simply enable or disable password self-service via a toggle in the admin dashboard.
An important requirement for us is that the email address entered by the user during validation is not case-sensitive and is matched against the email address configured in the user account.
Thank you in advance.
Best regards

Re: Add a "Forget Password" function in the web client

Posted: Fri Feb 27, 2026 3:16 pm
by FTP
We have updated this plugin for the recent versions, please download it again: https://www.wftpserver.com/bbsres/resetpass.zip