Fossil SCM
Prevent an extra leading slash from the post-login redirector. Also, on the 'register' page, include the email notifications input element if the 'selfreg-verify' setting is enabled, even when the 'default-perms' setting does not include the 'Email Alerts' ('7') permission.
Commit
129ea22423ee20b52d07e43c805e0ffd1cafa1690231299d43f8e6aef6507180
Parent
e1996e25582f693…
1 file changed
+3
-2
+3
-2
| --- src/login.c | ||
| +++ src/login.c | ||
| @@ -1479,10 +1479,11 @@ | ||
| 1479 | 1479 | { |
| 1480 | 1480 | const char *zQS = P("QUERY_STRING"); |
| 1481 | 1481 | const char *zPathInfo = PD("PATH_INFO",""); |
| 1482 | 1482 | Blob redir; |
| 1483 | 1483 | blob_init(&redir, 0, 0); |
| 1484 | + if( zPathInfo[0]=='/' ) zPathInfo++; /* skip leading slash */ | |
| 1484 | 1485 | if( fossil_wants_https(1) ){ |
| 1485 | 1486 | blob_appendf(&redir, "%s/login?g=%T", g.zHttpsURL, zPathInfo); |
| 1486 | 1487 | }else{ |
| 1487 | 1488 | blob_appendf(&redir, "%R/login?g=%T", zPathInfo); |
| 1488 | 1489 | } |
| @@ -1605,13 +1606,13 @@ | ||
| 1605 | 1606 | } |
| 1606 | 1607 | zPerms = db_get("default-perms", "u"); |
| 1607 | 1608 | |
| 1608 | 1609 | /* Prompt the user for email alerts if this repository is configured for |
| 1609 | 1610 | ** email alerts and if the default permissions include "7" */ |
| 1610 | - canDoAlerts = alert_tables_exist() && db_int(0, | |
| 1611 | + canDoAlerts = alert_tables_exist() && (db_int(0, | |
| 1611 | 1612 | "SELECT fullcap(%Q) GLOB '*7*'", zPerms |
| 1612 | - ); | |
| 1613 | + ) || db_get_boolean("selfreg-verify",0)); | |
| 1613 | 1614 | doAlerts = canDoAlerts && atoi(PD("alerts","1"))!=0; |
| 1614 | 1615 | |
| 1615 | 1616 | zUserID = PDT("u",""); |
| 1616 | 1617 | zPasswd = PDT("p",""); |
| 1617 | 1618 | zConfirm = PDT("cp",""); |
| 1618 | 1619 |
| --- src/login.c | |
| +++ src/login.c | |
| @@ -1479,10 +1479,11 @@ | |
| 1479 | { |
| 1480 | const char *zQS = P("QUERY_STRING"); |
| 1481 | const char *zPathInfo = PD("PATH_INFO",""); |
| 1482 | Blob redir; |
| 1483 | blob_init(&redir, 0, 0); |
| 1484 | if( fossil_wants_https(1) ){ |
| 1485 | blob_appendf(&redir, "%s/login?g=%T", g.zHttpsURL, zPathInfo); |
| 1486 | }else{ |
| 1487 | blob_appendf(&redir, "%R/login?g=%T", zPathInfo); |
| 1488 | } |
| @@ -1605,13 +1606,13 @@ | |
| 1605 | } |
| 1606 | zPerms = db_get("default-perms", "u"); |
| 1607 | |
| 1608 | /* Prompt the user for email alerts if this repository is configured for |
| 1609 | ** email alerts and if the default permissions include "7" */ |
| 1610 | canDoAlerts = alert_tables_exist() && db_int(0, |
| 1611 | "SELECT fullcap(%Q) GLOB '*7*'", zPerms |
| 1612 | ); |
| 1613 | doAlerts = canDoAlerts && atoi(PD("alerts","1"))!=0; |
| 1614 | |
| 1615 | zUserID = PDT("u",""); |
| 1616 | zPasswd = PDT("p",""); |
| 1617 | zConfirm = PDT("cp",""); |
| 1618 |
| --- src/login.c | |
| +++ src/login.c | |
| @@ -1479,10 +1479,11 @@ | |
| 1479 | { |
| 1480 | const char *zQS = P("QUERY_STRING"); |
| 1481 | const char *zPathInfo = PD("PATH_INFO",""); |
| 1482 | Blob redir; |
| 1483 | blob_init(&redir, 0, 0); |
| 1484 | if( zPathInfo[0]=='/' ) zPathInfo++; /* skip leading slash */ |
| 1485 | if( fossil_wants_https(1) ){ |
| 1486 | blob_appendf(&redir, "%s/login?g=%T", g.zHttpsURL, zPathInfo); |
| 1487 | }else{ |
| 1488 | blob_appendf(&redir, "%R/login?g=%T", zPathInfo); |
| 1489 | } |
| @@ -1605,13 +1606,13 @@ | |
| 1606 | } |
| 1607 | zPerms = db_get("default-perms", "u"); |
| 1608 | |
| 1609 | /* Prompt the user for email alerts if this repository is configured for |
| 1610 | ** email alerts and if the default permissions include "7" */ |
| 1611 | canDoAlerts = alert_tables_exist() && (db_int(0, |
| 1612 | "SELECT fullcap(%Q) GLOB '*7*'", zPerms |
| 1613 | ) || db_get_boolean("selfreg-verify",0)); |
| 1614 | doAlerts = canDoAlerts && atoi(PD("alerts","1"))!=0; |
| 1615 | |
| 1616 | zUserID = PDT("u",""); |
| 1617 | zPasswd = PDT("p",""); |
| 1618 | zConfirm = PDT("cp",""); |
| 1619 |