aboutsummaryrefslogtreecommitdiff
path: root/ctl.c
diff options
context:
space:
mode:
Diffstat (limited to 'ctl.c')
-rw-r--r--ctl.c21
1 files changed, 18 insertions, 3 deletions
diff --git a/ctl.c b/ctl.c
index 58db942..cd90f4f 100644
--- a/ctl.c
+++ b/ctl.c
@@ -37,6 +37,19 @@ printhtml(char *s)
}
}
+void
+login()
+{
+ char *hlite, msg[MAXMSG], *name;
+ char title[] = "Log In";
+
+ *msg = 0;
+ hlite = name = NULL;
+
+ printf("Content-Type: text/html\n\n");
+ #include "t/login.tc"
+}
+
/*
* The `new' functions provide a way to add a new attachment/post/user.
* On GET, they show a form. On POST, they insert the posted information
@@ -145,13 +158,15 @@ newuser()
"Full name may only contain visible characters");
goto err;
}
-
- /* Ensure all required fields are there. */
+
+ /* Validate captcha. */
if(captcha && strcmp(captcha, "9") != 0){
hlite = strdup("captcha");
snprintf(msg, MAXMSG, "Incorrectly answered captcha");
goto err;
}
+
+ /* Ensure all required fields are there. */
if(!name || !*name){
hlite = strdup("name");
snprintf(msg, MAXMSG, "Username is required");
@@ -173,7 +188,7 @@ newuser()
user->name = name;
user->full = *full? full: NULL;
- user->hash = pass; /* TODO */
+ makehash(pass, &user->hash, &user->salt);
if(!adduser(user)){
if(strcmp(sqlite3_errmsg(db), "column name is not unique")==0)