Fossil SCM
The /unsubscribe page now requests comformation. And so email notifications contain only an "Unsubscribe" link, and not a link to subscription management.
Commit
f045c5dd2631d92c8ad143a9a9801029e9f345e76892120855a3f0b273606b66
Parent
44cd9753925065c…
1 file changed
+32
-3
+32
-3
| --- src/alerts.c | ||
| +++ src/alerts.c | ||
| @@ -2128,17 +2128,44 @@ | ||
| 2128 | 2128 | int bSubmit; |
| 2129 | 2129 | const char *zEAddr; |
| 2130 | 2130 | char *zCode = 0; |
| 2131 | 2131 | int sid = 0; |
| 2132 | 2132 | |
| 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. | |
| 2134 | 2137 | */ |
| 2135 | 2138 | if( zName |
| 2136 | 2139 | && (sid = db_int(0, "SELECT subscriberId FROM subscriber" |
| 2137 | 2140 | " WHERE subscriberCode=hextoblob(%Q)", zName))!=0 |
| 2138 | 2141 | ){ |
| 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>←</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>←</b></big></td> | |
| 2161 | + @ <td>Make changes to your subscription preferences | |
| 2162 | + @ </td><tr> | |
| 2163 | + @ </table> | |
| 2164 | + @ </form> | |
| 2165 | + style_finish_page(); | |
| 2166 | + } | |
| 2140 | 2167 | return; |
| 2141 | 2168 | } |
| 2142 | 2169 | |
| 2143 | 2170 | /* Logged in users are redirected to the /alerts page */ |
| 2144 | 2171 | login_check_credentials(); |
| @@ -2963,12 +2990,14 @@ | ||
| 2963 | 2990 | Blob fhdr, fbody; |
| 2964 | 2991 | blob_init(&fhdr, 0, 0); |
| 2965 | 2992 | blob_appendf(&fhdr, "To: <%s>\r\n", zEmail); |
| 2966 | 2993 | blob_append(&fhdr, blob_buffer(&p->hdr), blob_size(&p->hdr)); |
| 2967 | 2994 | 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", | |
| 2969 | 2996 | zUrl, zCode); |
| 2997 | + /* blob_appendf(&fbody, "Subscription settings: %s/alerts/%s\n", | |
| 2998 | + ** zUrl, zCode); */ | |
| 2970 | 2999 | alert_send(pSender,&fhdr,&fbody,p->zFromName); |
| 2971 | 3000 | nSent++; |
| 2972 | 3001 | blob_reset(&fhdr); |
| 2973 | 3002 | blob_reset(&fbody); |
| 2974 | 3003 | }else{ |
| 2975 | 3004 |
| --- 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>←</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>←</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 |