register.template 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <h1>
  2. {{title}}
  3. </h1>
  4. <form id="register">
  5. <div>
  6. Email: <input name="email" type="text"/>
  7. </div>
  8. <div>
  9. Username: <input name="username" type="text"/>
  10. </div>
  11. <div>
  12. Password: <input name="password" type="password"/>
  13. </div>
  14. <div>
  15. Verify Password: <input name="password1" type="password"/>
  16. </div>
  17. <div>
  18. <image id="captcha" src="index.php?get=captcha"/>
  19. <br/>
  20. Captcha: <input name="captcha" type="text"/>
  21. </div>
  22. <input type="submit" value="register"/>
  23. <input type="button" value="cancel" class="cancel"/>
  24. </form>
  25. <script>
  26. {{#if key}}
  27. History.back();
  28. {{else}}
  29. $('form#register').submit(function(){
  30. var data = $(this).serializeObject(),
  31. State = History.getState();
  32. for(var i in State.data){
  33. data[i] = State.data;
  34. }
  35. data.type = 'action';
  36. data.id = 'register';
  37. apiCall(data,function(d){
  38. if(!d.error){
  39. setKey(d.key);
  40. loadState('page-index');
  41. }else{
  42. setKey(null);
  43. $('#captcha').attr('src','index.php?get=captcha&timestamp='+new Date);
  44. $('#loading').hide();
  45. }
  46. });
  47. return false;
  48. }).children('.cancel').click(function(){
  49. History.back();
  50. return false;
  51. });
  52. {{/if}}
  53. </script>