-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathauth.js
More file actions
38 lines (34 loc) · 806 Bytes
/
Copy pathauth.js
File metadata and controls
38 lines (34 loc) · 806 Bytes
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
27
28
29
30
31
32
33
34
35
36
37
38
const Logging = require('./Logging.js');
function Auth(id, password){
this.studentID = id;
this.password = password;
this.logging = new Logging();
}
Auth.prototype.getID = function(){
return this.studentID;
}
Auth.prototype.login = function(){
var auth = require('request');
//url = 'http://ninsho-nw1.kudos.kindai.ac.jp:8000/cgi-bin/adeflogin.cgi';
url = 'http://ninsho-nw1.kudos.kindai.ac.jp:8001/';
auth.post(url,
{
form:{
'name': this.studentID,
'pass': this.password,
}
}
, (error, response, body) =>{
console.log("auth posted");
if(error){
message = "LoginError:" + error;
this.logging.write(message);
console.log(error);
}else{
this.logging.write("login succeeded");
console.log("auth succeeded");
}
}
);
}
module.exports = Auth;