Browse Source

signup works...only logout has to be added then the new version is complete. refs #36

release0.1.5
Georg Hopp 12 years ago
parent
commit
3c132acc64
  1. 17
      assets/html/example.html
  2. 12
      assets/js/init.js
  3. 12
      assets/style/common.css
  4. 6
      src/application/adapter/http/update.c
  5. 2
      src/application/signup.c

17
assets/html/example.html

@ -32,6 +32,7 @@
<li class="menuedge"></li>
<li><span>random Value</span></li>
<li><span>start session</span></li>
<li><span>signup</span></li>
<li><span>login</span></li>
<li class="menuedge"></li>
<div></div>
@ -76,6 +77,22 @@
</form>
</div>
<div id="signup" class="hide">
<form>
<label for="firstname">firstname</label>
<input type="text" name="firstname" /><br />
<label for="surname">surname</label>
<input type="text" name="surname" /><br />
<label for="mail">email</label>
<input type="text" name="email" /><br />
<label for="password">password</label>
<input type="password" name="password" /><br />
<label for="pwrepeat">password (again)</label>
<input type="password" name="pwrepeat" /><br />
<input type="submit" />
</form>
</div>
<div id="randval" class="hide">
<span class="small">
Value created at: <br />

12
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:

12
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;

6
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");

2
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:
Loading…
Cancel
Save