Commit 5207eb21 authored by Dave Lane's avatar Dave Lane

fixing duplicate change - merging

parents f835fe54 93e916cf
......@@ -186,7 +186,7 @@ article.ore-form .container .entry-content > div.ore {
}
#ore-container .modal-dialog .modal-header button.close {
/*margin: -10px -15px 0 0;*/
margin: 0px -15px 0 0;
margin: -10px -15px 0 0;
padding: 0;
width: 16px;
height: 16px;
......@@ -292,9 +292,12 @@ button.ore-processing {
text-align: left;
}
#ore-error-wrapper h2 {
color: #555;
margin-top: 0.2em;
margin-bottom: 0.2em;
color: #000;
font-size: 20px;
margin-top: 20px;
margin-bottom: .2em;
border-bottom: none;
line-height: 1.15em;
}
#ore-error-wrapper ol {
list-style: decimal;
......@@ -302,6 +305,7 @@ button.ore-processing {
}
#ore-error-wrapper li {
display: block;
color: red;
list-style: decimal;
list-style-type: decimal;
}
......
......@@ -224,16 +224,16 @@ class OREMain extends OREBase {
$errors = $this->get_errors();
// ensure we have valid credentials from with which to find the relevant user account
if (empty($_POST['credential']) || !is_string($_POST['credential'])) {
//$this->log('missing the credential');
$this->log('missing the credential');
$errors->add(ORE_ERROR_LABEL, 'You must enter a username or email address.');
} elseif (strpos($_POST['credential'], '@')) {
//$this->log('got an email: '.$_POST['credential']);
$this->log('got an email: '.$_POST['credential']);
$user_data = get_user_by('email', trim(wp_unslash($_POST['credential'])));
if (empty($user_data)) {
//$this->log('no user found');
$this->log('no user found');
$errors->add(ORE_ERROR_LABEL, 'There is no user registered with that email address.');
} else {
//$this->log('found user id: '.$user_data->ID);
$this->log('found user id: '.$user_data->ID);
}
} else {
$login = trim($_POST['credential']);
......@@ -253,6 +253,9 @@ class OREMain extends OREBase {
$user_login = $user_data->user_login;
$user_email = $user_data->user_email;
$key = get_password_reset_key($user_data);
$from = get_option("admin_email", ORE_DEFAULT_FROM_EMAIL);
//$from = ORE_DEFAULT_FROM_EMAIL;
$this->log('from = '.$from);
if (is_wp_error($key)) {
return $key;
}
......@@ -275,8 +278,12 @@ class OREMain extends OREBase {
$title = sprintf( __( '[%s] Password Reset' ), $site_name );
// apply the filter for password retrieval
$title = apply_filters( 'retrieve_password_title', $title, $user_login, $user_data );
if ($message && !wp_mail($user_email, wp_specialchars_decode($title), $message)) {
wp_die(__('The email could not be sent.')."<br />\n".__('Possible reason: your host may have disabled the mail() function.'));
$headers = array("From: OERu Course Admin <".$from.">");
if ($message && !wp_mail($user_email, wp_specialchars_decode($title), $message, $headers)) {
$this->log('sending email via wp_email failed with email '.$user_email.', title '.wp_specialchars_decode($title).', and message '.$message.'... and headers: '.print_r($headers, true));
$errors->add(ORE_ERROR_LABEL, 'The site failed to send an email. This is either because the email is invalid, or because this site is having difficulty sending email. To report this, you can <a href="https://oeru.org/contact-us">contact us</a>.');
//wp_die(__('The email could not be sent.')."<br />\n".__('Possible reason: your host may have disabled the mail() function.'));
return $errors;
}
return true;
}
......
......@@ -77,7 +77,12 @@ static $modals = array(
'markup' => '<p>If you have forgotten your password, you can request a reset. We need to know <em>one</em> of the following: (1) the email address you used to register, or (2) your username.</p>'.
'<div class="form-group">'.
'<label for="credential">Enter your Username or Email to identify yourself.</label>'.
<<<<<<< HEAD
'<input type="text" class="form-control" id="credential" name="credential" placeholder="username or user@email" value="{email}" aria-describedby="helpCredential">'.
=======
'<div id="ore-error-wrapper"></div>'.
'<input type="text" class="form-control" id="credential" name="credential" placeholder="username or user@email" value="{username}{email}" aria-describedby="helpCredential">'.
>>>>>>> 93e916cf3580e1693d4494a2240eed63c4c9b827
'<span id="helpCredential" class="help-block">Either is acceptable, because both uniquely identify you in this system.</span>'.
'</div>',
'default' => array(
......@@ -107,7 +112,8 @@ static $modals = array(
'purpose' => 'confirmation',
'markup' => '<p>We were not able to find a user with the details you have entered in our system.</p>'.
'<p>Please check that you have typed in your chosen identifier - your username or email - correctly.</p>'.
'<p>If it\'s possible you haven\'t previously registered an account with us, you can do that now.</p>',
'<p>If it\'s possible you haven\'t previously registered an account with us, you can do that now.</p>'.
'<div id="ore-error-wrapper"></div>',
'default' => array(
'label' => 'Try again',
'class' => 'submit',
......
......@@ -74,6 +74,7 @@ define('LOG_STREAM', getenv('LOG_STREAM'));
define('ORE_MIN_PASSWORD_LENGTH', 8);
define('ORE_MIN_USERNAME_LENGTH', 4);
define('ORE_MIN_DISPLAY_NAME_LENGTH', 6);
define('ORE_DEFAULT_FROM_EMAIL', 'webmaster@oerfoundation.org');
// include the dependencies
require ORE_PATH . 'includes/ore_app.php';
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment