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.

mistachkin 2021-09-15 19:50 trunk
Commit 129ea22423ee20b52d07e43c805e0ffd1cafa1690231299d43f8e6aef6507180
1 file changed +3 -2
+3 -2
--- src/login.c
+++ src/login.c
@@ -1479,10 +1479,11 @@
14791479
{
14801480
const char *zQS = P("QUERY_STRING");
14811481
const char *zPathInfo = PD("PATH_INFO","");
14821482
Blob redir;
14831483
blob_init(&redir, 0, 0);
1484
+ if( zPathInfo[0]=='/' ) zPathInfo++; /* skip leading slash */
14841485
if( fossil_wants_https(1) ){
14851486
blob_appendf(&redir, "%s/login?g=%T", g.zHttpsURL, zPathInfo);
14861487
}else{
14871488
blob_appendf(&redir, "%R/login?g=%T", zPathInfo);
14881489
}
@@ -1605,13 +1606,13 @@
16051606
}
16061607
zPerms = db_get("default-perms", "u");
16071608
16081609
/* Prompt the user for email alerts if this repository is configured for
16091610
** 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,
16111612
"SELECT fullcap(%Q) GLOB '*7*'", zPerms
1612
- );
1613
+ ) || db_get_boolean("selfreg-verify",0));
16131614
doAlerts = canDoAlerts && atoi(PD("alerts","1"))!=0;
16141615
16151616
zUserID = PDT("u","");
16161617
zPasswd = PDT("p","");
16171618
zConfirm = PDT("cp","");
16181619
--- 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

Keyboard Shortcuts

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