Skip to content

Commit

Permalink
Merge pull request #24 from two-factor/twoauth
Browse files Browse the repository at this point in the history
change twofactor to twoauth to reflect name change
  • Loading branch information
Dnaganog authored Jul 7, 2019
2 parents 1c8c6b2 + e4735d5 commit 935dc05
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ class Client {
.catch(err => {
throw new Error("Two Factor Unable to connect to Mongo");
});
this.TwoFactorUser = mongoose.model("TwoFactorUser", userSchema);
this.TwoAuthUser = mongoose.model("two-auth-user", userSchema);
this.create = mongooseCreate;
this.send = mongooseSend;
this.verify = mongooseVerify;
Expand Down
4 changes: 2 additions & 2 deletions mongoose/create.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
function create(userID, phone) {
const client = this.client;
const users = this.users;
const TwoFactorUser = this.TwoFactorUser;
const TwoAuthUser = this.TwoAuthUser;

return new Promise((resolve, reject) => {
if (typeof phone !== "string") {
Expand All @@ -19,7 +19,7 @@ function create(userID, phone) {
.create({ friendlyName: `Service for ${userID}` })
.then(service => {
const { sid } = service;
TwoFactorUser.create({
TwoAuthUser.create({
userID,
sid,
phone
Expand Down
4 changes: 2 additions & 2 deletions mongoose/send.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
function send(userID) {
const users = this.users;
const client = this.client;
const TwoFactorUser = this.TwoFactorUser;
const TwoAuthUser = this.TwoAuthUser;
return new Promise((resolve, reject) => {
TwoFactorUser.findOne({ userID: userID })
TwoAuthUser.findOne({ userID: userID })
.then(user => {
const { sid, phone } = user;
if (!sid) reject(new Error("SID Error: No SID exists for this user."));
Expand Down
4 changes: 2 additions & 2 deletions mongoose/verify.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
// status is true if verification succeeded, false if verification failed

function verify(userID, code) {
const TwoFactorUser = this.TwoFactorUser;
const TwoAuthUser = this.TwoAuthUser;
return new Promise((resolve, reject) => {
TwoFactorUser.findOne({ userID })
TwoAuthUser.findOne({ userID })
.then(user => {
const { sid, phone } = user;
if (!sid) reject(new Error("SID Error: No SID exists for this user."));
Expand Down

0 comments on commit 935dc05

Please sign in to comment.