diff --git a/core/auth.html b/core/auth.html index 71deaba9..1a1ed596 100644 --- a/core/auth.html +++ b/core/auth.html @@ -75,6 +75,10 @@ margin-bottom: 1em; padding: 1em; } + #code_of_conduct:has(>textarea:empty) { + display: none; + width: 100%; + }

Welcome.

@@ -126,8 +130,10 @@ There is currently no administrator. You will be made administrator.
-

Code of Conduct

- +
+

Code of Conduct

+ +
`; } diff --git a/src/httpd.login.c b/src/httpd.login.c index ca2a29fb..9e5a3582 100644 --- a/src/httpd.login.c +++ b/src/httpd.login.c @@ -352,7 +352,7 @@ static void _httpd_endpoint_login_work(tf_ssb_t* ssb, void* user_data) { JSValue settings_value = JS_ParseJSON(context, login->settings, strlen(login->settings), NULL); JSValue code_of_conduct_value = JS_GetPropertyStr(context, settings_value, "code_of_conduct"); - const char* code_of_conduct = JS_ToCString(context, code_of_conduct_value); + const char* code_of_conduct = JS_IsString(code_of_conduct_value) ? JS_ToCString(context, code_of_conduct_value) : NULL; const char* result = tf_strdup(code_of_conduct); JS_FreeCString(context, code_of_conduct); JS_FreeValue(context, code_of_conduct_value);