Fossil SCM

The /unsubscribe page now requests comformation. And so email notifications contain only an "Unsubscribe" link, and not a link to subscription management.

drh 2022-07-29 18:57 trunk
Commit f045c5dd2631d92c8ad143a9a9801029e9f345e76892120855a3f0b273606b66
1 file changed +32 -3
+32 -3
--- src/alerts.c
+++ src/alerts.c
@@ -2128,17 +2128,44 @@
21282128
int bSubmit;
21292129
const char *zEAddr;
21302130
char *zCode = 0;
21312131
int sid = 0;
21322132
2133
- /* If a valid subscriber code is supplied, then unsubscribe immediately.
2133
+ if( zName==0 ) zName = P("scode");
2134
+
2135
+ /* If a valid subscriber code is supplied, then either present the user
2136
+ ** with a comformation, or if already confirmed, unsubscribe immediately.
21342137
*/
21352138
if( zName
21362139
&& (sid = db_int(0, "SELECT subscriberId FROM subscriber"
21372140
" WHERE subscriberCode=hextoblob(%Q)", zName))!=0
21382141
){
2139
- alert_unsubscribe(sid);
2142
+ char *zUnsubName = mprintf("confirm%04x", sid);
2143
+ if( P(zUnsubName)!=0 ){
2144
+ alert_unsubscribe(sid);
2145
+ }else if( P("manage")!=0 ){
2146
+ cgi_redirectf("%R/alerts/%s", zName);
2147
+ }else{
2148
+ style_header("Unsubscribed");
2149
+ form_begin(0, "%R/unsubscribe");
2150
+ @ <input type="hidden" name="scode" value="%h(zName)">
2151
+ @ <table border="0" cellpadding="10" width="100%%">
2152
+ @ <tr><td align="right">
2153
+ @ <input type="submit" name="%h(zUnsubName)" value="Unsubscribe">
2154
+ @ </td><td><big><b>&larr;</b></big></td>
2155
+ @ <td>Cancel your subscription to %h(g.zBaseURL) notifications
2156
+ @ </td><tr>
2157
+ @ <tr><td align="right">
2158
+ @ <input type="submit" name="manage" \
2159
+ @ value="Manage Subscription Settings">
2160
+ @ </td><td><big><b>&larr;</b></big></td>
2161
+ @ <td>Make changes to your subscription preferences
2162
+ @ </td><tr>
2163
+ @ </table>
2164
+ @ </form>
2165
+ style_finish_page();
2166
+ }
21402167
return;
21412168
}
21422169
21432170
/* Logged in users are redirected to the /alerts page */
21442171
login_check_credentials();
@@ -2963,12 +2990,14 @@
29632990
Blob fhdr, fbody;
29642991
blob_init(&fhdr, 0, 0);
29652992
blob_appendf(&fhdr, "To: <%s>\r\n", zEmail);
29662993
blob_append(&fhdr, blob_buffer(&p->hdr), blob_size(&p->hdr));
29672994
blob_init(&fbody, blob_buffer(&p->txt), blob_size(&p->txt));
2968
- blob_appendf(&fbody, "\n-- \nSubscription info: %s/alerts/%s\n",
2995
+ blob_appendf(&fbody, "\n-- \nUnsubscribe: %s/unsubscribe/%s\n",
29692996
zUrl, zCode);
2997
+ /* blob_appendf(&fbody, "Subscription settings: %s/alerts/%s\n",
2998
+ ** zUrl, zCode); */
29702999
alert_send(pSender,&fhdr,&fbody,p->zFromName);
29713000
nSent++;
29723001
blob_reset(&fhdr);
29733002
blob_reset(&fbody);
29743003
}else{
29753004
--- src/alerts.c
+++ src/alerts.c
@@ -2128,17 +2128,44 @@
2128 int bSubmit;
2129 const char *zEAddr;
2130 char *zCode = 0;
2131 int sid = 0;
2132
2133 /* If a valid subscriber code is supplied, then unsubscribe immediately.
 
 
 
2134 */
2135 if( zName
2136 && (sid = db_int(0, "SELECT subscriberId FROM subscriber"
2137 " WHERE subscriberCode=hextoblob(%Q)", zName))!=0
2138 ){
2139 alert_unsubscribe(sid);
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
2140 return;
2141 }
2142
2143 /* Logged in users are redirected to the /alerts page */
2144 login_check_credentials();
@@ -2963,12 +2990,14 @@
2963 Blob fhdr, fbody;
2964 blob_init(&fhdr, 0, 0);
2965 blob_appendf(&fhdr, "To: <%s>\r\n", zEmail);
2966 blob_append(&fhdr, blob_buffer(&p->hdr), blob_size(&p->hdr));
2967 blob_init(&fbody, blob_buffer(&p->txt), blob_size(&p->txt));
2968 blob_appendf(&fbody, "\n-- \nSubscription info: %s/alerts/%s\n",
2969 zUrl, zCode);
 
 
2970 alert_send(pSender,&fhdr,&fbody,p->zFromName);
2971 nSent++;
2972 blob_reset(&fhdr);
2973 blob_reset(&fbody);
2974 }else{
2975
--- src/alerts.c
+++ src/alerts.c
@@ -2128,17 +2128,44 @@
2128 int bSubmit;
2129 const char *zEAddr;
2130 char *zCode = 0;
2131 int sid = 0;
2132
2133 if( zName==0 ) zName = P("scode");
2134
2135 /* If a valid subscriber code is supplied, then either present the user
2136 ** with a comformation, or if already confirmed, unsubscribe immediately.
2137 */
2138 if( zName
2139 && (sid = db_int(0, "SELECT subscriberId FROM subscriber"
2140 " WHERE subscriberCode=hextoblob(%Q)", zName))!=0
2141 ){
2142 char *zUnsubName = mprintf("confirm%04x", sid);
2143 if( P(zUnsubName)!=0 ){
2144 alert_unsubscribe(sid);
2145 }else if( P("manage")!=0 ){
2146 cgi_redirectf("%R/alerts/%s", zName);
2147 }else{
2148 style_header("Unsubscribed");
2149 form_begin(0, "%R/unsubscribe");
2150 @ <input type="hidden" name="scode" value="%h(zName)">
2151 @ <table border="0" cellpadding="10" width="100%%">
2152 @ <tr><td align="right">
2153 @ <input type="submit" name="%h(zUnsubName)" value="Unsubscribe">
2154 @ </td><td><big><b>&larr;</b></big></td>
2155 @ <td>Cancel your subscription to %h(g.zBaseURL) notifications
2156 @ </td><tr>
2157 @ <tr><td align="right">
2158 @ <input type="submit" name="manage" \
2159 @ value="Manage Subscription Settings">
2160 @ </td><td><big><b>&larr;</b></big></td>
2161 @ <td>Make changes to your subscription preferences
2162 @ </td><tr>
2163 @ </table>
2164 @ </form>
2165 style_finish_page();
2166 }
2167 return;
2168 }
2169
2170 /* Logged in users are redirected to the /alerts page */
2171 login_check_credentials();
@@ -2963,12 +2990,14 @@
2990 Blob fhdr, fbody;
2991 blob_init(&fhdr, 0, 0);
2992 blob_appendf(&fhdr, "To: <%s>\r\n", zEmail);
2993 blob_append(&fhdr, blob_buffer(&p->hdr), blob_size(&p->hdr));
2994 blob_init(&fbody, blob_buffer(&p->txt), blob_size(&p->txt));
2995 blob_appendf(&fbody, "\n-- \nUnsubscribe: %s/unsubscribe/%s\n",
2996 zUrl, zCode);
2997 /* blob_appendf(&fbody, "Subscription settings: %s/alerts/%s\n",
2998 ** zUrl, zCode); */
2999 alert_send(pSender,&fhdr,&fbody,p->zFromName);
3000 nSent++;
3001 blob_reset(&fhdr);
3002 blob_reset(&fbody);
3003 }else{
3004

Keyboard Shortcuts

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