Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Captcha: implement refresh functionality

Modified signup page, added jQuery and CSS to allow users to generate a
new captcha in case the previous one is not readable.

Fixes #16567
  • Loading branch information...
commit 0a1e54fdda45e6acb98d594461396e3b6b5f9451 1 parent 7773a5c
@dregad dregad authored
View
26 css/login.css
@@ -24,24 +24,36 @@ span#no-password-msg, #signup-info, #lost-password-msg {
display: block;
padding: 1em;
}
+#login-links,
+#captcha-refresh {
+ list-style: none;
+ margin: 0em;
+ padding: 0em;
+}
#login-links {
position: absolute;
top: .5em;
right: 0em;
- list-style: none;
- margin: 0em;
- padding: 0em;
}
-#login-links li {
+#login-links li,
+#captcha-refresh li {
float: left;
padding: 0em .25em;
}
-#login-links li:before {
+#login-links li:before,
+#captcha-refresh li:before {
content: '[';
}
-#login-links li:after {
+#login-links li:after,
+#captcha-refresh li:after {
content: ']';
}
-#login-links li a {
+#login-links li a,
+#captcha-refresh li a {
padding: 0em .35em;
}
+
+#captcha-image {
+ cursor: pointer;
+ padding-right:3px;
+}
View
30 javascript/login.js
@@ -0,0 +1,30 @@
+/*
+# Mantis - a php based bugtracking system
+
+# Copyright 2000 - 2002 Kenzaburo Ito - kenito@300baud.org
+# Copyright 2002 MantisBT Team - mantisbt-dev@lists.sourceforge.net
+
+# Mantis is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 2 of the License, or
+# (at your option) any later version.
+#
+# Mantis is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with Mantis. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+$(document).ready( function() {
+ // Captcha refresh
+ $('#captcha-image, #captcha-refresh li a').click( function(e) {
+ var img = $('#captcha-image img');
+ var captcha = img.attr('src');
+ img.attr('src', captcha.split('?', 1) + '?' + Math.random());
+ $('#captcha-field').focus();
+ e.preventDefault();
+ });
+});
View
1  lang/strings_english.txt
@@ -1112,6 +1112,7 @@ $s_no_reponse_msg = 'You will have seven days to complete the account confirmati
# signup_page.php
$s_signup_captcha_request_label = 'Enter the code as it is shown in the box on the right:';
+$s_signup_captcha_refresh = 'Generate a new code';
$s_signup_info = 'On completion of this form and verification of your answers, you will be sent a confirmation e-mail to the e-mail address you specified.<br />Using the confirmation e-mail, you will be able to activate your account. If you fail to activate your account within seven days, it will be purged.<br />You must specify a valid e-mail address in order to receive the account confirmation e-mail.';
$s_signup_title = 'Signup';
$s_signup_button = 'Signup';
View
16 signup_page.php
@@ -43,8 +43,11 @@
require_api( 'lang_api.php' );
require_api( 'print_api.php' );
require_api( 'utility_api.php' );
+
require_css( 'login.css' );
+require_js( 'login.js' );
+
# Check for invalid access to signup page
if ( OFF == config_get_global( 'allow_signup' ) || LDAP == config_get_global( 'login_method' ) ) {
print_header_redirect( 'login_page.php' );
@@ -114,12 +117,17 @@
?></span></label>
<span id="captcha-input" class="input">
<?php print_captcha_input( 'captcha' ); ?>
- <span class="captcha-image">
- <img src="<? echo $t_securimage_show; ?>" alt="visual captcha" />
+
+ <span id="captcha-image" class="captcha-image" style="padding-right:3px;">
+ <img src="<?php echo $t_securimage_show; ?>" alt="visual captcha" />
+ <ul id="captcha-refresh"><li><a href="#"><?php
+ echo lang_get( 'signup_captcha_refresh' );
+ ?></a></li></ul>
</span>
+
<object type="application/x-shockwave-flash" width="19" height="19"
- data="<? echo $t_securimage_play; ?>">
- <param name="movie" value="<? echo $t_securimage_play; ?>" />
+ data="<?php echo $t_securimage_play; ?>">
+ <param name="movie" value="<?php echo $t_securimage_play; ?>" />
</object>
</span>
Please sign in to comment.
Something went wrong with that request. Please try again.