Fossil SCM

Put the "speak the text" buttons for captcha audio closer to the boxes in which the person must enter the text.

drh 2020-03-14 13:36 trunk
Commit a584491ab87691cb1774e3ab9dc1cb760a85bdd3130d64565998e3e3f9e23e5e
3 files changed +3 -3 +4 -3 +13 -8
+3 -3
--- src/alerts.c
+++ src/alerts.c
@@ -1392,10 +1392,11 @@
13921392
zDecoded = captcha_decode(uSeed);
13931393
zCaptcha = captcha_render(zDecoded);
13941394
@ <tr>
13951395
@ <td class="form_label">Security Code:</td>
13961396
@ <td><input type="text" name="captcha" value="" size="30">
1397
+ captcha_speakit_button(uSeed, "Speak the code");
13971398
@ <input type="hidden" name="captchaseed" value="%u(uSeed)"></td>
13981399
@ </tr>
13991400
if( eErr==2 ){
14001401
@ <tr><td><td><span class='loginError'>&uarr; %h(zErr)</span></td></tr>
14011402
}
@@ -1462,11 +1463,10 @@
14621463
if( needCaptcha ){
14631464
@ <div class="captcha"><table class="captcha"><tr><td><pre class="captcha">
14641465
@ %h(zCaptcha)
14651466
@ </pre>
14661467
@ Enter the 8 characters above in the "Security Code" box<br/>
1467
- captcha_speakit_button(uSeed);
14681468
@ </td></tr></table></div>
14691469
}
14701470
@ </form>
14711471
fossil_free(zErr);
14721472
style_footer();
@@ -1856,10 +1856,11 @@
18561856
zDecoded = captcha_decode(uSeed);
18571857
zCaptcha = captcha_render(zDecoded);
18581858
@ <tr>
18591859
@ <td class="form_label">Security Code:</td>
18601860
@ <td><input type="text" name="captcha" value="" size="30">
1861
+ captcha_speakit_button(uSeed, "Speak the code");
18611862
@ <input type="hidden" name="captchaseed" value="%u(uSeed)"></td>
18621863
if( eErr==2 ){
18631864
@ <td><span class="loginError">&larr; %h(zErr)</span></td>
18641865
}
18651866
@ </tr>
@@ -1876,11 +1877,10 @@
18761877
@ </table>
18771878
@ <div class="captcha"><table class="captcha"><tr><td><pre class="captcha">
18781879
@ %h(zCaptcha)
18791880
@ </pre>
18801881
@ Enter the 8 characters above in the "Security Code" box<br/>
1881
- captcha_speakit_button(uSeed);
18821882
@ </td></tr></table></div>
18831883
@ </form>
18841884
fossil_free(zErr);
18851885
style_footer();
18861886
}
@@ -2596,10 +2596,11 @@
25962596
@ <table class="subscribe">
25972597
if( zCaptcha ){
25982598
@ <tr>
25992599
@ <td class="form_label">Security&nbsp;Code:</td>
26002600
@ <td><input type="text" name="captcha" value="" size="10">
2601
+ captcha_speakit_button(uSeed, "Speak the code");
26012602
@ <input type="hidden" name="captchaseed" value="%u(uSeed)"></td>
26022603
@ </tr>
26032604
}
26042605
@ <tr>
26052606
@ <td class="form_label">Your&nbsp;Email&nbsp;Address:</td>
@@ -2623,11 +2624,10 @@
26232624
if( zCaptcha ){
26242625
@ <div class="captcha"><table class="captcha"><tr><td><pre class="captcha">
26252626
@ %h(zCaptcha)
26262627
@ </pre>
26272628
@ Enter the 8 characters above in the "Security Code" box<br/>
2628
- captcha_speakit_button(uSeed);
26292629
@ </td></tr></table></div>
26302630
}
26312631
@ </form>
26322632
style_footer();
26332633
}
26342634
--- src/alerts.c
+++ src/alerts.c
@@ -1392,10 +1392,11 @@
1392 zDecoded = captcha_decode(uSeed);
1393 zCaptcha = captcha_render(zDecoded);
1394 @ <tr>
1395 @ <td class="form_label">Security Code:</td>
1396 @ <td><input type="text" name="captcha" value="" size="30">
 
1397 @ <input type="hidden" name="captchaseed" value="%u(uSeed)"></td>
1398 @ </tr>
1399 if( eErr==2 ){
1400 @ <tr><td><td><span class='loginError'>&uarr; %h(zErr)</span></td></tr>
1401 }
@@ -1462,11 +1463,10 @@
1462 if( needCaptcha ){
1463 @ <div class="captcha"><table class="captcha"><tr><td><pre class="captcha">
1464 @ %h(zCaptcha)
1465 @ </pre>
1466 @ Enter the 8 characters above in the "Security Code" box<br/>
1467 captcha_speakit_button(uSeed);
1468 @ </td></tr></table></div>
1469 }
1470 @ </form>
1471 fossil_free(zErr);
1472 style_footer();
@@ -1856,10 +1856,11 @@
1856 zDecoded = captcha_decode(uSeed);
1857 zCaptcha = captcha_render(zDecoded);
1858 @ <tr>
1859 @ <td class="form_label">Security Code:</td>
1860 @ <td><input type="text" name="captcha" value="" size="30">
 
1861 @ <input type="hidden" name="captchaseed" value="%u(uSeed)"></td>
1862 if( eErr==2 ){
1863 @ <td><span class="loginError">&larr; %h(zErr)</span></td>
1864 }
1865 @ </tr>
@@ -1876,11 +1877,10 @@
1876 @ </table>
1877 @ <div class="captcha"><table class="captcha"><tr><td><pre class="captcha">
1878 @ %h(zCaptcha)
1879 @ </pre>
1880 @ Enter the 8 characters above in the "Security Code" box<br/>
1881 captcha_speakit_button(uSeed);
1882 @ </td></tr></table></div>
1883 @ </form>
1884 fossil_free(zErr);
1885 style_footer();
1886 }
@@ -2596,10 +2596,11 @@
2596 @ <table class="subscribe">
2597 if( zCaptcha ){
2598 @ <tr>
2599 @ <td class="form_label">Security&nbsp;Code:</td>
2600 @ <td><input type="text" name="captcha" value="" size="10">
 
2601 @ <input type="hidden" name="captchaseed" value="%u(uSeed)"></td>
2602 @ </tr>
2603 }
2604 @ <tr>
2605 @ <td class="form_label">Your&nbsp;Email&nbsp;Address:</td>
@@ -2623,11 +2624,10 @@
2623 if( zCaptcha ){
2624 @ <div class="captcha"><table class="captcha"><tr><td><pre class="captcha">
2625 @ %h(zCaptcha)
2626 @ </pre>
2627 @ Enter the 8 characters above in the "Security Code" box<br/>
2628 captcha_speakit_button(uSeed);
2629 @ </td></tr></table></div>
2630 }
2631 @ </form>
2632 style_footer();
2633 }
2634
--- src/alerts.c
+++ src/alerts.c
@@ -1392,10 +1392,11 @@
1392 zDecoded = captcha_decode(uSeed);
1393 zCaptcha = captcha_render(zDecoded);
1394 @ <tr>
1395 @ <td class="form_label">Security Code:</td>
1396 @ <td><input type="text" name="captcha" value="" size="30">
1397 captcha_speakit_button(uSeed, "Speak the code");
1398 @ <input type="hidden" name="captchaseed" value="%u(uSeed)"></td>
1399 @ </tr>
1400 if( eErr==2 ){
1401 @ <tr><td><td><span class='loginError'>&uarr; %h(zErr)</span></td></tr>
1402 }
@@ -1462,11 +1463,10 @@
1463 if( needCaptcha ){
1464 @ <div class="captcha"><table class="captcha"><tr><td><pre class="captcha">
1465 @ %h(zCaptcha)
1466 @ </pre>
1467 @ Enter the 8 characters above in the "Security Code" box<br/>
 
1468 @ </td></tr></table></div>
1469 }
1470 @ </form>
1471 fossil_free(zErr);
1472 style_footer();
@@ -1856,10 +1856,11 @@
1856 zDecoded = captcha_decode(uSeed);
1857 zCaptcha = captcha_render(zDecoded);
1858 @ <tr>
1859 @ <td class="form_label">Security Code:</td>
1860 @ <td><input type="text" name="captcha" value="" size="30">
1861 captcha_speakit_button(uSeed, "Speak the code");
1862 @ <input type="hidden" name="captchaseed" value="%u(uSeed)"></td>
1863 if( eErr==2 ){
1864 @ <td><span class="loginError">&larr; %h(zErr)</span></td>
1865 }
1866 @ </tr>
@@ -1876,11 +1877,10 @@
1877 @ </table>
1878 @ <div class="captcha"><table class="captcha"><tr><td><pre class="captcha">
1879 @ %h(zCaptcha)
1880 @ </pre>
1881 @ Enter the 8 characters above in the "Security Code" box<br/>
 
1882 @ </td></tr></table></div>
1883 @ </form>
1884 fossil_free(zErr);
1885 style_footer();
1886 }
@@ -2596,10 +2596,11 @@
2596 @ <table class="subscribe">
2597 if( zCaptcha ){
2598 @ <tr>
2599 @ <td class="form_label">Security&nbsp;Code:</td>
2600 @ <td><input type="text" name="captcha" value="" size="10">
2601 captcha_speakit_button(uSeed, "Speak the code");
2602 @ <input type="hidden" name="captchaseed" value="%u(uSeed)"></td>
2603 @ </tr>
2604 }
2605 @ <tr>
2606 @ <td class="form_label">Your&nbsp;Email&nbsp;Address:</td>
@@ -2623,11 +2624,10 @@
2624 if( zCaptcha ){
2625 @ <div class="captcha"><table class="captcha"><tr><td><pre class="captcha">
2626 @ %h(zCaptcha)
2627 @ </pre>
2628 @ Enter the 8 characters above in the "Security Code" box<br/>
 
2629 @ </td></tr></table></div>
2630 }
2631 @ </form>
2632 style_footer();
2633 }
2634
+4 -3
--- src/captcha.c
+++ src/captcha.c
@@ -549,19 +549,20 @@
549549
@ <input type="text" name="captcha" size=8 />
550550
if( showButton ){
551551
@ <input type="submit" value="Submit">
552552
}
553553
@ <br/>\
554
- captcha_speakit_button(uSeed);
554
+ captcha_speakit_button(uSeed, 0);
555555
@ </td></tr></table></div>
556556
}
557557
558558
/*
559559
** Add a "Speak the captcha" button.
560560
*/
561
-void captcha_speakit_button(unsigned int uSeed){
562
- @ <input type="button" value="Speak the text" id="speakthetext">
561
+void captcha_speakit_button(unsigned int uSeed, const char *zMsg){
562
+ if( zMsg==0 ) zMsg = "Speak the text";
563
+ @ <input type="button" value="%h(zMsg)" id="speakthetext">
563564
@ <audio id="spokencaptcha" src="%R/captcha-audio/%u(uSeed)" />
564565
@ <script nonce="%h(style_nonce())">
565566
@ var x = document.getElementById("speakthetext")
566567
@ x.onclick = function(){
567568
@ var audio = document.getElementById("spokencaptcha");
568569
--- src/captcha.c
+++ src/captcha.c
@@ -549,19 +549,20 @@
549 @ <input type="text" name="captcha" size=8 />
550 if( showButton ){
551 @ <input type="submit" value="Submit">
552 }
553 @ <br/>\
554 captcha_speakit_button(uSeed);
555 @ </td></tr></table></div>
556 }
557
558 /*
559 ** Add a "Speak the captcha" button.
560 */
561 void captcha_speakit_button(unsigned int uSeed){
562 @ <input type="button" value="Speak the text" id="speakthetext">
 
563 @ <audio id="spokencaptcha" src="%R/captcha-audio/%u(uSeed)" />
564 @ <script nonce="%h(style_nonce())">
565 @ var x = document.getElementById("speakthetext")
566 @ x.onclick = function(){
567 @ var audio = document.getElementById("spokencaptcha");
568
--- src/captcha.c
+++ src/captcha.c
@@ -549,19 +549,20 @@
549 @ <input type="text" name="captcha" size=8 />
550 if( showButton ){
551 @ <input type="submit" value="Submit">
552 }
553 @ <br/>\
554 captcha_speakit_button(uSeed, 0);
555 @ </td></tr></table></div>
556 }
557
558 /*
559 ** Add a "Speak the captcha" button.
560 */
561 void captcha_speakit_button(unsigned int uSeed, const char *zMsg){
562 if( zMsg==0 ) zMsg = "Speak the text";
563 @ <input type="button" value="%h(zMsg)" id="speakthetext">
564 @ <audio id="spokencaptcha" src="%R/captcha-audio/%u(uSeed)" />
565 @ <script nonce="%h(style_nonce())">
566 @ var x = document.getElementById("speakthetext")
567 @ x.onclick = function(){
568 @ var audio = document.getElementById("spokencaptcha");
569
+13 -8
--- src/login.c
+++ src/login.c
@@ -702,10 +702,18 @@
702702
if( g.zLogin ){
703703
@ <p>Currently logged in as <b>%h(g.zLogin)</b>.
704704
@ <input type="submit" name="out" value="Logout"></p>
705705
@ </form>
706706
}else{
707
+ unsigned int uSeed = captcha_seed();
708
+ if( g.zLogin==0 && (anonFlag || zGoto==0) ){
709
+ zAnonPw = db_text(0, "SELECT pw FROM user"
710
+ " WHERE login='anonymous'"
711
+ " AND cap!=''");
712
+ }else{
713
+ zAnonPw = 0;
714
+ }
707715
@ <table class="login_out">
708716
@ <tr>
709717
@ <td class="form_label">User ID:</td>
710718
if( anonFlag ){
711719
@ <td><input type="text" id="u" name="u" value="anonymous" size="30"></td>
@@ -713,11 +721,15 @@
713721
@ <td><input type="text" id="u" name="u" value="" size="30" /></td>
714722
}
715723
@ </tr>
716724
@ <tr>
717725
@ <td class="form_label">Password:</td>
718
- @ <td><input type="password" id="p" name="p" value="" size="30" /></td>
726
+ @ <td><input type="password" id="p" name="p" value="" size="30" />\
727
+ if( zAnonPw && !noAnon ){
728
+ captcha_speakit_button(uSeed, "Speak password for \"anonymous\"");
729
+ }
730
+ @ </td>
719731
@ </tr>
720732
if( P("HTTPS")==0 ){
721733
@ <tr><td class="form_label">Warning:</td>
722734
@ <td><span class='securityWarning'>
723735
@ Your password will be sent in the clear over an
@@ -728,15 +740,10 @@
728740
@ Consider logging in at
729741
@ <a href='%s(g.zHttpsURL)'>%h(g.zHttpsURL)</a> instead.
730742
}
731743
@ </span></td></tr>
732744
}
733
- if( g.zLogin==0 && (anonFlag || zGoto==0) ){
734
- zAnonPw = db_text(0, "SELECT pw FROM user"
735
- " WHERE login='anonymous'"
736
- " AND cap!=''");
737
- }
738745
@ <tr>
739746
@ <td></td>
740747
@ <td><input type="submit" name="in" value="Login"></td>
741748
@ </tr>
742749
if( !noAnon && login_self_register_available(0) ){
@@ -745,11 +752,10 @@
745752
@ <td><input type="submit" name="self" value="Create A New Account">
746753
@ </tr>
747754
}
748755
@ </table>
749756
if( zAnonPw && !noAnon ){
750
- unsigned int uSeed = captcha_seed();
751757
const char *zDecoded = captcha_decode(uSeed);
752758
int bAutoCaptcha = db_get_boolean("auto-captcha", 0);
753759
char *zCaptcha = captcha_render(zDecoded);
754760
755761
@ <p><input type="hidden" name="cs" value="%u(uSeed)" />
@@ -757,11 +763,10 @@
757763
@ the 8-character hexadecimal password shown below:</p>
758764
@ <div class="captcha"><table class="captcha"><tr><td>\
759765
@ <pre class="captcha">
760766
@ %h(zCaptcha)
761767
@ </pre></td></tr></table>
762
- captcha_speakit_button(uSeed);
763768
if( bAutoCaptcha ) {
764769
@ <input type="button" value="Fill out captcha" id='autofillButton' \
765770
@ data-af='%s(zDecoded)' />
766771
style_load_one_js_file("login.js");
767772
}
768773
--- src/login.c
+++ src/login.c
@@ -702,10 +702,18 @@
702 if( g.zLogin ){
703 @ <p>Currently logged in as <b>%h(g.zLogin)</b>.
704 @ <input type="submit" name="out" value="Logout"></p>
705 @ </form>
706 }else{
 
 
 
 
 
 
 
 
707 @ <table class="login_out">
708 @ <tr>
709 @ <td class="form_label">User ID:</td>
710 if( anonFlag ){
711 @ <td><input type="text" id="u" name="u" value="anonymous" size="30"></td>
@@ -713,11 +721,15 @@
713 @ <td><input type="text" id="u" name="u" value="" size="30" /></td>
714 }
715 @ </tr>
716 @ <tr>
717 @ <td class="form_label">Password:</td>
718 @ <td><input type="password" id="p" name="p" value="" size="30" /></td>
 
 
 
 
719 @ </tr>
720 if( P("HTTPS")==0 ){
721 @ <tr><td class="form_label">Warning:</td>
722 @ <td><span class='securityWarning'>
723 @ Your password will be sent in the clear over an
@@ -728,15 +740,10 @@
728 @ Consider logging in at
729 @ <a href='%s(g.zHttpsURL)'>%h(g.zHttpsURL)</a> instead.
730 }
731 @ </span></td></tr>
732 }
733 if( g.zLogin==0 && (anonFlag || zGoto==0) ){
734 zAnonPw = db_text(0, "SELECT pw FROM user"
735 " WHERE login='anonymous'"
736 " AND cap!=''");
737 }
738 @ <tr>
739 @ <td></td>
740 @ <td><input type="submit" name="in" value="Login"></td>
741 @ </tr>
742 if( !noAnon && login_self_register_available(0) ){
@@ -745,11 +752,10 @@
745 @ <td><input type="submit" name="self" value="Create A New Account">
746 @ </tr>
747 }
748 @ </table>
749 if( zAnonPw && !noAnon ){
750 unsigned int uSeed = captcha_seed();
751 const char *zDecoded = captcha_decode(uSeed);
752 int bAutoCaptcha = db_get_boolean("auto-captcha", 0);
753 char *zCaptcha = captcha_render(zDecoded);
754
755 @ <p><input type="hidden" name="cs" value="%u(uSeed)" />
@@ -757,11 +763,10 @@
757 @ the 8-character hexadecimal password shown below:</p>
758 @ <div class="captcha"><table class="captcha"><tr><td>\
759 @ <pre class="captcha">
760 @ %h(zCaptcha)
761 @ </pre></td></tr></table>
762 captcha_speakit_button(uSeed);
763 if( bAutoCaptcha ) {
764 @ <input type="button" value="Fill out captcha" id='autofillButton' \
765 @ data-af='%s(zDecoded)' />
766 style_load_one_js_file("login.js");
767 }
768
--- src/login.c
+++ src/login.c
@@ -702,10 +702,18 @@
702 if( g.zLogin ){
703 @ <p>Currently logged in as <b>%h(g.zLogin)</b>.
704 @ <input type="submit" name="out" value="Logout"></p>
705 @ </form>
706 }else{
707 unsigned int uSeed = captcha_seed();
708 if( g.zLogin==0 && (anonFlag || zGoto==0) ){
709 zAnonPw = db_text(0, "SELECT pw FROM user"
710 " WHERE login='anonymous'"
711 " AND cap!=''");
712 }else{
713 zAnonPw = 0;
714 }
715 @ <table class="login_out">
716 @ <tr>
717 @ <td class="form_label">User ID:</td>
718 if( anonFlag ){
719 @ <td><input type="text" id="u" name="u" value="anonymous" size="30"></td>
@@ -713,11 +721,15 @@
721 @ <td><input type="text" id="u" name="u" value="" size="30" /></td>
722 }
723 @ </tr>
724 @ <tr>
725 @ <td class="form_label">Password:</td>
726 @ <td><input type="password" id="p" name="p" value="" size="30" />\
727 if( zAnonPw && !noAnon ){
728 captcha_speakit_button(uSeed, "Speak password for \"anonymous\"");
729 }
730 @ </td>
731 @ </tr>
732 if( P("HTTPS")==0 ){
733 @ <tr><td class="form_label">Warning:</td>
734 @ <td><span class='securityWarning'>
735 @ Your password will be sent in the clear over an
@@ -728,15 +740,10 @@
740 @ Consider logging in at
741 @ <a href='%s(g.zHttpsURL)'>%h(g.zHttpsURL)</a> instead.
742 }
743 @ </span></td></tr>
744 }
 
 
 
 
 
745 @ <tr>
746 @ <td></td>
747 @ <td><input type="submit" name="in" value="Login"></td>
748 @ </tr>
749 if( !noAnon && login_self_register_available(0) ){
@@ -745,11 +752,10 @@
752 @ <td><input type="submit" name="self" value="Create A New Account">
753 @ </tr>
754 }
755 @ </table>
756 if( zAnonPw && !noAnon ){
 
757 const char *zDecoded = captcha_decode(uSeed);
758 int bAutoCaptcha = db_get_boolean("auto-captcha", 0);
759 char *zCaptcha = captcha_render(zDecoded);
760
761 @ <p><input type="hidden" name="cs" value="%u(uSeed)" />
@@ -757,11 +763,10 @@
763 @ the 8-character hexadecimal password shown below:</p>
764 @ <div class="captcha"><table class="captcha"><tr><td>\
765 @ <pre class="captcha">
766 @ %h(zCaptcha)
767 @ </pre></td></tr></table>
 
768 if( bAutoCaptcha ) {
769 @ <input type="button" value="Fill out captcha" id='autofillButton' \
770 @ data-af='%s(zDecoded)' />
771 style_load_one_js_file("login.js");
772 }
773

Keyboard Shortcuts

Open search /
Next entry (timeline) j
Previous entry (timeline) k
Open focused entry Enter
Show this help ?
Toggle theme Top nav button