mirror of
https://github.com/10h30/ultimatemember.git
synced 2026-07-11 18:56:10 +09:00
Fix validation for change password
This commit is contained in:
@@ -101,8 +101,8 @@
|
||||
$ultimatemember->account->current_tab = 'general';
|
||||
|
||||
// change password
|
||||
if ( $_POST['current_user_password'] != '' ) {
|
||||
if ( !wp_check_password( $_POST['current_user_password'], um_user('user_pass'), um_user('ID') ) ) {
|
||||
if ( $_POST['current_user_password'] != '' || $_POST['user_password'] != '' || $_POST['confirm_user_password'] != '') {
|
||||
if ( $_POST['current_user_password'] == '' || !wp_check_password( $_POST['current_user_password'], um_user('user_pass'), um_user('ID') ) ) {
|
||||
$ultimatemember->form->add_error('current_user_password', __('This is not your password','ultimatemember') );
|
||||
$ultimatemember->account->current_tab = 'password';
|
||||
} else { // correct password
|
||||
|
||||
+16
-15
@@ -1,55 +1,56 @@
|
||||
<?php
|
||||
|
||||
|
||||
/***
|
||||
*** @adds a form identifier to form
|
||||
***/
|
||||
add_action('um_after_form_fields', 'um_add_form_identifier');
|
||||
function um_add_form_identifier($args){ ?>
|
||||
|
||||
|
||||
<input type="hidden" name="form_id" id="form_id" value="<?php echo $args['form_id']; ?>" />
|
||||
|
||||
<?php
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*** @adds a spam timestamp
|
||||
***/
|
||||
add_action('um_after_form_fields', 'um_add_security_checks');
|
||||
add_action('um_account_page_hidden_fields', 'um_add_security_checks');
|
||||
function um_add_security_checks($args){
|
||||
global $ultimatemember;
|
||||
|
||||
|
||||
if ( is_admin() ) return;
|
||||
|
||||
|
||||
echo '<input type="hidden" name="timestamp" id="timestamp" value="'. current_time( 'timestamp' ) .'" />';
|
||||
|
||||
|
||||
?>
|
||||
|
||||
|
||||
<p class="<?php echo $ultimatemember->honeypot; ?>_name">
|
||||
<label for="<?php echo $ultimatemember->honeypot; ?>"><?php _e( 'Only fill in if you are not human' ); ?></label>
|
||||
<input type="text" name="<?php echo $ultimatemember->honeypot; ?>" id="<?php echo $ultimatemember->honeypot; ?>" class="input" value="" size="25" autocomplete="off" />
|
||||
</p>
|
||||
|
||||
|
||||
<?php
|
||||
|
||||
}
|
||||
|
||||
|
||||
/***
|
||||
*** @makes the honeypot invisible
|
||||
***/
|
||||
add_action('wp_head', 'um_add_form_honeypot_css');
|
||||
function um_add_form_honeypot_css() { global $ultimatemember; ?>
|
||||
|
||||
|
||||
<style type="text/css">.<?php echo $ultimatemember->honeypot; ?>_name { display: none !important; }</style>
|
||||
|
||||
|
||||
<?php }
|
||||
|
||||
|
||||
/***
|
||||
*** @empty the honeypot value
|
||||
***/
|
||||
add_action('wp_footer', 'um_add_form_honeypot_js', 99999999999999999 );
|
||||
function um_add_form_honeypot_js() { global $ultimatemember; ?>
|
||||
|
||||
|
||||
<script type="text/javascript">jQuery( '#<?php echo $ultimatemember->honeypot; ?>' ).val( '' );</script>
|
||||
|
||||
|
||||
<?php
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user