Skip to content

Commit

Permalink
Default username on lost password page
Browse files Browse the repository at this point in the history
  • Loading branch information
vboctor committed Apr 16, 2017
1 parent 674363f commit 1d1c9ad
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 3 deletions.
2 changes: 1 addition & 1 deletion login_password_page.php
Expand Up @@ -257,7 +257,7 @@ class="form-control autofocus">
<?php
# lost password feature disabled or reset password via email disabled -> stop here!
if( $t_show_reset_password ) {
echo '<a class="pull-right" href="lost_pwd_page.php">', lang_get( 'lost_password_link' ), '</a>';
echo '<a class="pull-right" href="lost_pwd_page.php?username=', urlencode( $t_username ), '">', lang_get( 'lost_password_link' ), '</a>';
}
?>
</fieldset>
Expand Down
16 changes: 14 additions & 2 deletions lost_pwd_page.php
Expand Up @@ -51,6 +51,17 @@
trigger_error( ERROR_LOST_PASSWORD_NOT_ENABLED, ERROR );
}

$f_username = gpc_get_string( 'username', '' );
$t_username = auth_prepare_username( $f_username );

# Determine whether the username or password field should receive automatic focus.
$t_username_field_autofocus = 'autofocus';
$t_email_field_autofocus = '';
if( $t_username ) {
$t_username_field_autofocus = '';
$t_email_field_autofocus = 'autofocus';
}

# don't index lost password page
html_robots_noindex();

Expand Down Expand Up @@ -86,15 +97,16 @@
<span class="block input-icon input-icon-right">
<input id="username" name="username" type="text"
placeholder="<?php echo lang_get( 'username' ) ?>"
size="32" maxlength="<?php echo DB_FIELD_SIZE_USERNAME;?>" class="form-control autofocus">
value="<?php echo string_html_specialchars( $t_username ) ?>"
size="32" maxlength="<?php echo DB_FIELD_SIZE_USERNAME;?>" class="form-control <?php echo $t_username_field_autofocus ?>">
<i class="ace-icon fa fa-user"></i>
</span>
</label>
<label for="email-field" class="block clearfix">
<span class="block input-icon input-icon-right">
<input id="email-field" name="email" type="text"
placeholder="<?php echo lang_get( 'email' ) ?>"
size="32" maxlength="64" class="form-control">
size="32" maxlength="64" class="form-control <?php echo $t_email_field_autofocus; ?>">
<i class="ace-icon fa fa-envelope"></i>
</span>
</label>
Expand Down

0 comments on commit 1d1c9ad

Please sign in to comment.