aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorfriendica <info@friendica.com>2012-07-22 19:37:15 -0700
committerfriendica <info@friendica.com>2012-07-22 19:37:15 -0700
commiteb4d5f4009a0443fe9e8b68eaa6ed1096a719a3c (patch)
treef2c920c1a57353b1bbf6f2f57793264d78fd9b59
parent4e4395b00fa8d7b06b11bdbb95da86ae15b1eb71 (diff)
downloadvolse-hubzilla-eb4d5f4009a0443fe9e8b68eaa6ed1096a719a3c.tar.gz
volse-hubzilla-eb4d5f4009a0443fe9e8b68eaa6ed1096a719a3c.tar.bz2
volse-hubzilla-eb4d5f4009a0443fe9e8b68eaa6ed1096a719a3c.zip
registration page form validation
-rw-r--r--mod/zregister.php52
-rw-r--r--view/mod_zregister.css6
2 files changed, 55 insertions, 3 deletions
diff --git a/mod/zregister.php b/mod/zregister.php
index b683a9d85..7a8d67e78 100644
--- a/mod/zregister.php
+++ b/mod/zregister.php
@@ -12,9 +12,9 @@ function zregister_init(&$a) {
$email = $_REQUEST['email'];
if(! allowed_email($email))
- $result['message'] = t('Your email domain is not among those allowed on this site.');
+ $result['message'] = t('Your email domain is not among those allowed on this site');
if((! valid_email($email)) || (! validate_email($email)))
- $result['message'] .= t('Not a valid email address.') . EOL;
+ $result['message'] .= t('Not a valid email address') . EOL;
if($result['message'])
$result['error'] = true;
@@ -23,8 +23,54 @@ function zregister_init(&$a) {
killme();
}
+ $pw1 = t("Password too short");
+ $pw2 = t("Passwords do not match");
-
+ $a->page['htmlhead'] .= <<< EOT
+<script>
+ function zFormError(elm,x) {
+ if(x) {
+ $(elm).addClass("zform-error");
+ $(elm).removeClass("zform-ok");
+ }
+ else {
+ $(elm).addClass("zform-ok");
+ $(elm).removeClass("zform-error");
+ }
+ }
+ $(document).ready(function() {
+ $("#zregister-email").blur(function() {
+ var zreg_email = $("#zregister-email").val();
+ $.get("zregister/email_check.json?f=&email=" + encodeURIComponent(zreg_email),function(data) {
+ $("#zregister-email-feedback").html(data.message);
+ zFormError("#zregister-email-feedback",data.error);
+ });
+ });
+ $("#zregister-password").blur(function() {
+ if(($("#zregister-password").val()).length < 6 ) {
+ $("#zregister-password-feedback").html("$pw1");
+ zFormError("#zregister-password-feedback",true);
+ }
+ else {
+ $("#zregister-password-feedback").html("");
+ zFormError("#zregister-password-feedback",false);
+ }
+ });
+ $("#zregister-password2").blur(function() {
+ if($("#zregister-password").val() != $("#zregister-password2").val()) {
+ $("#zregister-password2-feedback").html("$pw2");
+ zFormError("#zregister-password2-feedback",true);
+ }
+ else {
+ $("#zregister-password2-feedback").html("");
+ zFormError("#zregister-password2-feedback",false);
+ }
+ });
+ });
+
+</script>
+
+EOT;
}
diff --git a/view/mod_zregister.css b/view/mod_zregister.css
index 160b9ce4b..2edb9e9a9 100644
--- a/view/mod_zregister.css
+++ b/view/mod_zregister.css
@@ -21,7 +21,13 @@ h2 {
padding: 5px;
}
+.zregister-feedback {
+ float: left;
+ margin-left: 5px;
+}
+
.zregister-field-end {
clear: both;
margin-bottom: 20px;
}
+