summaryrefslogtreecommitdiff
path: root/example/public/srp.js
blob: 4a4b9ee724513fb1116f73dad0abf516b6727ecc (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
$(document).ready(function(){
  $('#login-btn').click(on_login);
  $('#signup-btn').click(on_signup);
});

function on_login(event) {
  srp = new SRP();
  srp.success= on_authenticated;
  srp.identify();
  event.preventDefault();
}

function on_signup(event) {
  srp = new SRP();
  srp.registered_user = on_registered;
  srp.register();
  event.preventDefault();
}

function on_registered() {
  window.location = '/';
}

function on_authenticated() {
  window.location = '/';
}