Fossil SCM

Add comments to the /register page implementation. No logic changes.

drh 2018-08-16 01:43 trunk
Commit a4419c6c022e03f775a885afac86229fbbc185ef080e3b4fd1d5c470bce1e79c
1 file changed +4 -1
+4 -1
--- src/login.c
+++ src/login.c
@@ -1551,11 +1551,11 @@
15511551
zPasswd = PDT("p","");
15521552
zConfirm = PDT("cp","");
15531553
zEAddr = PDT("ea","");
15541554
zDName = PDT("dn","");
15551555
1556
- /* Try to make any sense from user input. */
1556
+ /* Verify user imputs */
15571557
if( P("new")==0 || !cgi_csrf_safe(1) ){
15581558
/* This is not a valid form submission. Fall through into
15591559
** the form display */
15601560
}else if( !captcha_is_correct(1) ){
15611561
iErrLine = 6;
@@ -1595,10 +1595,12 @@
15951595
" AND sverified",zEAddr)
15961596
){
15971597
iErrLine = 3;
15981598
zErr = "This email address is already claimed by another user";
15991599
}else{
1600
+ /* If all of the tests above have passed, that means that the submitted
1601
+ ** form contains valid data and we can proceed to create the new login */
16001602
Blob sql;
16011603
int uid;
16021604
char *zPass = sha1_shared_secret(zPasswd, zUserID, 0);
16031605
blob_init(&sql, 0, 0);
16041606
blob_append_sql(&sql,
@@ -1623,10 +1625,11 @@
16231625
if( g.perm.Read ) ssub[nsub++] = 'c';
16241626
if( g.perm.RdForum ) ssub[nsub++] = 'f';
16251627
if( g.perm.RdTkt ) ssub[nsub++] = 't';
16261628
if( g.perm.RdWiki ) ssub[nsub++] = 'w';
16271629
ssub[nsub] = 0;
1630
+ /* Also add the user to the subscriber table. */
16281631
db_multi_exec(
16291632
"INSERT INTO subscriber(semail,suname,"
16301633
" sverified,sdonotcall,sdigest,ssub,sctime,mtime,smip)"
16311634
" VALUES(%Q,%Q,%d,0,%d,%Q,now(),now(),%Q)"
16321635
" ON CONFLICT(semail) DO UPDATE"
16331636
--- src/login.c
+++ src/login.c
@@ -1551,11 +1551,11 @@
1551 zPasswd = PDT("p","");
1552 zConfirm = PDT("cp","");
1553 zEAddr = PDT("ea","");
1554 zDName = PDT("dn","");
1555
1556 /* Try to make any sense from user input. */
1557 if( P("new")==0 || !cgi_csrf_safe(1) ){
1558 /* This is not a valid form submission. Fall through into
1559 ** the form display */
1560 }else if( !captcha_is_correct(1) ){
1561 iErrLine = 6;
@@ -1595,10 +1595,12 @@
1595 " AND sverified",zEAddr)
1596 ){
1597 iErrLine = 3;
1598 zErr = "This email address is already claimed by another user";
1599 }else{
 
 
1600 Blob sql;
1601 int uid;
1602 char *zPass = sha1_shared_secret(zPasswd, zUserID, 0);
1603 blob_init(&sql, 0, 0);
1604 blob_append_sql(&sql,
@@ -1623,10 +1625,11 @@
1623 if( g.perm.Read ) ssub[nsub++] = 'c';
1624 if( g.perm.RdForum ) ssub[nsub++] = 'f';
1625 if( g.perm.RdTkt ) ssub[nsub++] = 't';
1626 if( g.perm.RdWiki ) ssub[nsub++] = 'w';
1627 ssub[nsub] = 0;
 
1628 db_multi_exec(
1629 "INSERT INTO subscriber(semail,suname,"
1630 " sverified,sdonotcall,sdigest,ssub,sctime,mtime,smip)"
1631 " VALUES(%Q,%Q,%d,0,%d,%Q,now(),now(),%Q)"
1632 " ON CONFLICT(semail) DO UPDATE"
1633
--- src/login.c
+++ src/login.c
@@ -1551,11 +1551,11 @@
1551 zPasswd = PDT("p","");
1552 zConfirm = PDT("cp","");
1553 zEAddr = PDT("ea","");
1554 zDName = PDT("dn","");
1555
1556 /* Verify user imputs */
1557 if( P("new")==0 || !cgi_csrf_safe(1) ){
1558 /* This is not a valid form submission. Fall through into
1559 ** the form display */
1560 }else if( !captcha_is_correct(1) ){
1561 iErrLine = 6;
@@ -1595,10 +1595,12 @@
1595 " AND sverified",zEAddr)
1596 ){
1597 iErrLine = 3;
1598 zErr = "This email address is already claimed by another user";
1599 }else{
1600 /* If all of the tests above have passed, that means that the submitted
1601 ** form contains valid data and we can proceed to create the new login */
1602 Blob sql;
1603 int uid;
1604 char *zPass = sha1_shared_secret(zPasswd, zUserID, 0);
1605 blob_init(&sql, 0, 0);
1606 blob_append_sql(&sql,
@@ -1623,10 +1625,11 @@
1625 if( g.perm.Read ) ssub[nsub++] = 'c';
1626 if( g.perm.RdForum ) ssub[nsub++] = 'f';
1627 if( g.perm.RdTkt ) ssub[nsub++] = 't';
1628 if( g.perm.RdWiki ) ssub[nsub++] = 'w';
1629 ssub[nsub] = 0;
1630 /* Also add the user to the subscriber table. */
1631 db_multi_exec(
1632 "INSERT INTO subscriber(semail,suname,"
1633 " sverified,sdonotcall,sdigest,ssub,sctime,mtime,smip)"
1634 " VALUES(%Q,%Q,%d,0,%d,%Q,now(),now(),%Q)"
1635 " ON CONFLICT(semail) DO UPDATE"
1636

Keyboard Shortcuts

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