Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix/dt login security fixes #2277

Merged
Prev Previous commit
Next Next commit
fix: style resetpass form correctly
  • Loading branch information
squigglybob committed Nov 28, 2023
commit d7fde789e410c467c9c6124e71a1c635be14fe1c
31 changes: 16 additions & 15 deletions dt-login/login-template.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,19 +170,22 @@
*/
do_action( 'validate_password_reset', $form_errors, $user );

if ( ( ! $form_errors->get_error_code() ) && isset( $_POST['pass1'] ) && !empty( $_POST['pass1'] ) ) {
reset_password( $user, $_POST['pass1'] );
setcookie( $rp_cookie, ' ', time() - YEAR_IN_SECONDS, $rp_path, COOKIE_DOMAIN, is_ssl(), true );
// @codingStandardsIgnoreEnd
if ( ( ! $form_errors->get_error_code() ) && isset( $_POST['pass1'] ) && !empty( $_POST['pass1'] ) ) {
reset_password( $user, $_POST['pass1'] );
setcookie( $rp_cookie, ' ', time() - YEAR_IN_SECONDS, $rp_path, COOKIE_DOMAIN, is_ssl(), true );
// @codingStandardsIgnoreEnd
?>
<div id="content">
<div id="login">
<div id="inner-content">
<div class="callout">
<div><?php echo sprintf( 'Your password is reset. %s You can login here %', '<a href="' . esc_url( dt_login_url( 'login' ) ) . '">', '</a>' ) ?></div>

<div id="content">
<div id="login">
<div id="inner-content">
<div class="callout">
<div><?php echo sprintf( 'Your password is reset. %s You can login here %s', '<a href="' . esc_url( dt_login_url( 'login' ) ) . '">', '</a>' ) ?></div>
</div>
</div>
</div>
</div>
</div>

<?php

exit;
Expand Down Expand Up @@ -211,7 +214,7 @@
<div id="inner-content">
<div class="callout">
<div class="center">
<h1 style="color:gray;font-size: 14px;margin:0;padding:5px;font-weight: normal;"><?php esc_html_e( 'Reset Password', 'disciple_tools' ) ?></h1>
<h1><?php esc_html_e( 'Reset Password', 'disciple_tools' ) ?></h1>
</div>
<?php if ( ! empty( $form_errors->errors ) ) :?>
<div class="alert callout">
Expand All @@ -221,7 +224,7 @@
</div>
<?php endif; ?>
<div class="wp_resetpassword_form">
<form name="resetpassform" id="resetpassform" action="<?php echo esc_url( dt_login_url( 'resetpass' ) ); ?>" method="post" autocomplete="off" data-abide novalidate>
<form class="flow" name="resetpassform" id="resetpassform" action="<?php echo esc_url( dt_login_url( 'resetpass' ) ); ?>" method="post" autocomplete="off" data-abide novalidate>
<input type="hidden" id="user_login" value="<?php echo esc_attr( $rp_login ); ?>" autocomplete="off" />

<div>
Expand All @@ -232,7 +235,7 @@
</span>
</label>
<meter max="4" id="password-strength-meter" value="0"></meter>
<p id="password-strength-text"></p>
<p id="password-strength-text"></p>
</div>
<p>
<label><?php esc_html_e( 'Re-enter Password', 'disciple_tools' ) ?> <strong>*</strong>
Expand All @@ -245,8 +248,6 @@


<p class="description indicator-hint"><?php echo esc_html( wp_get_password_hint() ); ?></p>
<br class="clear" />

<?php
/**
* Fires following the 'Strength indicator' meter in the user password reset form.
Expand Down
25 changes: 25 additions & 0 deletions dt-login/pages/base.php
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,9 @@ public function header_style(){
.center {
text-align: center;
}
.flow > * + * {
margin-top: var(--flow-space, 1rem);
}
label {
color: #0a0a0a;
display: block;
Expand Down Expand Up @@ -123,6 +126,28 @@ public function header_style(){
.login-username, .login-password {
width: 100%;
}
.form-error {
display: none;
font-size: .8rem;
font-weight: 700;
margin-bottom: 1.0666666667rem;
margin-top: -0.5333333333rem;
}

.form-error, .is-invalid-label {
color: #cc4b37;
}
.callout {
background-color: white;
border: ;
}
.calout.warning,
.callout.alert {
background-color: #f7e4e1;
color: #0a0a0a;
padding: 0.5rem 1rem;
border: 1px solid hsla(0,0%,4%,.25);
}
</style>

<?php
Expand Down
Loading