luarocks / luarocks-site

LuaRocks website and module host
http://luarocks.org
175 stars 38 forks source link

[WIP] - Enable Login/Register with GitHub #113

Closed aajjbb closed 6 years ago

aajjbb commented 7 years ago

It's the first draft of the PR to add the capabilities to log in and register with a GitHub account. Some points to be discussed are:

leafo commented 7 years ago

Will we use the same GitHub username to be an users username in LuaRocks ? In case of a conflict, how to proceed ?

I think we should use the username if it's available, if it isn't available then we should generate a new one, maybe something like leafo-1, leafo-2 etc. until an available one is found. (In the future it might be nice to have a way to edit an account's username from the settings page)

leafo commented 7 years ago

LuaRocks accounts needs an password, what to use as a password to accounts created from GitHub profiles ?

We can either make them set a password when creating an account, or we can make the password column nullable. I think it's fine to make it nullable, since it would be less friction to sign up with github.

aajjbb commented 7 years ago

About making users.encrypted_password nullable. I haven't found a change_column function in lapis.db.schema. What's is the best way to change the column then ?

leafo commented 7 years ago

@aajjbb you can use db.query with alter table as seen here: https://github.com/luarocks/luarocks-site/blob/master/migrations.moon#L89

The query would be:

alter table users alter column encrypted_password drop not null
leafo commented 6 years ago

For writing tests, you can check spec/applications/github_spec.moon. There's already an example there of stubbing the github api response. You should add new test variations that test registering an account, finding an existing one, etc.

leafo commented 6 years ago

I rebased and manually merged this. Creating a follow up ticket for the email issue