Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement two-step auth with authenticator apps #211

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Conversation

panpawn
Copy link
Owner

@panpawn panpawn commented Jun 17, 2017

No description provided.

@panpawn
Copy link
Owner Author

panpawn commented Jun 17, 2017

I think having two fields for twostep under Gold.userData, one as .email and one as .twostep is confusing, since they both are for two-step.

What if we have .email and .authapp

I think that might be clearer.

reply += "the following command:<br />";
reply += "<code>/twostep verify [code from your authenticator]</code>";
return user.popup(reply);
}
Copy link
Owner Author

@panpawn panpawn Jun 17, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There should be a fallout here telling the user their options are either email or authentication, and maybe sending them the command's syntax

I.e.,

} else {
     return this.errorReply("In order to setup two-step authentication, you must specify if you want to use your email or a seperate two-step authentication app, such as Google Authentication. \nTo do this, use EITHER /twostep setup email OR /twostep setup authenticator.");
}

buff += `<table border="1" cellspacing ="0" cellpadding="3">`;
buff += `<tr><td colspan=3><center>${(user.codeAttempt && user.codeAttempt.length > 0 ? user.codeAttempt.join('') : '&nbsp;')}</center></td></tr>`;
buff += `<tr><td>${this.generateButton(1)}</td><td>${this.generateButton(2)}</td><td>${this.generateButton(3)}</td></tr>`;
buff += `<tr><td>${this.generateButton(4)}</td><td>${this.generateButton(5)}</td><td>${this.generateButton(6)}</td></tr>`;
buff += `<tr><td>${this.generateButton(7)}</td><td>${this.generateButton(8)}</td><td>${this.generateButton(9)}</td></tr>`;
buff += `<tr><td> </td><td>${this.generateButton(0)}</td><td> </td></tr></table></center>`;
buff += `<tr><td>${this.generateButton('&lt;-')}</td><td>${this.generateButton(0)}</td><td>${this.generateButton('R')}</td></tr></table></center>`;
Copy link
Owner Author

@panpawn panpawn Jun 17, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this mean email popups give the R key?

If so, why? Should they? Maybe use a ternary operator checking if authenticator is true or not?

let qrImg = "https://chart.googleapis.com/chart?chs=166x166&chld=L|0&cht=qr&chl=" + uri;
let reply = "|modal||html|Please enter the following code into your authenticator application or scan the QR code.<br />";
reply += "Key: " + twoAuthData.secret + "<br />";
reply += "<img src=\"" + qrImg + "\" height=\"166\" width=\"166\"><br />";
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's one big QR code

if (verified) {
Gold.userData[user.userid].email = user.twostepEmail.email;
Gold.saveData();
return this.sendReply("Two-step authentication has been officially setup for your account.");
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

... as opposed to unofficially?

This was shitty wording to begin with; remove "officially"

@panpawn
Copy link
Owner Author

panpawn commented Jun 17, 2017

Is there a particular reason as to why we give multiple emergency codes?

What is the actual use-case of giving more than just 1?

@panpawn
Copy link
Owner Author

panpawn commented Jun 17, 2017

Also yeah, don't forget to rebase this; I don't know why GitHub is acting like it doesn't have to be

@@ -111,41 +131,90 @@ exports.commands = {
setup: function (target, room, user) {
if (!user.named) return this.errorReply("You must be logged in to use this command.");
if (!user.registered) return this.errorReply("You cannot setup two-step authentication on an account that isn't registered.");
if (Gold.userData[user.userid] && (Gold.userData[user.userid].email || Gold.userData[user.userid].twostepauth)) return this.errorReply("This account already has two-step authentication enabled.");
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I can't think of how Gold.userData[user.userid] here could be undefined...

There are checks above to make sure the user is logged in and not on a guest account, so I don't think that part of the if statement is necessary... Correct me if I'm wrong?

@panpawn
Copy link
Owner Author

panpawn commented Jun 26, 2017

How much testing have you done on this latest version?

@panpawn
Copy link
Owner Author

panpawn commented Jul 2, 2017

This is going to have to be rebased (again)

@panpawn
Copy link
Owner Author

panpawn commented Jul 2, 2017

Nevermind, I rebased it for you

@panpawn panpawn closed this Oct 8, 2019
@panpawn panpawn reopened this Oct 8, 2019
@panpawn panpawn closed this Oct 8, 2019
@panpawn panpawn reopened this Oct 8, 2019
@panpawn panpawn closed this Oct 27, 2019
@panpawn panpawn reopened this Oct 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants