# HG changeset patch # User John "Elwin" Edwards # Date 1342017476 25200 # Node ID 104409bf5f03e23af71fef6afb774a84f7dc5db6 # Parent a4d3ecf188b72825b7343c3b0eb139135e779863 rlgterm.js: improve registration failure messages. Provide more user-friendly explanations when registration fails. diff -r a4d3ecf188b7 -r 104409bf5f03 rlgterm.js --- a/rlgterm.js Tue Jul 10 18:39:36 2012 -0700 +++ b/rlgterm.js Wed Jul 11 07:37:56 2012 -0700 @@ -707,7 +707,25 @@ } else if (reply.t == 'E') { debug(1, "Could not register: " + reply.s); - message("Registration failed."); + var failmsg = "Registration failed."; + if (reply.c == 2) { + var errdesc = reply.s.match(/Invalid data: (.*)/)[1]; + if (errdesc.match(/No name/)) + failmsg += " You need to choose a name."; + else if (errdesc.match(/No password/)) + failmsg += " You need to choose a password."; + else if (errdesc.match(/Invalid/)) { + failmsg += " Names must be letters and numbers. E-mail addresses " + + "can also contain these characters: @.-_"; + } + else if (errdesc.match(/Username/)) + failmsg += " Someone else is already using that name."; + else + failmsg += " This is probably a bug."; + } + else + failmsg += " This is probably a bug."; + message(failmsg); document.getElementById("regin_name").value = ""; document.getElementById("regin_pw").value = ""; document.getElementById("regin_email").value = "";