Overview
SHA1 Hash: | 783df88ba84e919e1fef79aa0136342d978d5fbf |
---|---|
Date: | 2007-10-26 18:18:59 |
User: | drh |
Comment: | Prevent duplicate logins on the "user add" command. Also, allow the login to be specified on the command line. |
Timelines: | ancestors | descendants | both | trunk |
Other Links: | files | ZIP archive | manifest |
Tags And Properties
- branch=trunk inherited from [a28c83647d]
- sym-trunk inherited from [a28c83647d]
Changes
[hide diffs]Modified src/user.c from [9649e14426] to [dde3c3d16a].
@@ -165,11 +165,11 @@ ** ** %fossil user list ** ** List all users known to the repository ** -** %fossil user new +** %fossil user new ?USERNAME? ** ** Create a new user in the repository. Users can never be ** deleted. They can be denied all access but they must continue ** to exist in the database. ** @@ -185,11 +185,19 @@ } n = strlen(g.argv[2]); if( n>=2 && strncmp(g.argv[2],"new",n)==0 ){ Blob passwd, login, contact; - prompt_user("login: ", &login); + if( g.argc>=4 ){ + blob_zero(&login); + blob_append(&login, g.argv[3], -1); + }else{ + prompt_user("login: ", &login); + } + if( db_exists("SELECT 1 FROM user WHERE login=%B", &login) ){ + fossil_fatal("user %b already exists", &login); + } prompt_user("contact-info: ", &contact); prompt_for_password("password: ", &passwd, 1); db_multi_exec( "INSERT INTO user(login,pw,cap,info)" "VALUES(%B,%B,'jnor',%B)",