Many hyperlinks are disabled.
Use anonymous login
to enable hyperlinks.
Overview
Comment: | User edits can be applied to a single repository or across the entire login group. |
---|---|
Downloads: | Tarball | ZIP archive |
Timelines: | family | ancestors | descendants | both | login-groups |
Files: | files | file ages | folders |
SHA1: |
a3fbd4fa9d7628568a7744888ff2808d |
User & Date: | drh 2011-04-08 18:45:22.635 |
Context
2011-04-12
| ||
22:44 | Update web logins so that they span all members of a login group. ... (check-in: e9754eae user: drh tags: login-groups) | |
2011-04-08
| ||
18:45 | User edits can be applied to a single repository or across the entire login group. ... (check-in: a3fbd4fa user: drh tags: login-groups) | |
17:08 | Begin adding code to implement "login groups" which will (we hope) ultimately lead to a single sign-on capability. ... (check-in: eec32b99 user: drh tags: login-groups) | |
Changes
Changes to src/setup.c.
︙ | ︙ | |||
246 247 248 249 250 251 252 253 254 255 256 257 258 259 | ** WEBPAGE: /setup_uedit */ void user_edit(void){ const char *zId, *zLogin, *zInfo, *zCap, *zPw; char *oaa, *oas, *oar, *oaw, *oan, *oai, *oaj, *oao, *oap; char *oak, *oad, *oac, *oaf, *oam, *oah, *oag, *oae; char *oat, *oau, *oav, *oab, *oax, *oaz; const char *inherit[128]; int doWrite; int uid; int higherUser = 0; /* True if user being edited is SETUP and the */ /* user doing the editing is ADMIN. Disallow editing */ /* Must have ADMIN privleges to access this page | > > | 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 | ** WEBPAGE: /setup_uedit */ void user_edit(void){ const char *zId, *zLogin, *zInfo, *zCap, *zPw; char *oaa, *oas, *oar, *oaw, *oan, *oai, *oaj, *oao, *oap; char *oak, *oad, *oac, *oaf, *oam, *oah, *oag, *oae; char *oat, *oau, *oav, *oab, *oax, *oaz; const char *zGroup; const char *zOldLogin; const char *inherit[128]; int doWrite; int uid; int higherUser = 0; /* True if user being edited is SETUP and the */ /* user doing the editing is ADMIN. Disallow editing */ /* Must have ADMIN privleges to access this page |
︙ | ︙ | |||
336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 | zPw = P("pw"); zLogin = P("login"); if( isValidPwString(zPw) ){ zPw = sha1_shared_secret(zPw, zLogin, 0); }else{ zPw = db_text(0, "SELECT pw FROM user WHERE uid=%d", uid); } if( uid>0 && db_exists("SELECT 1 FROM user WHERE login=%Q AND uid!=%d", zLogin, uid) ){ style_header("User Creation Error"); @ <span class="loginError">Login "%h(zLogin)" is already used by @ a different user.</span> @ @ <p><a href="setup_uedit?id=%d(uid)">[Bummer]</a></p> style_footer(); return; } login_verify_csrf_secret(); db_multi_exec( "REPLACE INTO user(uid,login,info,pw,cap) " "VALUES(nullif(%d,0),%Q,%Q,%Q,'%s')", uid, P("login"), P("info"), zPw, zCap ); cgi_redirect("setup_ulist"); return; } /* Load the existing information about the user, if any */ zLogin = ""; | > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > > | 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 | zPw = P("pw"); zLogin = P("login"); if( isValidPwString(zPw) ){ zPw = sha1_shared_secret(zPw, zLogin, 0); }else{ zPw = db_text(0, "SELECT pw FROM user WHERE uid=%d", uid); } zOldLogin = db_text(0, "SELECT login FROM user WHERE uid=%d", uid); if( uid>0 && db_exists("SELECT 1 FROM user WHERE login=%Q AND uid!=%d", zLogin, uid) ){ style_header("User Creation Error"); @ <span class="loginError">Login "%h(zLogin)" is already used by @ a different user.</span> @ @ <p><a href="setup_uedit?id=%d(uid)">[Bummer]</a></p> style_footer(); return; } login_verify_csrf_secret(); db_multi_exec( "REPLACE INTO user(uid,login,info,pw,cap) " "VALUES(nullif(%d,0),%Q,%Q,%Q,'%s')", uid, P("login"), P("info"), zPw, zCap ); if( atoi(PD("all","0"))>0 ){ Blob sql; char *zErr = 0; blob_zero(&sql); if( zOldLogin==0 ){ blob_appendf(&sql, "INSERT INTO user(login)" " SELECT %Q WHERE NOT EXISTS(SELECT 1 FROM user WHERE login=%Q);", zLogin, zLogin ); zOldLogin = zLogin; } blob_appendf(&sql, "UPDATE user SET login=%Q," " pw=coalesce(shared_secret(%Q,%Q," "(SELECT value FROM config WHERE name='project-code')),pw)," " info=%Q," " cap=%Q" " WHERE login=%Q;", zLogin, P("pw"), zLogin, P("info"), zCap, zOldLogin ); login_group_sql(blob_str(&sql), "<li> ", " </li>\n", &zErr); blob_reset(&sql); if( zErr ){ style_header("User Change Error"); @ <span class="loginError">%s(zErr)</span> @ @ <p><a href="setup_uedit?id=%d(uid)">[Bummer]</a></p> style_footer(); return; } } cgi_redirect("setup_ulist"); return; } /* Load the existing information about the user, if any */ zLogin = ""; |
︙ | ︙ | |||
503 504 505 506 507 508 509 510 511 512 513 514 515 516 | /* Obscure the password for all users */ @ <td><input type="password" name="pw" value="**********" /></td> }else{ /* Show an empty password as an empty input field */ @ <td><input type="password" name="pw" value="" /></td> } @ </tr> if( !higherUser ){ @ <tr> @ <td> </td> @ <td><input type="submit" name="submit" value="Apply Changes" /></td> @ </tr> } @ </table> | > > > > > > > > > > > | 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 | /* Obscure the password for all users */ @ <td><input type="password" name="pw" value="**********" /></td> }else{ /* Show an empty password as an empty input field */ @ <td><input type="password" name="pw" value="" /></td> } @ </tr> zGroup = db_get("login-group-name", 0); if( zGroup ){ @ <tr> @ <td valign="top" align="right">Scope:</td> @ <td valign="top"> @ <input type="radio" name="all" checked value="0"> @ Apply changes to this repository only.<br /> @ <input type="radio" name="all" value="1"> @ Apply changes to all repositories in the "<b>%h(zGroup)</b>" @ login group.</td></tr> } if( !higherUser ){ @ <tr> @ <td> </td> @ <td><input type="submit" name="submit" value="Apply Changes" /></td> @ </tr> } @ </table> |
︙ | ︙ |
Changes to src/sha1.c.
︙ | ︙ | |||
395 396 397 398 399 400 401 | ){ const char *zPw; const char *zLogin; const char *zProjid; assert( argc==2 || argc==3 ); zPw = (const char*)sqlite3_value_text(argv[0]); | | | 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 | ){ const char *zPw; const char *zLogin; const char *zProjid; assert( argc==2 || argc==3 ); zPw = (const char*)sqlite3_value_text(argv[0]); if( zPw==0 || zPw[0]==0 ) return; zLogin = (const char*)sqlite3_value_text(argv[1]); if( zLogin==0 ) return; if( argc==3 ){ zProjid = (const char*)sqlite3_value_text(argv[2]); if( zProjid && zProjid[0]==0 ) zProjid = 0; }else{ zProjid = 0; |
︙ | ︙ |