Login Page Accessibility (#3660)

Co-authored-by: Jordan Baudin <jord.baudin@gmail.com>
Co-authored-by: Léo Colombaro <LeoColomb@users.noreply.github.com>
This commit is contained in:
Jordan Baudin 2025-03-25 16:49:34 +01:00 committed by GitHub
parent 872e7894e6
commit b5e13d4fd9
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 37 additions and 31 deletions

View File

@ -203,7 +203,7 @@ td.actions .button_stats {
background:#efe; background:#efe;
} }
#login { #login {
width: 300px; max-width: 300px;
margin: 200px auto 0px auto; margin: 200px auto 0px auto;
} }
#login p{ #login p{

View File

@ -51,8 +51,11 @@ function yourls_html_head( $context = 'index', $title = '' ) {
$tablesorter = true; $tablesorter = true;
break; break;
case 'install':
case 'login': case 'login':
$_title_page = 'Login';
break;
case 'install':
case 'new': case 'new':
case 'upgrade': case 'upgrade':
break; break;
@ -75,6 +78,7 @@ function yourls_html_head( $context = 'index', $title = '' ) {
// Page title // Page title
$_title = 'YOURLS &mdash; Your Own URL Shortener | ' . yourls_link(); $_title = 'YOURLS &mdash; Your Own URL Shortener | ' . yourls_link();
$_title = $_title_page ? $_title_page . ' &mdash; ' . $_title : $_title;
$title = $title ? $title . " &laquo; " . $_title : $_title; $title = $title ? $title . " &laquo; " . $_title : $_title;
$title = yourls_apply_filter( 'html_title', $title, $context ); $title = yourls_apply_filter( 'html_title', $title, $context );
@ -746,35 +750,37 @@ function yourls_login_screen( $error_msg = '' ) {
yourls_html_logo(); yourls_html_logo();
?> ?>
<div id="login"> <main role="main">
<form method="post" action="<?php echo $action; ?>"> <?php // reset any QUERY parameters ?> <div id="login">
<?php <form method="post" action="<?php echo $action; ?>"> <?php // reset any QUERY parameters ?>
if( !empty( $error_msg ) ) { <?php
echo '<p class="error">'.$error_msg.'</p>'; if( !empty( $error_msg ) ) {
} echo '<p id="error-message" class="error">'.$error_msg.'</p>';
yourls_do_action( 'login_form_top' ); }
?> yourls_do_action( 'login_form_top' );
<p> ?>
<label for="username"><?php yourls_e( 'Username' ); ?></label><br /> <p>
<input type="text" id="username" name="username" size="30" class="text" /> <label for="username"><?php yourls_e( 'Username' ); ?></label><br />
</p> <input type="text" id="username" aria-describedby="error-message" name="username" class="text" autocomplete="username" />
<p> </p>
<label for="password"><?php yourls_e( 'Password' ); ?></label><br /> <p>
<input type="password" id="password" name="password" size="30" class="text" /> <label for="password"><?php yourls_e( 'Password' ); ?></label><br />
</p> <input type="password" id="password" name="password" class="text" autocomplete="current-password" />
<?php </p>
yourls_do_action( 'login_form_bottom' ); <?php
?> yourls_do_action( 'login_form_bottom' );
<p style="text-align: right;"> ?>
<?php yourls_nonce_field('admin_login'); ?> <p style="text-align: right;">
<input type="submit" id="submit" name="submit" value="<?php yourls_e( 'Login' ); ?>" class="button" /> <?php yourls_nonce_field('admin_login'); ?>
</p> <input type="submit" id="submit" name="submit" value="<?php yourls_e( 'Login' ); ?>" class="button" />
<?php </p>
yourls_do_action( 'login_form_end' ); <?php
?> yourls_do_action( 'login_form_end' );
</form> ?>
<script type="text/javascript">$('#username').focus();</script> </form>
</div> <script type="text/javascript">$('#username').focus();</script>
</div>
</main>
<?php <?php
yourls_html_footer(); yourls_html_footer();
die(); die();