From: Steve Sutton Date: Tue, 17 Apr 2018 20:37:34 +0000 (-0400) Subject: Work on the become a member form. X-Git-Tag: v1.0.0^2~47 X-Git-Url: http://cvs2.gaslightmedia.com/gitweb/?a=commitdiff_plain;h=bf0e7877cc151bd96d19640052f751c785f39520;p=WP-Plugins%2Fglm-member-db-billing.git Work on the become a member form. Setting up checks for wpUser by email. give error message. check password match and contain proper length. --- diff --git a/models/front/billing/becomeMember.php b/models/front/billing/becomeMember.php index 705866d..7ebb33c 100644 --- a/models/front/billing/becomeMember.php +++ b/models/front/billing/becomeMember.php @@ -121,11 +121,31 @@ class GlmMembersFront_billing_becomeMember // extends GlmDataBilling $messages[] = '
$email_to_check: ' . print_r( $email_to_check, true ) . '
'; $verify_email = filter_var( $_REQUEST['email_verify'], FILTER_VALIDATE_EMAIL ); $messages[] = '
$verify_email: ' . print_r( $verify_email, true ) . '
'; - if ( $email_to_check !== $verify_email ) { + if ( !$email_to_check ) { + $error = true; + $messages[] = $errors['email'] = "Not a valid Email!"; + } + if ( $email_to_check != $verify_email ) { // Emails don't match give error message $error = true; $messages[] = $errors['email'] = "Emails don't match!"; } + // Check for wordpress user with same email address + $wpUser = get_user_by( 'email', $email_to_check ); + if ( is_object( $wpUser ) && $wpUser->ID ) { + $error = true; + $messages[] = $errors['email'] = "There's a user with that email already!"; + } + $passwd = filter_var( $_REQUEST['password'], FILTER_SANITIZE_STRING ); + $confirm_passwd = filter_var( $_REQUEST['confirm_password'], FILTER_SANITIZE_STRING ); + if ( $passwd != $confirm_passwd ) { + $error = true; + $messages[] = $errors['password'] = "Passwords don't match!"; + } + // if ( isset( $passwd ) && preg_match() + // $messages[] = '
$wpUser: ' . print_r( $wpUser, true ) . '
'; + // Password test. + // Verify they match and they aren't weak passwords. // Process the main form diff --git a/views/front/billing/becomeMember.html b/views/front/billing/becomeMember.html index ebe1fd0..85fc4b9 100644 --- a/views/front/billing/becomeMember.html +++ b/views/front/billing/becomeMember.html @@ -79,7 +79,6 @@ name="email" {if isset($smarty.request.email) && $smarty.request.email}value="{$smarty.request.email}"{/if} required /> - {if $errors.email}{$errors.email}{/if}
@@ -94,6 +93,7 @@ required />
+ {if $errors.email}
{$errors.email}
{/if} {* START - Custom Fields part for MiGCSA *}
@@ -265,14 +265,18 @@ required />
+
+ The password must be at least 8 characters and include at least one number, one letter, and at least one special character. (# . - _ , $ % & !) +
Password
@@ -283,12 +287,14 @@
+ {if $errors.password}
{$errors.password}
{/if}