Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | Improved login screen with a "Create A New Account" button. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | forum-v2 |
Files: | files | file ages | folders |
SHA3-256: |
14335899ef335f78aec72ad5160c5f45 |
User & Date: | drh 2018-07-30 23:29:21.834 |
Context
2018-07-31
| ||
01:03 | If the user is not logged in, prompt them to do so before continuing to the forum entry pages. ... (check-in: 009ca1f7 user: drh tags: forum-v2) | |
2018-07-30
| ||
23:29 | Improved login screen with a "Create A New Account" button. ... (check-in: 14335899 user: drh tags: forum-v2) | |
21:39 | Futher improvements to the user capability summary display. ... (check-in: 45591e21 user: drh tags: forum-v2) | |
Changes
Changes to src/capabilities.c.
︙ | ︙ | |||
66 67 68 69 70 71 72 73 74 75 76 77 78 79 | if( zCap ){ for(i=0; (c = zCap[i])!=0; i++){ if( c>='0' && c<='z' ) pIn->x[c] = 0; } } return pIn; } /* ** Delete a CapabilityString object. */ void capability_free(CapabilityString *p){ fossil_free(p); } | > > > > > > > > > > > > > > | 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | if( zCap ){ for(i=0; (c = zCap[i])!=0; i++){ if( c>='0' && c<='z' ) pIn->x[c] = 0; } } return pIn; } /* ** Return true if any of the capabilities in zNeeded are found in pCap */ int capability_has_any(CapabilityString *p, const char *zNeeded){ if( p==0 ) return 0; if( zNeeded==0 ) return 0; while( zNeeded[0] ){ int c = zNeeded[0]; if( fossil_isalnum(c) && p->x[c] ) return 1; zNeeded++; } return 0; } /* ** Delete a CapabilityString object. */ void capability_free(CapabilityString *p){ fossil_free(p); } |
︙ | ︙ |
Changes to src/login.c.
︙ | ︙ | |||
468 469 470 471 472 473 474 475 476 477 478 479 480 481 | int rc; if( zReferer==0 ) return 0; zPattern = mprintf("%s/login*", g.zBaseURL); rc = sqlite3_strglob(zPattern, zReferer)==0; fossil_free(zPattern); return rc; } /* ** There used to be a page named "my" that was designed to show information ** about a specific user. The "my" page was linked from the "Logged in as USER" ** line on the title bar. The "my" page was never completed so it is now ** removed. Use this page as a placeholder in older installations. ** | > > > > > > > > > > > > > > > > > > | 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 | int rc; if( zReferer==0 ) return 0; zPattern = mprintf("%s/login*", g.zBaseURL); rc = sqlite3_strglob(zPattern, zReferer)==0; fossil_free(zPattern); return rc; } /* ** Return TRUE if self-registration is available. If the zNeeded ** argument is not NULL, then only return true if self-registration is ** available and any of the capabilities named in zNeeded are available ** to self-registered users. */ int login_self_register_available(const char *zNeeded){ CapabilityString *pCap; int rc; if( !db_get_boolean("self-register",0) ) return 0; if( zNeeded==0 ) return 1; pCap = capability_add(0, db_get("default-perms","")); capability_expand(pCap); rc = capability_has_any(pCap, zNeeded); capability_free(pCap); return rc; } /* ** There used to be a page named "my" that was designed to show information ** about a specific user. The "my" page was linked from the "Logged in as USER" ** line on the title bar. The "my" page was never completed so it is now ** removed. Use this page as a placeholder in older installations. ** |
︙ | ︙ | |||
534 535 536 537 538 539 540 541 542 543 544 545 546 547 | /* Handle log-out requests */ if( P("out") ){ login_clear_login_data(); redirect_to_g(); return; } /* Deal with password-change requests */ if( g.perm.Password && zPasswd && (zNew1 = P("n1"))!=0 && (zNew2 = P("n2"))!=0 ){ /* If there is not a "real" login, we cannot change any password. */ if( g.zLogin ){ | > > > > > > | 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 | /* Handle log-out requests */ if( P("out") ){ login_clear_login_data(); redirect_to_g(); return; } /* Redirect for create-new-account requests */ if( P("self") ){ cgi_redirectf("%R/register"); return; } /* Deal with password-change requests */ if( g.perm.Password && zPasswd && (zNew1 = P("n1"))!=0 && (zNew2 = P("n2"))!=0 ){ /* If there is not a "real" login, we cannot change any password. */ if( g.zLogin ){ |
︙ | ︙ | |||
673 674 675 676 677 678 679 | @ <td class="form_label">User ID:</td> if( anonFlag ){ @ <td><input type="text" id="u" name="u" value="anonymous" size="30"></td> }else{ @ <td><input type="text" id="u" name="u" value="" size="30" /></td> } if( P("HTTPS")==0 ){ | | | | > > > | < < > > > | | > | 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 | @ <td class="form_label">User ID:</td> if( anonFlag ){ @ <td><input type="text" id="u" name="u" value="anonymous" size="30"></td> }else{ @ <td><input type="text" id="u" name="u" value="" size="30" /></td> } if( P("HTTPS")==0 ){ @ <td width="15"><td rowspan="2"> @ <p class='securityWarning'> @ Warning: Your password will be sent in the clear over an @ unencrypted connection. if( g.sslNotAvailable ){ @ No encrypted connection is available on this server. }else{ @ Consider logging in at @ <a href='%s(g.zHttpsURL)'>%h(g.zHttpsURL)</a> instead. } @ </p> } @ </tr> @ <tr> @ <td class="form_label">Password:</td> @ <td><input type="password" id="p" name="p" value="" size="30" /></td> @ </tr> if( g.zLogin==0 && (anonFlag || zGoto==0) ){ zAnonPw = db_text(0, "SELECT pw FROM user" " WHERE login='anonymous'" " AND cap!=''"); } @ <tr> @ <td></td> @ <td><input type="submit" name="in" value="Login"></td> @ <td colspan="2">← Pressing this button grants\ @ permission to store a cookie @ </tr> if( login_self_register_available(0) ){ @ <tr> @ <td></td> @ <td><input type="submit" name="self" value="Create A New Account"> @ <td colspan="2"> \ @ ← Don't have a login? Click this button to create one. @ </tr> } @ </table> if( zAnonPw ){ unsigned int uSeed = captcha_seed(); const char *zDecoded = captcha_decode(uSeed); int bAutoCaptcha = db_get_boolean("auto-captcha", 0); char *zCaptcha = captcha_render(zDecoded); @ <p><input type="hidden" name="cs" value="%u(uSeed)" /> |
︙ | ︙ |