Guest User

Untitled

a guest
Jul 8th, 2018
144
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.69 KB | None | 0 0
  1. <%namespace name="ps" module="irective.lib.Javascript"/>
  2. <html>
  3. <head><title>IREctive</title></head>
  4.  
  5. <script language="Javascript" src="/jquery-1.3.2.js"></script>
  6. <%ps:pyvascript>
  7. import AjaxHelper
  8.  
  9. class Login(AjaxHelper):
  10. def __init__(self):
  11. self.call(_uriOf(Frontend.login),
  12. username=_('#loginUsername').val(),
  13. password=_('#loginPassword').val()
  14. )
  15.  
  16. def success(self, error):
  17. if error == None:
  18. window.location = _uriOf(Dashboard)
  19. else:
  20. _('#errorBox').html(error)
  21.  
  22. def failure(self):
  23. _('#errorBox').html('Could not communicate with server.')
  24.  
  25. class Register(AjaxHelper):
  26. def __init__(self):
  27. self.call(_uriOf(Frontend.register),
  28. username=_('#regUsername').val(),
  29. password=_('#regPassword').val(),
  30. repeat=_('#regRepeat').val()
  31. )
  32.  
  33. def success(self, error):
  34. if error == None:
  35. window.location = _uriOf(Dashboard)
  36. else:
  37. _('#errorBox').html(error)
  38.  
  39. def failure(self):
  40. _('#errorBox').html('Could not communicate with server.')
  41. </%ps:pyvascript>
  42.  
  43. <body>
  44. <h1>IREctive</h1>
  45. <div style="color: red" id="errorBox"></div>
  46. Log in:<br />
  47. <div style="padding-left: 20px">
  48. Username: <input type="text" id="loginUsername" /><br />
  49. Password: <input type="password" id="loginPassword" /><br />
  50. <input type="submit" value="Submit" onClick="new Login()" />
  51. </div><br />
  52. <br />
  53. Register<br />
  54. <div style="padding-left: 20px">
  55. Username: <input type="text" id="regUsername" /><br />
  56. Password: <input type="password" id="regPassword" /><br />
  57. Repeat: <input type="password" id="regRepeat" /><br />
  58. <input type="submit" value="Submit" onClick="new Register()" />
  59. </div>
  60. </body>
  61. </html>
Add Comment
Please, Sign In to add comment