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

User account creation and login #1

Closed
sizzlemctwizzle opened this issue Nov 6, 2013 · 20 comments
Closed

User account creation and login #1

sizzlemctwizzle opened this issue Nov 6, 2013 · 20 comments
Labels
feature Something we don't already have implemented to the best of knowledge but would like to see.
Milestone

Comments

@sizzlemctwizzle
Copy link
Member

This is probably the first feature we need to implement. I'd focus on getting OpenID to work first (we basically become an OpenID provider for those who don't already have one: node library). We'll keep user information in the DB, and each user will have a userRole which will be a number that corresponds to a textual value in a userRoles.json file. Here's the values I suggest (higher userRole values have all the privileges of lesser values):

  • 1 - User: Anyone who can sign up. This user can use all the basic features of the site, like open issue, write reviews, flag spam, etc.
  • 2 - Script Writer: This is a user who either has an OpenID or GH account, and has posted script(s) on the site.
  • 3 - Moderator: This user active on the site and actively flags spam. They can remove content that has been flagged as spam using some set threshold.
  • 4 - Admin: This user has been a moderator for awhile, and has actively contributed to the source code of the site. An admin can remove any content posted on the site by a user with a lesser userRole. An admin can make any user a moderator or take away moderator privileges, and nominate a moderator to be an admin. Another admin must confirm the nomination before the nominee becomes an admin.
  • 5 - Founding Father: Anyone who actively participated in the initial development of the site. This user can appoint and remove any user as an admin, and remove any content posted on the site by a user with a lesser userRole.
@sizzlemctwizzle
Copy link
Member Author

I'll tackle this issue. It involves setting up a DB, using mongoose, and tying in OpenId. For this issue to be closed, a user must be able to sign up, log in (with session data), and be able to see they are logged in. I already have some experience working with session data in node so I have a leg up. I'll implement the roles but they won't do anything except be displayed on the user profile.

sizzlemctwizzle added a commit to sizzlemctwizzle/OpenUserJS.org that referenced this issue Nov 9, 2013
@sizzlemctwizzle
Copy link
Member Author

Okay, I just pushed a branch that implements a simple user login (along with session data), so that others can join the party on this issue if they want. Integration with a DB and OpenId, still need to be added before this issue can be resolved.

@sizzlemctwizzle
Copy link
Member Author

Reading the passport module's api is giving me a chub.

@cletusc
Copy link
Contributor

cletusc commented Nov 10, 2013

No opinions allowed: do that shit. :P

@sizzlemctwizzle
Copy link
Member Author

First of all, I've been busy today setting up the site to work on Nodejitsu (with continuous deployment) and fighting to get the domain to work, so I'm taking the rest of the night off. I have a few other things that I need to do tomorrow so I might not get this implemented for a few days.

That said, to use OpenID we need to be a provider. Apparently, the openid module provides for "simple registration", although it provides no examples of how to use this so I'll have to dig into the code to see if this is possible. If not, the passport module (which we'll use either way) provides for all our authentication needs and even has a simple login with a username and password (if it comes to this). We could also direct our users to some other OpenID provider (not desirable), but maybe one has an api that we could tie into to keep the user on our site for registration. I'll look into the latter option if "simple registration" falls through. Anyway, just chronicling my discoveries so I can remember later or so someone else can have a go at it.

@sizzlemctwizzle
Copy link
Member Author

Okay. There are no implementations of an OpenID provider for node. There are implementations in languages I know (Java, PHP, Perl), but they're huge and I'm way too fucking lazy to try and port one of them over.

@sizzlemctwizzle
Copy link
Member Author

Here are the logins we will accept:

GitHub
Google
Facebok
Twitter
Reddit
Yahoo!
imgur
Flickr
LinkedIn
Amazon
PayPal
Windows Live
AOL
Netflix

If you have none of these use this:

OpenID via claimID

@sizzlemctwizzle
Copy link
Member Author

Here is what I have so far. You need an authKeys.json file to run this locally. But check it out live.

@sizzlemctwizzle
Copy link
Member Author

Logging in with AOL will now work locally if you edit controllers/strategies.json to have "aol" as the only entry.

@joesimmons
Copy link
Member

When I click login with GitHub, I get Internal Server Error on /auth/github

ps: I would really like a chat program to chat with you in real-time. Don't care what it is.

@sizzlemctwizzle
Copy link
Member Author

I get the same thing with every authenticator I've tried. I don't know what's up. I'm just glad I can finally push code that others can also test and debug. There is a development DB included in the source if you hadn't noticed.

@joesimmons
Copy link
Member

No, I hadn't. Don't have the slightest idea about the login code. Just here to test it atm.

@sizzlemctwizzle
Copy link
Member Author

Well I can tell that the error occurs during the callback. It probably has something to do with me rearranging shit and that I wrote that code when I was just beginning to understand MongoDB. I could probably fix it pretty quickly, but unfortunately I have other things that I need to get done right now. I'll work on it in a day or two if anyone hasn't fixed it by then.

@joesimmons
Copy link
Member

I'm going to look into OAuth and Passport, read up all about it so I can hopefully help in the future.

@sizzlemctwizzle
Copy link
Member Author

I found and fixed a bug that should allow for most registration (confirmed for Facebook and Yahoo), except GH. I don't know why i get that internal server error.

@simonzack
Copy link
Member

I tried to test this but only have dummy client id's for passport, do you have working ones anywhere?

@sizzlemctwizzle
Copy link
Member Author

It works with Facebook.

@sizzlemctwizzle
Copy link
Member Author

You can now login and sign up with GitHub! Even if you already have an account (like me), you can still link it to your GH account and use that to log in from now on.

This was referenced Nov 23, 2013
@jerone
Copy link
Contributor

jerone commented Nov 30, 2013

Can we close the branch for this issue?

@sizzlemctwizzle
Copy link
Member Author

Removing a branch from GitHub isn't exactly simple. I say we wait until the milestone (0.1) is finished before we clean house.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature Something we don't already have implemented to the best of knowledge but would like to see.
Development

No branches or pull requests

6 participants