function prepareLogin(settings, storeId, file, index = 0, origin = undefined) {
    const login = {
        index: index > -1 ? parseInt(index) : 0,
        store: settings.stores[storeId],
        // remove the file-type extension
        login: file.replace(/\.[^.]+$/u, ""),
        loginPath: file,
        allowFill: true,
    };

    origin = BrowserpassURL.prototype.isPrototypeOf(origin)
        ? origin
        : new BrowserpassURL(settings.origin);

    // extract url info from path
    let pathInfo = pathToInfo(storeId + "/" + login.login, origin);
    if (pathInfo) {
        // set assumed host
        login.host = pathInfo.port ? `${pathInfo.hostname}:${pathInfo.port}` : pathInfo.hostname;

        // check whether extracted path info matches the current origin
        login.inCurrentHost = origin.hostname === pathInfo.hostname;

        // check whether the current origin is subordinate to extracted path info, meaning:
        //  - that the path info is not a single level domain (e.g. com, net, local)
        //  - and that the current origin is a subdomain of that path info
        if (pathInfo.hostname.includes(".") && origin.hostname.endsWith(`.${pathInfo.hostname}`)) {
            login.inCurrentHost = true;
        }

        // filter out entries with a non-matching port
        if (pathInfo.port && pathInfo.port !== origin.port) {
            login.inCurrentHost = false;
        }
    } else {
        login.host = null;
        login.inCurrentHost = false;
    }

    // update recent counter
    login.recent =
        settings.recent[sha1(settings.origin + sha1(login.store.id + sha1(login.login)))];
    if (!login.recent) {
        login.recent = {
            when: 0,
            count: 0,
        };
    }

    return login;
}
Prepare a single login based settings, storeId, and path

@since 3.8.0

@param string settings   Settings object
@param string storeId    Store ID alphanumeric ID
@param string file       Relative path in store to password
@param number index      An array index for login, if building an array of logins (optional, default: 0)
@param object origin     Instance of BrowserpassURL (optional, default: new BrowserpassURL(settings.origin))
@return object of login