- reviewed #1212 and manually merged it into development/2.6.9;

This commit is contained in:
Mykyta Synelnikov
2023-07-25 13:22:22 +03:00
parent 2d5ab45c01
commit 886d418705
5 changed files with 185 additions and 85 deletions
+53 -24
View File
@@ -383,6 +383,32 @@ p.um-notice.warning a {
word-wrap: break-word;
}
.um-field-area-password {
position: relative;
}
.um-toggle-password {
cursor: pointer;
display: block;
position: absolute;
right: 0;
top: 0;
height: 100%;
width: 40px;
text-align: center;
box-sizing: border-box;
font-size: 20px;
line-height: 2;
}
.um-toggle-password i {
transition: all .2s linear;
}
.um-toggle-password:hover i {
color: #44b0ec;
}
.um-field-value p {
margin: 0 0 6px 0 !important;
padding: 0;
@@ -432,11 +458,11 @@ p.um-notice.warning a {
line-height: 1.7em;
}
.um-form input[type=text],
.um-form input[type=search],
.um-form input[type=tel],
.um-form input[type=number],
.um-form input[type=password] {
.um-form input[type="text"],
.um-form input[type="search"],
.um-form input[type="tel"],
.um-form input[type="number"],
.um-form input[type="password"] {
padding: 0 12px !important;
width: 100%;
display: block !important;
@@ -451,32 +477,35 @@ p.um-notice.warning a {
box-shadow: none !important;
margin: 0 !important;
position: static;
outline: none !important;
}
.um-form input[type=number] {
.um-form .um-field-area-password input[type="password"] {
padding-right: 40px !important;
}
.um-form input[type="number"] {
width: auto;
padding: 0 0 0 5px !important;
height: 30px !important;
}
.um-form input[type=text]:focus,
.um-form input[type=search]:focus,
.um-form input[type=tel]:focus,
.um-form input[type=number]:focus,
.um-form input[type=password]:focus,
.um-form input[type="text"]:focus,
.um-form input[type="search"]:focus,
.um-form input[type="tel"]:focus,
.um-form input[type="number"]:focus,
.um-form input[type="password"]:focus,
.um-form textarea:focus {
box-shadow: none !important;
outline: none !important;
}
.um-form input[type=text].um-iconed,
.um-form input[type=tel].um-iconed,
.um-form input[type=password].um-iconed { padding-left: 44px !important }
.um-form input[type="text"].um-iconed,
.um-form input[type="tel"].um-iconed,
.um-form input[type="password"].um-iconed { padding-left: 44px !important }
.um-form input[type=text].um-error,
.um-form input[type=tel].um-error,
.um-form input[type=password].um-error { border-color: #C74A4A !important }
.um-form input[type="text"].um-error,
.um-form input[type="tel"].um-error,
.um-form input[type="password"].um-error { border-color: #C74A4A !important }
.um-form textarea {
width: 100%;
@@ -633,15 +662,15 @@ p.um-notice.warning a {
.um div.disabled,
.um-disabled,
.um input[type=submit]:disabled,
.um input[type=text]:disabled,
.um input[type=number]:disabled {
.um input[type="submit"]:disabled,
.um input[type="text"]:disabled,
.um input[type="number"]:disabled {
opacity: 0.6 !important;
cursor: no-drop !important;
}
input[type=submit].um-button,
input[type=submit].um-button:focus {
input[type="submit"].um-button,
input[type="submit"].um-button:focus {
vertical-align: middle !important;
height: auto !important;
font-size: 15px;
@@ -656,7 +685,7 @@ input[type=submit].um-button:focus {
-webkit-appearance: none;
}
input[type=submit].um-button:hover {
input[type="submit"].um-button:hover {
opacity: 1;
}
+12
View File
@@ -713,4 +713,16 @@ jQuery(document).ready(function() {
}
}
jQuery( document.body ).on('click', '.um-toggle-password', function (){
let parent = jQuery(this).closest('.um-field-area-password');
let passwordField = parent.find('input');
let type = passwordField.attr('type');
if ( 'text' === type ) {
passwordField.attr('type', 'password');
parent.find('i').toggleClass('um-icon-eye um-icon-eye-disabled');
} else {
passwordField.attr('type', 'text');
parent.find('i').toggleClass('um-icon-eye um-icon-eye-disabled');
}
});
});
+1 -1
View File
File diff suppressed because one or more lines are too long
+28 -1
View File
@@ -2437,9 +2437,17 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
$field_name = $key . $form_suffix;
$field_value = $this->field_value( $key, $default, $data );
if ( UM()->options()->get( 'toggle_password' ) ) {
$output .= '<div class="um-field-area-password">
<input class="' . esc_attr( $this->get_class( $key, $data ) ) . '" type="' . esc_attr( $input ) . '" name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_name ) . '" value="' . esc_attr( $field_value ) . '" placeholder="' . esc_attr( $placeholder ) . '" data-validate="' . esc_attr( $validate ) . '" data-key="' . esc_attr( $key ) . '" />
<span class="um-toggle-password"><i class="um-icon-eye"></i></span>
</div>
</div>';
} else {
$output .= '<input class="' . esc_attr( $this->get_class( $key, $data ) ) . '" type="' . esc_attr( $input ) . '" name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_name ) . '" value="' . esc_attr( $field_value ) . '" placeholder="' . esc_attr( $placeholder ) . '" data-validate="' . esc_attr( $validate ) . '" data-key="' . esc_attr( $key ) . '" />
</div>';
}
if ( $this->is_error( $key ) ) {
$output .= $this->field_error( $this->show_error( $key ) );
@@ -2467,9 +2475,17 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
$field_name = $key . $form_suffix;
$field_value = $this->field_value( $key, $default, $data );
if ( UM()->options()->get( 'toggle_password' ) ) {
$output .= '<div class="um-field-area-password">
<input class="' . esc_attr( $this->get_class( $key, $data ) ) . '" type="' . esc_attr( $input ) . '" name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_name ) . '" value="' . esc_attr( $field_value ) . '" placeholder="' . esc_attr( $placeholder ) . '" data-validate="' . esc_attr( $validate ) . '" data-key="' . esc_attr( $key ) . '" />
<span class="um-toggle-password"><i class="um-icon-eye"></i></span>
</div>
</div>';
} else {
$output .= '<input class="' . esc_attr( $this->get_class( $key, $data ) ) . '" type="' . esc_attr( $input ) . '" name="' . esc_attr( $field_name ) . '" id="' . esc_attr( $field_name ) . '" value="' . esc_attr( $field_value ) . '" placeholder="' . esc_attr( $placeholder ) . '" data-validate="' . esc_attr( $validate ) . '" data-key="' . esc_attr( $key ) . '" />
</div>';
}
if ( $this->is_error( $key ) ) {
$output .= $this->field_error( $this->show_error( $key ) );
@@ -2507,10 +2523,17 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
}
$field_value = $this->field_value( $key, $default, $data );
if ( UM()->options()->get( 'toggle_password' ) ) {
$output .= '<div class="um-field-area-password">
<input class="' . esc_attr( $this->get_class( $key, $data ) ) . '" type="' . esc_attr( $input ) . '" name="' . esc_attr( $name ) . '" id="' . esc_attr( $key . $form_suffix ) . '" value="' . esc_attr( $field_value ) . '" placeholder="' . esc_attr( $placeholder ) . '" data-validate="' . esc_attr( $validate ) . '" data-key="' . esc_attr( $key ) . '" />
<span class="um-toggle-password"><i class="um-icon-eye"></i></span>
</div>
</div>';
} else {
$output .= '<input class="' . esc_attr( $this->get_class( $key, $data ) ) . '" type="' . esc_attr( $input ) . '" name="' . esc_attr( $name ) . '" id="' . esc_attr( $key . $form_suffix ) . '" value="' . esc_attr( $field_value ) . '" placeholder="' . esc_attr( $placeholder ) . '" data-validate="' . esc_attr( $validate ) . '" data-key="' . esc_attr( $key ) . '" />
</div>';
}
if ( $this->is_error( $key ) ) {
$output .= $this->field_error( $this->show_error( $key ) );
@@ -2555,7 +2578,11 @@ if ( ! class_exists( 'um\core\Fields' ) ) {
$placeholder = sprintf( __( 'Confirm %s', 'ultimate-member' ), $data['label'] );
}
if ( UM()->options()->get( 'toggle_password' ) ) {
$output .= '<div class="um-field-area-password"><input class="' . esc_attr( $this->get_class( $key, $data ) ) . '" type="' . esc_attr( $input ) . '" name="' . esc_attr( $name ) . '" id="' . esc_attr( $key . $form_suffix ) . '" value="' . esc_attr( $this->field_value( $key, $default, $data ) ) . '" placeholder="' . esc_attr( $placeholder ) . '" data-validate="' . esc_attr( $validate ) . '" data-key="' . esc_attr( $key ) . '" /><span class="um-toggle-password"><i class="um-icon-eye"></i></span></div>';
} else {
$output .= '<input class="' . esc_attr( $this->get_class( $key, $data ) ) . '" type="' . esc_attr( $input ) . '" name="' . esc_attr( $name ) . '" id="' . esc_attr( $key . $form_suffix ) . '" value="' . esc_attr( $this->field_value( $key, $default, $data ) ) . '" placeholder="' . esc_attr( $placeholder ) . '" data-validate="' . esc_attr( $validate ) . '" data-key="' . esc_attr( $key ) . '" />';
}
$output .= '</div>';
+56 -24
View File
@@ -1,8 +1,8 @@
<?php if ( ! defined( 'ABSPATH' ) ) {
<?php
if ( ! defined( 'ABSPATH' ) ) {
exit;
}
/**
* Validate for errors in account form
*
@@ -588,21 +588,26 @@ function um_after_account_privacy( $args ) {
<label>
<?php esc_html_e( 'Download your data', 'ultimate-member' ); ?>
</label>
<span class="um-tip um-tip-<?php echo is_rtl() ? 'e' : 'w' ?>" original-title="<?php esc_attr_e( 'You can request a file with the information that we believe is most relevant and useful to you.', 'ultimate-member' ); ?>">
<span class="um-tip um-tip-<?php echo is_rtl() ? 'e' : 'w'; ?>" title="<?php esc_attr_e( 'You can request a file with the information that we believe is most relevant and useful to you.', 'ultimate-member' ); ?>">
<i class="um-icon-help-circled"></i>
</span>
<div class="um-clear"></div>
</div>
<?php $completed = $wpdb->get_row(
<?php
$completed = $wpdb->get_row(
$wpdb->prepare(
"SELECT ID
FROM $wpdb->posts
WHERE post_author = $user_id AND
WHERE post_author = %d AND
post_type = 'user_request' AND
post_name = 'export_personal_data' AND
post_status = 'request-completed'
ORDER BY ID DESC
LIMIT 1",
ARRAY_A );
$user_id
),
ARRAY_A
);
if ( ! empty( $completed ) ) {
@@ -615,28 +620,39 @@ function um_after_account_privacy( $args ) {
}
$pending = $wpdb->get_row(
$wpdb->prepare(
"SELECT ID, post_status
FROM $wpdb->posts
WHERE post_author = $user_id AND
WHERE post_author = %d AND
post_type = 'user_request' AND
post_name = 'export_personal_data' AND
post_status != 'request-completed'
ORDER BY ID DESC
LIMIT 1",
ARRAY_A );
$user_id
),
ARRAY_A
);
if ( ! empty( $pending ) && $pending['post_status'] == 'request-pending' ) {
if ( ! empty( $pending ) && 'request-pending' === $pending['post_status'] ) {
echo '<p>' . esc_html__( 'A confirmation email has been sent to your email. Click the link within the email to confirm your export request.', 'ultimate-member' ) . '</p>';
} elseif ( ! empty( $pending ) && $pending['post_status'] == 'request-confirmed' ) {
} elseif ( ! empty( $pending ) && 'request-confirmed' === $pending['post_status'] ) {
echo '<p>' . esc_html__( 'The administrator has not yet approved downloading the data. Please expect an email with a link to your data.', 'ultimate-member' ) . '</p>';
} else {
if ( UM()->account()->current_password_is_required( 'privacy_download_data' ) ) { ?>
if ( UM()->account()->current_password_is_required( 'privacy_download_data' ) ) {
?>
<label name="um-export-data">
<?php esc_html_e( 'Enter your current password to confirm a new export of your personal data.', 'ultimate-member' ); ?>
</label>
<div class="um-field-area">
<input id="um-export-data" type="password" placeholder="<?php esc_attr_e( 'Password', 'ultimate-member' )?>">
<?php if ( UM()->options()->get( 'toggle_password' ) ) { ?>
<div class="um-field-area-password">
<input id="um-export-data" type="password" placeholder="<?php esc_attr_e( 'Password', 'ultimate-member' ); ?>">
<span class="um-toggle-password"><i class="um-icon-eye"></i></span>
</div>
<?php } else { ?>
<input id="um-export-data" type="password" placeholder="<?php esc_attr_e( 'Password', 'ultimate-member' ); ?>">
<?php } ?>
<div class="um-field-error um-export-data">
<span class="um-field-arrow"><i class="um-faicon-caret-up"></i></span><?php esc_html_e( 'You must enter a password', 'ultimate-member' ); ?>
</div>
@@ -664,22 +680,27 @@ function um_after_account_privacy( $args ) {
<label>
<?php esc_html_e( 'Erase of your data', 'ultimate-member' ); ?>
</label>
<span class="um-tip um-tip-<?php echo is_rtl() ? 'e' : 'w' ?>" original-title="<?php esc_attr_e( 'You can request erasing of the data that we have about you.', 'ultimate-member' ); ?>">
<span class="um-tip um-tip-<?php echo is_rtl() ? 'e' : 'w'; ?>" title="<?php esc_attr_e( 'You can request erasing of the data that we have about you.', 'ultimate-member' ); ?>">
<i class="um-icon-help-circled"></i>
</span>
<div class="um-clear"></div>
</div>
<?php $completed = $wpdb->get_row(
<?php
$completed = $wpdb->get_row(
$wpdb->prepare(
"SELECT ID
FROM $wpdb->posts
WHERE post_author = $user_id AND
WHERE post_author = %d AND
post_type = 'user_request' AND
post_name = 'remove_personal_data' AND
post_status = 'request-completed'
ORDER BY ID DESC
LIMIT 1",
ARRAY_A );
$user_id
),
ARRAY_A
);
if ( ! empty( $completed ) ) {
@@ -689,26 +710,37 @@ function um_after_account_privacy( $args ) {
}
$pending = $wpdb->get_row(
$wpdb->prepare(
"SELECT ID, post_status
FROM $wpdb->posts
WHERE post_author = $user_id AND
WHERE post_author = %d AND
post_type = 'user_request' AND
post_name = 'remove_personal_data' AND
post_status != 'request-completed'
ORDER BY ID DESC
LIMIT 1",
ARRAY_A );
$user_id
),
ARRAY_A
);
if ( ! empty( $pending ) && $pending['post_status'] == 'request-pending' ) {
if ( ! empty( $pending ) && 'request-pending' === $pending['post_status'] ) {
echo '<p>' . esc_html__( 'A confirmation email has been sent to your email. Click the link within the email to confirm your deletion request.', 'ultimate-member' ) . '</p>';
} elseif ( ! empty( $pending ) && $pending['post_status'] == 'request-confirmed' ) {
} elseif ( ! empty( $pending ) && 'request-confirmed' === $pending['post_status'] ) {
echo '<p>' . esc_html__( 'The administrator has not yet approved deleting your data. Please expect an email with a link to your data.', 'ultimate-member' ) . '</p>';
} else {
if ( UM()->account()->current_password_is_required( 'privacy_erase_data' ) ) { ?>
if ( UM()->account()->current_password_is_required( 'privacy_erase_data' ) ) {
?>
<label name="um-erase-data">
<?php esc_html_e( 'Enter your current password to confirm the erasure of your personal data.', 'ultimate-member' ); ?>
<input id="um-erase-data" type="password" placeholder="<?php esc_attr_e( 'Password', 'ultimate-member' )?>">
<?php if ( UM()->options()->get( 'toggle_password' ) ) { ?>
<div class="um-field-area-password">
<input id="um-erase-data" type="password" placeholder="<?php esc_attr_e( 'Password', 'ultimate-member' ); ?>">
<span class="um-toggle-password"><i class="um-icon-eye"></i></span>
</div>
<?php } else { ?>
<input id="um-erase-data" type="password" placeholder="<?php esc_attr_e( 'Password', 'ultimate-member' ); ?>">
<?php } ?>
<div class="um-field-error um-erase-data">
<span class="um-field-arrow"><i class="um-faicon-caret-up"></i></span><?php esc_html_e( 'You must enter a password', 'ultimate-member' ); ?>
</div>