/**
 * Determine whether input fields for client settings need to be shown
 *
 * If valid credentials were passed along with the request, they are saved to the session.
 * This functions returns an exception if invalid credentials have been given or if the
 * connection to the server failed for some other reason.
 *
 * @param   string  $client  The name of the client.
 *
 * @return  boolean  True if credentials are present
 *
 * @since   1.7.0
 * @throws  \InvalidArgumentException if credentials invalid
 */
public static function setCredentialsFromRequest($client)
{
    // Determine whether FTP credentials have been passed along with the current request
    $input = Factory::getApplication()->input;
    $user = $input->post->getString('username', null);
    $pass = $input->post->getString('password', null);
    if ($user != '' && $pass != '') {
        // Add credentials to the session
        if (!self::setCredentials($client, $user, $pass)) {
            throw new \InvalidArgumentException('Invalid user credentials');
        }
        $return = false;
    } else {
        // Just determine if the FTP input fields need to be shown
        $return = !self::hasCredentials('ftp');
    }
    return $return;
}