Browse Source

Moved identification to full name

Brendan Abolivier 8 years ago
parent
commit
6872892cca
Signed by: Brendan Abolivier <contact@brendanabolivier.com> GPG key ID: 8EF1500759F70623
3 changed files with 6 additions and 5 deletions
  1. BIN
      auth/.server.js.swp
  2. 2
    1
      auth/form.html
  3. 4
    4
      auth/server.js

BIN
auth/.server.js.swp View File


+ 2
- 1
auth/form.html View File

@@ -5,7 +5,8 @@
5 5
         </head>
6 6
         <body>
7 7
                 <form method="post" action="">
8
-                        <input type="text" placeholder="username" name="username" />
8
+                        <input type="text" placeholder="first name" name="first" />
9
+                        <input type="text" placeholder="last name" name="last" />
9 10
                         <input type="submit" value="Log in" />
10 11
                 </form>
11 12
         </body>

+ 4
- 4
auth/server.js View File

@@ -18,7 +18,7 @@ app.get('/', function(req, res, next) {
18 18
 });
19 19
 
20 20
 app.post('/', function(req, res, next) {
21
-	var identifier = req.body.username;
21
+	var identifier = req.body.first+';'+req.body.last;
22 22
 
23 23
 	var m = new MacaroonsBuilder(location, secretKey, identifier)
24 24
 		.add_first_party_caveat("status = student")
@@ -26,7 +26,7 @@ app.post('/', function(req, res, next) {
26 26
 
27 27
 	res.cookie('das-macaroon', m.serialize());
28 28
 
29
-	res.send('Logged in as ' + req.body.username + ' (student)');
29
+	res.send('Logged in as ' + req.body.first + ' ' + req.body.last + ' (student)');
30 30
 });
31 31
 
32 32
 app.get('/teacher', function(req, res, next) {
@@ -34,7 +34,7 @@ app.get('/teacher', function(req, res, next) {
34 34
 });
35 35
 
36 36
 app.post('/teacher', function(req, res, next) {
37
-	var identifier = req.body.username;
37
+	var identifier = req.body.first+';'+req.body.last;
38 38
 
39 39
 	var m = new MacaroonsBuilder(location, secretKey, identifier)
40 40
 		.add_first_party_caveat("status = teacher")
@@ -42,7 +42,7 @@ app.post('/teacher', function(req, res, next) {
42 42
 
43 43
 	res.cookie('das-macaroon', m.serialize());
44 44
 
45
-	res.send('Logged in as ' + req.body.username + ' (teacher)');
45
+	res.send('Logged in as ' + req.body.first + ' ' + req.body.last + ' (teacher)');
46 46
 });
47 47
 
48 48
 app.listen(1337, function() {