reference:user_manager_script

User Manager Script

If you want people to be able to log in using a different username than their VPOP3 username (eg if you want them to be able to log in using an email address), then you can use the UserManager Lua script

The Lua script is managed through the Settings → Scripts page in VPOP3 v8.0 and later and is called 'UserManager.LUA.

VPOP3 calls a function called TranslateUsername which should have the following prototype:

TranslateUsername(<protocol>, <submitted username>)

Protocol indicates which protocol is being used to log in, and is one of:

  • POP3
  • IMAP4
  • SMTP
  • WEBMAIL

Submitted username is the user name entered by the user

The script will return a single value, which is the VPOP3 username that the submitted username should translate to:

A simple example would be:

function TranslateUsername(Protocol, Username)
--look up username in a mapping table
    users = {
                ["joe@company.co.uk"] = "joe",
                ["kate@company2.co.uk"] = "kate"
                }

    if (users[Username]) then
        return users[Username]
    end
    
    return Username;
end

or

function TranslateUsername(Protocol, Username)
-- Remove trailing @company.com from username and keep the remainder
    Username = string.gsub(Username, "@company%.com$", "");
    
    return Username;
end

If you need, we can produce a script for you, but there would be a cost for this - contact support@pscs.co.uk with a specification for a quote.

reference/user_manager_script.txt · Last modified: 2024/04/22 08:37 by paul