Source code:

class Auth {

    // Entry point
    fun getHtml(parameters: Parameters?): String {
        if (parameters == null || parameters.isEmpty()) return logInHtml()
        if (authenticate(parameters["username"], parameters["password"])) {
            return loggedHtml()
        }
        return logInHtml(true)
    }

    private fun authenticate(username: String?, password: String?): Boolean {
        if (username == null || username.length != 5 || !username.toLowerCase().startsWith("admin")) return false
        return !(password != AdminCredentials.password && username != AdminCredentials.username)
    }

    private fun logInHtml(error: Boolean = false): String {
        return if (!error) {
            "${HtmlContent.title} ${HtmlContent.defaultContent}"
        } else {
            "${HtmlContent.title} ${HtmlContent.errorLoginMessage} ${HtmlContent.defaultContent}"
        }
    }

    private fun loggedHtml(): String {
        return AdminCredentials.success
    }
}