Name: Sidharth Bansal
Affiliation (school/degree) 2nd yr, B. Tech, Software Engineering Course at Delhi Technological University, India
Location (where you are): New Delhi, India (GMT +5:30)
LinkedIn Profile: https://www.linkedin.com/in/sidharth-bansal-99648b129/
IRC nick: Sidharth
Project(s) you're working on or want to: plots2
Abstract/summary (<20 words)
Authorising users through Google, Facebook, Github and Twitter through Omniauth gem.
Upgrade the current bootstrap version 3 to version 4.
Describe the need your project fulfils:
Mentors' guidance and documentation.
Few important links are
How will your project meet this need?
The project's need is to give the users the ability to sign up and log in to various social media websites like Facebook, Google, Github and Twitter. This project will allow the users not to fill in the details again at Public Lab. The account of a user will be linked so that if a user links through any one of the accounts, he will be able to log in and will be able to use any of his/her accounts properly.
Secondly, the project will ultimately give a better experience to the user after we shall upgrade to Bootstrap 4
Community Bonding period (April 23 16:00 UTC - May 14)
Read the documentation, get up to speed to begin working on their projects, discussing the plans with the mentors.
Phase 1 Work Period (May 14 -June 15 16:00 UTC)
May 21 - May 31 Login to Google
June 1 - June 8 Login to Twitter
June 9 - June 15 Bug fixes and documentation of the first evaluation
Evaluation (June 11 16:00 UTC -June 15 16:00 UTC)
Writing research note on the first evaluation of the GSoC Proposal
Phase 2 Work Period (June 16 -- July 9 16:00 UTC)
June 16 - June 20 Login to Github
June 20 - June 23 Completion Of the first part of the project - OAuth
June 23 - June 30 Replacement of glyphicons with font awesome
July 1 - July 9 Fix Pagination
Evaluation (July 9 16:00 UTC - July 13 16:00 UTC)
Writing research note on the second evaluation of the GSoC Proposal
Phase 3 Work Period (July 14 -August 5)
July 14 - July 21 Fix Navigation links
July 22 - July 28 Fix Navigation bars
July 29 - August 31 Replace deprecated code to modern alternatives
Evaluation (August 6 - August 14 16:00 UTC)
Writing final Evaluation research note according to GSoC guidelines and checking that all tests pass or any Bug fixes in the code and submitting final evaluations
This would include the basic login and signup through the Facebook, Google, Github and Twitter. There would be integration tests for the same. Documentation of the various gems used will also be a part of it.
Authentication systems have a User model which handles most of the authentication logic but having multiple logins forces to correctly separate the concepts of an Identity and a User. An Identity is a particular authentication method which a user has used to identify themselves with public labs whilst a User manages data which is directly related to public lab website itself.
class CreateIdentities <ActiveRecord::Migration def change create_table :identities do |t| t.string :uid t.string :provider t.references :user end add_index :identities, :user_id end end
# app/models/user.rb class User < ActiveRecord::Base has_many :identities def self.create_with_omniauth(info) create(name: info['name']) end end # app/models/identity.rb class Identity < ActiveRecord::Base belongs_to :user def self.find_with_omniauth(auth) find_by(uid: auth['uid'], provider: auth['provider']) end def self.create_with_omniauth(auth) create(uid: auth['uid'], provider: auth['provider']) end ... end
So a user can have multiple identities and each identity belongs to a single user.
#config/initializers/omniauth.rb Rails.application.config.middleware.use OmniAuth::Builder do Provider :twitter, 'CONSUMER_KEY', 'CONSUMER_SECRET' Provider :facebook, 'APP_ID', 'APP_SECRET' ... end
This code adds OmniAuth to the Rack middleware. OmniAuth itself is now configured!
The bulk of our work will now go into handling the authentication request.
Next, we need to handle logging in and logging out. This is managing session data since a logged in user is simply a person who has some session data confirming that they have been logged in. The OmniAuth callback which a provider will redirect to upon authenticating a user is /auth/:provider/callback so lets set up a route and a controller to handle this.
# config/routes.rb Plots2::Application.routes.draw do match '/auth/:provider/callback', to: 'sessions#create', via: [:get, :post] match '/logout', to: 'sessions#destroy', via:[:get, :post] end
# app/controllers/users_sessions_controller.rb class UsersSessionsController < ApplicationController def create auth = request.env['omniauth.auth'] #Find an identity here @identity = Identity.find_with_omniauth(auth) if @identity.nil? #If no identity was found, create a brand new one here @identity =Identity.create_with_omniauth(auth) end if signed_in? if @identity.user == current_user #User is signed in so they are trying to link an identity to their account. But we found the identity and the user associated with it is the current user. So the identity is already associated with this user. So let's display an error message. #redirect_to root_url, notice: "Already linked that account!" else #The identity is not associated with the current_user so let's associate the identity @identity.user = current_user @identity.save redirect_to root_url, notice: "Successfully linked that account!" end else if @identity.user.present? #The identity we found had a user associated with it so let's just log them in here self.current_user = @identity.user redirect_to root_url, notice: "Signed in!" else #No user associated with the identity so we need to create a new one redirect_to new_user_url, notice: "Please finish registering" end end end def destroy self.current_user = nil redirect_to root_url, notice: "Signed out!" end ... end
Now to log in, all a user needs to do is go to /auth/provider and they will get redirected to Users_Sessions Controller create method after authenticating. So there are a number of possibilities when they hit this action:
- A user has never used public labs before. They have neither User model nor Identity: Then the user needs to fill in the registration form. This will create a user in the database
- A user is logged out but they have logged into public lab website with a provider previously. They are now signing in with the same one again: The user will be able to access their account
- Just as above but they are now signing in with a different provider: There are two possible cases. First, the identity is present in the database, then they are logged in and can access their user account. Second, the identity is not present in the database then they are redirected to the registration form to sign up at public labs.
- A user is logged in with a provider but they try to login with the same provider again: This will unlink the provider from the user model
- A user is logged in but they try to login with a different provider: This will have 2 cases. First, the user wants to link provider X to account A but user already has provider X with account B. Then the user can simply unlink the identity of X from the user model and then relink provider X to account B(in other words destroy identity A and make new identity B). The second case is the user is not having any identity of that provider then the identity is created.(Say I have the Facebook identity but no twitter identity then the Twitter identity is created)
Also, I would like to mention that we cannot have a direct sign up from the provider (without registering through /signup even once) because of many reasons:
- User model must have an email. If we are directly writing into the user model then twitter login cannot be made because twitter does not provide email addresses.
- A user can have multiple providers. This capability can only be achieved by has many relationships. Hence, we need to have an identity associated with the user.
- If a user directly signs up through a provider and then unlinks his same provider account then that will result in the deletion of the user account
- There are potential chances of having username same for the user model currently present in the public lab's production database and the username given by the provider so that will result in a conflict
- There would be no way of merging accounts of the different provider but of the same person.
- A user will have only one provider, so he cannot access the account via another provider.
- The case when the person deletes his provider X account A but does not delete his account B on the public lab(say person deletes his facebook account permanently) then he will be no longer able to access his account at public labs
- When a person deletes his old account and makes a new account at twitter, facebook, google etc.(Even though there are negligible chances but we need to consider at the time of defining relationships) then the user will not be able to access his previous account at public labs.
- Consider the case, when one provider is gone from the market(I am considering the worst case scenario, eg Orkut was a social networking site which is no longer used) then there would be a need to delete the provider's account. That will result in the users account deletion
Hence, we cannot have a direct sign up from a provider. Instead, the user will need to first sign up through the registraion form then he can add providers to his user model. After the linking is successful the user will be able to directly log in through the provider. We will be using identities which will be associated with the user model. They can be created or deleted as per the user's need. This will not result in any deletion of account from public labs(until the user wants to delete his account in the public lab) when any discrepancy would happen in future. We could at the later stages (whenever needed ) add other providers like LinkedIn, Instagram etc.
The linking/unlinking would be done through the /profile/edit path
The workflow is as follows
The header will look like this
Login form will be as follows
Outreach plan: The second part of the project that is upgradation to the bootstrap 4 from bootstrap 3 is a big project. There I will like to invite new contributors to join the public labs and to contribute to my project and thus, ultimately to the public labs.
Also, I will like to do a seminar in the month of August at Delhi Technological University so that after the period of GSoC new contributors can come and join the community. This would be a part of the final evaluation and would be conducted on any suitable date between 6 August to 14 August.
As I did earlier, I will be engaged in making fto issues related to other ongoing milestones too.
What is broader goal your project working towards?
Socialisation and code enhancement
What resources will you need: people, documentation, literature, sample data, hardware if applicable
The contributors, mentors and the team members of the open source community are the most relevant resources for completion of the project. Also, I will be learning more from their official documentation. I believe my Mentors guidance will perhaps be the greatest resource for me.
Getting more people involved in open projects is not an easy task. Lowering the barrier for non-technical people will lower the effort that needs to be taken to get enough volunteers. As a side-effect, more people get in contact with science and they will see that it does not need an academical background to be a scientist. This surely is a benefit in multiple ways.
Have you forked the relevant codebases? Installed them in a dev environment such as Cloud9.io? Need help doing so? Please provide a link to each of the above.
Yes, I have forked the GitHub repo and deployed it on my local machine.
Describe your technical background; what languages you use, what projects you've contributed to before, links to GitHub or other code repositories or samples. Have you read the Contributor Guidelines at https://publiclab.org/wiki/contributing-to-public-lab-software and are you comfortable submitting pull requests?
Skills and expertise:
Web Technologies Ruby on Rails and related skills
Version Control System Git
Yes, I have read the Contributors guidelines
More than 44 Merged pull requests for various suggestions, bug fixes, issues on plots2
Over 60 issues, bugs, suggestions reported by me
These are the links to the First Timer Issues created by me
and many more
There are also many existing issues and pull requests currently in progress by me.
Thus, I am comfortable with Pull request and Github. Yes, I have read the contribution guidelines
Describe teams you've worked with before, whether the open or closed source and in what capacity you participated. Cite examples of how you were self-motivated and self-sufficient.
I started learning RoR a year before apart from my university curriculum, so I had to learn and understand those concepts myself. I think I can achieve every goal by hard work and giving time.
Yeah, I have worked in a group of two. Nicolas Santiago Blair and I have done two small projects Contact Manager and Event Manager together with Pair Programming in order to learn. As we lived in different countries so it was developed by both of us by collaborating at cloud9. We did each commit together while having a phone call on skype.
Links to the projects GitHub repositories:
Would you describe yourself as especially good at or interested in some aspect of coding or problem solving, or open source science? Provide examples and links. Are you particularly suited to this proposed project?
I am very good at competitive coding. I have done 500+ questions on various competitive programming websites like Codechef, Spoj, Hacker Rank, etc. One can see my stop stalk profile to see it at https://www.stopstalk.com/user/profile/bansal_sidharth2996. It lists clearly how much I have done on which site and of which category.
So, I am good at problem-solving.
Also, it has been around one and a half year learning Ruby on Rails. I have done many projects on Ruby on Rails like Pinteres_clone, Reddit_clone, Recipe box Event Manager, Podcast, Contact Manager etc. These projects are present on my GitHub account.
I have also done some projects in a group of two like Contact Manager and Event Manager by doing Pair Programming.
In open source, I have contributed to the Opensuse and Public Lab.
Yes, I think I am suitable for this project
Whom will your work serve? Lay users, other programmers, non-technical people or nerds? While exploring advanced techniques is great, we especially appreciate proposals which make technologies and techniques more legible and user-friendly to non-technical users.
My proposal's implementation will be beneficial to all users.
The proposal deals with the ease of the login for new and old users.
Also, it caters the needs of the Facebook-savvy people. People will be able to post onto the existing research notes through facebook. This will increase the number of people involved in the Public Lab community.
The second part deals with the better user experience which comes in with Bootstrap 4
What motivates you to do the proposed work? Do you also have coursework or degree related reasons for pursuing it? This wouldn't necessarily be a bad thing - if you are for example looking to explore work related to a thesis topic.
A man should always accept challenges which are difficult for him/her to come out of his/her present domain. Challenges make a man stretch over what you currently are. So, challenges motivate me.
I am a person who can't sit idle. I want to explore more and more things. So, my inquisitiveness to know more motivates me the most.
I am a second-year university student. I am inside the Computer Science Department. So, in my curriculum, I have DBMS, Web Development, Software Engineering and many other related subjects which are beneficial for the fulfilment of this project.
Also apart from my college, I am doing an online Rails Bootcamp -- The Odin Project available at www.theodinproject.com. So, I have related coursework and reasons for pursuing it.
Yeah, I want to write research papers in my 3rd year of the university.
Explain how you intend to continue being an active member of your project and/or Public Laboratory AFTER the summer is over.
Even after the summer gets over I want to continue contributing to plots2 and become an active member of Publiclab community.
There are many issues related to the UI/UX at Public Labs. Also, new issues in future will evolve with time. I will give my best to make it resolve them and add new features to the codebase.
Do you understand this is a serious commitment, equivalent to a full-time paid summer internship or summer job?
Yes, I am fully aware that it is a full-time summer iinternship. As it is of three months duration and its a small period of duration so, I will only choose those online courses which are related to the completion of my project. Also, Google is paying me for it, hence, I am fully committed to working on it throughout the summer. I will give my 100% to it.