Mercurial > hg > rlgwebd
comparison rlgterm.js @ 93:104409bf5f03
rlgterm.js: improve registration failure messages.
Provide more user-friendly explanations when registration fails.
author | John "Elwin" Edwards <elwin@sdf.org> |
---|---|
date | Wed, 11 Jul 2012 07:37:56 -0700 |
parents | a4d3ecf188b7 |
children | 597e9477b8ae |
comparison
equal
deleted
inserted
replaced
92:a4d3ecf188b7 | 93:104409bf5f03 |
---|---|
705 message("You are now logged in as " + reply.u + "."); | 705 message("You are now logged in as " + reply.u + "."); |
706 setmode("choose"); | 706 setmode("choose"); |
707 } | 707 } |
708 else if (reply.t == 'E') { | 708 else if (reply.t == 'E') { |
709 debug(1, "Could not register: " + reply.s); | 709 debug(1, "Could not register: " + reply.s); |
710 message("Registration failed."); | 710 var failmsg = "Registration failed."; |
711 if (reply.c == 2) { | |
712 var errdesc = reply.s.match(/Invalid data: (.*)/)[1]; | |
713 if (errdesc.match(/No name/)) | |
714 failmsg += " You need to choose a name."; | |
715 else if (errdesc.match(/No password/)) | |
716 failmsg += " You need to choose a password."; | |
717 else if (errdesc.match(/Invalid/)) { | |
718 failmsg += " Names must be letters and numbers. E-mail addresses " + | |
719 "can also contain these characters: @.-_"; | |
720 } | |
721 else if (errdesc.match(/Username/)) | |
722 failmsg += " Someone else is already using that name."; | |
723 else | |
724 failmsg += " This is probably a bug."; | |
725 } | |
726 else | |
727 failmsg += " This is probably a bug."; | |
728 message(failmsg); | |
711 document.getElementById("regin_name").value = ""; | 729 document.getElementById("regin_name").value = ""; |
712 document.getElementById("regin_pw").value = ""; | 730 document.getElementById("regin_pw").value = ""; |
713 document.getElementById("regin_email").value = ""; | 731 document.getElementById("regin_email").value = ""; |
714 } | 732 } |
715 }; | 733 }; |