|
|
@@ -26,6 +26,13 @@ AccountManager.prototype.fromSlackIdAuth = function(id, cb) {
|
|
|
});
|
|
|
};
|
|
|
|
|
|
+AccountManager.prototype.fromIrcPass = function(pass, cb) {
|
|
|
+ var self = this;
|
|
|
+ db.database.queryFirst(TABLE_NAME, { authIrcPass: pass }, (err, result) => {
|
|
|
+ cb(self.fromDb(result));
|
|
|
+ });
|
|
|
+};
|
|
|
+
|
|
|
AccountManager.prototype.fromId = function(id, cb) {
|
|
|
var self = this;
|
|
|
db.database.queryFirst(TABLE_NAME, { id: id }, (err, result) => {
|
|
|
@@ -45,6 +52,7 @@ function Account(dbResult) {
|
|
|
this.authGoogleUserId;
|
|
|
this.authFacebookUserId;
|
|
|
this.authSlackUserEmailAndTeam;
|
|
|
+ this.authIrcPass;
|
|
|
|
|
|
this.certificates;
|
|
|
this.cguReadAndAccepted;
|
|
|
@@ -58,6 +66,7 @@ function Account(dbResult) {
|
|
|
this.authSlackUserEmailAndTeam = dbResult.authSlackUserEmailAndTeam;
|
|
|
this.authGoogleUserId = dbResult.authGoogleUserId;
|
|
|
this.authFacebookUserId = dbResult.authFacebookUserId;
|
|
|
+ this.authIrcPass = dbResult.authIrcPass;
|
|
|
|
|
|
this.certificates = dbResult.certificates;
|
|
|
this.cguReadAndAccepted = !!dbResult.cguReadAndAccepted;
|
|
|
@@ -69,6 +78,7 @@ function Account(dbResult) {
|
|
|
this.authSlackUserEmailAndTeam = null;
|
|
|
this.authGoogleUserId = null;
|
|
|
this.authFacebookUserId = null;
|
|
|
+ this.authIrcPass = null;
|
|
|
|
|
|
this.createCertificate();
|
|
|
this.cguReadAndAccepted = false;
|
|
|
@@ -82,6 +92,7 @@ Account.prototype.toDb = function() {
|
|
|
authGoogleUserId: this.authGoogleUserId
|
|
|
,authFacebookUserId: this.authFacebookUserId
|
|
|
,authSlackUserEmailAndTeam: this.authSlackUserEmailAndTeam
|
|
|
+ ,authIrcPass: this.authIrcPass
|
|
|
,certificates: this.certificates
|
|
|
,cguReadAndAccepted: this.cguReadAndAccepted ? 1 : 0
|
|
|
,services: JSON.stringify(this.services)
|
|
|
@@ -94,6 +105,13 @@ Account.prototype.createCertificate = function() {
|
|
|
this.certificates = null;
|
|
|
};
|
|
|
|
|
|
+Account.prototype.generateIrcPass = function() {
|
|
|
+ // FIXME secure token generator
|
|
|
+ this.edit();
|
|
|
+ this.authIrcPass = "test";
|
|
|
+ return this;
|
|
|
+};
|
|
|
+
|
|
|
Account.prototype.addService = function(serviceType, serviceName, serviceId, oauthParam) {
|
|
|
this.services.push([serviceType, serviceName, serviceId, oauthParam]);
|
|
|
};
|
|
|
@@ -150,6 +168,7 @@ module.exports.updateTable = function(dbObject, currentVersion, cb) {
|
|
|
+"`authGoogleUserId` STRING UNIQUE,"
|
|
|
+"`authFacebookUserId` STRING UNIQUE,"
|
|
|
+"`authSlackUserEmailAndTeam` STRING UNIQUE,"
|
|
|
+ +"`authIrcPass` STRING UNIQUE,"
|
|
|
+"`certificates` STRING,"
|
|
|
+"`cguReadAndAccepted` BOOLEAN NOT NULL DEFAULT FALSE,"
|
|
|
+"`services` STRING NOT NULL"
|