| | @@ -656,11 +656,17 @@ |
| 656 | 656 | const char *zPw = P("name"); |
| 657 | 657 | if( zPw==0 || zPw[0]==0 ){ |
| 658 | 658 | (void)exclude_spiders(1); |
| 659 | 659 | @ <hr><p>The captcha is shown above. Add a name=HEX query parameter |
| 660 | 660 | @ to see how HEX would be rendered in the current captcha font. |
| 661 | | - @ <p>captcha_is_correct(1) returns %d(captcha_is_correct(1)). |
| 661 | + @ <h2>Debug/Testing Values:</h2> |
| 662 | + @ <ul> |
| 663 | + @ <li> g.isHuman = %d(g.isHuman) |
| 664 | + @ <li> g.zLogin = %h(g.zLogin) |
| 665 | + @ <li> login_cookie_welformed() = %d(login_cookie_wellformed()) |
| 666 | + @ <li> captcha_is_correct(1) = %d(captcha_is_correct(1)). |
| 667 | + @ </ul> |
| 662 | 668 | style_finish_page(); |
| 663 | 669 | }else{ |
| 664 | 670 | style_set_current_feature("test"); |
| 665 | 671 | style_header("Captcha Test"); |
| 666 | 672 | @ <pre class="captcha"> |
| | @@ -683,11 +689,18 @@ |
| 683 | 689 | ** |
| 684 | 690 | ** If the bTest argument is non-zero, then show the captcha regardless of |
| 685 | 691 | ** how the agent identifies. This is used for testing only. |
| 686 | 692 | */ |
| 687 | 693 | int exclude_spiders(int bTest){ |
| 688 | | - if( !bTest && (g.isHuman || g.zLogin!=0) ) return 0; |
| 694 | + if( !bTest ){ |
| 695 | + if( g.isHuman ) return 0; /* This user has already proven human */ |
| 696 | + if( g.zLogin!=0 ) return 0; /* Logged in. Consider them human */ |
| 697 | + if( login_cookie_wellformed() ){ |
| 698 | + /* Logged into another member of the login group */ |
| 699 | + return 0; |
| 700 | + } |
| 701 | + } |
| 689 | 702 | |
| 690 | 703 | /* This appears to be a spider. Offer the captcha */ |
| 691 | 704 | style_set_current_feature("captcha"); |
| 692 | 705 | style_header("I think you are a robot"); |
| 693 | 706 | style_submenu_enable(0); |
| | @@ -723,12 +736,12 @@ |
| 723 | 736 | */ |
| 724 | 737 | void captcha_callback(void){ |
| 725 | 738 | int bTest = atoi(PD("istest","0")); |
| 726 | 739 | if( captcha_is_correct(1) ){ |
| 727 | 740 | if( bTest==0 ){ |
| 728 | | - login_check_credentials(); |
| 729 | | - if( g.zLogin==0 ){ |
| 741 | + if( !login_cookie_wellformed() ){ |
| 742 | + /* ^^^^--- Don't overwrite a valid login on another repo! */ |
| 730 | 743 | login_set_anon_cookie(0, 0); |
| 731 | 744 | } |
| 732 | 745 | cgi_append_header("X-Robot: 0\r\n"); |
| 733 | 746 | } |
| 734 | 747 | login_redirect_to_g(); |
| 735 | 748 | |