.. versionadded:: 2016.3.0

    Configures the machine to auto login with the specified user

    Args:

        name (str): The user account use for auto login

        password (str): The password to user for auto login

            .. versionadded:: 2017.7.3

    Returns:
        bool: ``True`` if successful, otherwise ``False``

    CLI Example:

    .. code-block:: bash

        salt '*' user.enable_auto_login stevej

def enable_auto_login(name, password):
    '''
    .. versionadded:: 2016.3.0

    Configures the machine to auto login with the specified user

    Args:

        name (str): The user account use for auto login

        password (str): The password to user for auto login

            .. versionadded:: 2017.7.3

    Returns:
        bool: ``True`` if successful, otherwise ``False``

    CLI Example:

    .. code-block:: bash

        salt '*' user.enable_auto_login stevej
    '''
    # Make the entry into the defaults file
    cmd = ['defaults',
           'write',
           '/Library/Preferences/com.apple.loginwindow.plist',
           'autoLoginUser',
           name]
    __salt__['cmd.run'](cmd)
    current = get_auto_login()

    # Create/Update the kcpassword file with an obfuscated password
    o_password = _kcpassword(password=password)
    with salt.utils.files.set_umask(0o077):
        with salt.utils.files.fopen('/etc/kcpassword', 'w' if six.PY2 else 'wb') as fd:
            fd.write(o_password)

    return current if isinstance(current, bool) else current.lower() == name.lower()