chiark / gitweb /
Use email_valid() to check email addresses throughout
[disorder] / cgi / actions.c
index e9995b9665ad7a9be6fde4def2d4264aeecfb7f1..4d064e0fb8e86c8ae6a44e0360b0992eed8165e3 100644 (file)
@@ -248,6 +248,7 @@ static void act_play(void) {
     } else if((dir = cgi_get("dir"))) {
       if(disorder_files(dcgi_client, dir, 0, &tracks, &ntracks))
         ntracks = 0;
+      /* TODO use tracksort_init */
       e = xmalloc(ntracks * sizeof (struct dcgi_entry));
       for(n = 0; n < ntracks; ++n) {
         e[n].track = tracks[n];
@@ -434,7 +435,7 @@ static void act_register(void) {
   }
   /* We could well do better address validation but for now we'll just do the
    * minimum */
-  if(!strchr(email, '@')) {
+  if(!email_valid(email)) {
     login_error("bademail");
     return;
   }
@@ -523,7 +524,7 @@ static void act_edituser(void) {
     }
   } else
     password = password2 = 0;
-  if(email && !strchr(email, '@')) {
+  if(email && !email_valid(email)) {
     login_error("bademail");
     return;
   }
@@ -742,7 +743,7 @@ void dcgi_expand(const char *name, int header) {
   if(!(found = mx_find(p, 0/*report*/)))
     fatal(errno, "cannot find %s", p);
   if(header) {
-    if(printf("Content-Type: text/html\n"
+    if(printf("Content-Type: text/html; charset=UTF-8\n"
               "%s\n"
               "\n", dcgi_cookie_header()) < 0)
       fatal(errno, "error writing to stdout");