diff --git a/assets/html/example.html b/assets/html/example.html
index 6411331..927b57f 100644
--- a/assets/html/example.html
+++ b/assets/html/example.html
@@ -32,6 +32,7 @@
random Value
start session
+ signup
login
@@ -76,6 +77,22 @@
+
+
+
+
Value created at:
diff --git a/assets/js/init.js b/assets/js/init.js
index fff4c45..cffaa79 100644
--- a/assets/js/init.js
+++ b/assets/js/init.js
@@ -18,6 +18,10 @@ $(document).ready(function() {
});
$("div#menu ul li:eq(3)").click(function() {
+ $("#signup").removeClass("hide");
+ });
+
+ $("div#menu ul li:eq(4)").click(function() {
$("#login").removeClass("hide");
});
@@ -32,6 +36,14 @@ $(document).ready(function() {
$.proxy(sess.loadJSON, sess));
$("#login").addClass("hide");
});
+
+ $("#signup form").submit(function(event) {
+ event.preventDefault();
+ $.post("/signup/",
+ $("#signup form").serialize(),
+ $.proxy(sess.loadJSON, sess));
+ $("#signup").addClass("hide");
+ });
});
// vim: set ts=4 sw=4:
diff --git a/assets/style/common.css b/assets/style/common.css
index bd3bab4..0a6742e 100644
--- a/assets/style/common.css
+++ b/assets/style/common.css
@@ -8,8 +8,20 @@ div#randval {
border-radius: 10px;
}
+div#signup {
+ padding: 5px;
+ top: 20px;
+ left: 20px;
+ position: fixed;
+ background-color: white;
+ border: 1px solid black;
+ border-radius: 10px;
+}
+
div#login {
padding: 5px;
+ top: 20px;
+ left: 20px;
position: fixed;
background-color: white;
border: 1px solid black;
diff --git a/src/application/adapter/http/update.c b/src/application/adapter/http/update.c
index 47fa55e..c4c81a5 100644
--- a/src/application/adapter/http/update.c
+++ b/src/application/adapter/http/update.c
@@ -151,6 +151,12 @@ loginAdapter(Application application, HttpWorker worker, Session session)
worker->current_request->post,
CSTRA("password"));
+ if (NULL == username) {
+ username = hashGet(
+ worker->current_request->post,
+ CSTRA("email"));
+ }
+
if (NULL == username || NULL == password) {
worker->current_response =
new(HttpResponse, "HTTP/1.1", 403, "Forbidden");
diff --git a/src/application/signup.c b/src/application/signup.c
index e4347b5..53aff02 100644
--- a/src/application/signup.c
+++ b/src/application/signup.c
@@ -78,7 +78,7 @@ applicationSignup(
(char *)hash_data,
SALT_SIZE + HASH_SIZE);
- return 0;
+ return 1;
}
// vim: set ts=4 sw=4: