Skip to content

User and Authentication

Ishan Khatri edited this page Aug 23, 2019 · 1 revision

Reasoning

In order to securely log in users into our application, we use the devise gem for rails. Which allows use to sing up and log in users securely. The gem encrypts the password in a way that we are not even able to access it (which is good).

Database SQL Table

string   "first_name",                                  null: false
string   "last_name",                                   null: false
string   "email",                  default: "",         null: false
string   "encrypted_password",     default: "",         null: false
string   "reset_password_token"
datetime "reset_password_sent_at"
datetime "remember_created_at"
integer  "sign_in_count",          default: 0,          null: false
datetime "current_sign_in_at"
datetime "last_sign_in_at"
string   "current_sign_in_ip"
string   "last_sign_in_ip"
datetime "created_at",                                  null: false
datetime "updated_at",                                  null: false
string   "user_type",              default: "attendee"            

User Types

  • admin Pretty much fucking god.
  • organizer Able to access hardware, application information, and most administrative tools.
  • attendee Able to create applications, use mentorship system, schedule and more.
  • mentor Only able to access mentorship dashboard and live schedule and all public pages.

Views

All the views for registration are included in the directory app/views/devise. These views are rather special since they use some weird routing and don't have a controller for security purposes.

Model

The model called user.rb includes all the helper methods that one might need to perform in a user.

  • is_attendee? Returns true if a user is an attendee.
  • is_mentor? Returns true if a user is a mentor.
  • is_organizer? Returns true if a user is an organizer.
  • is_admin? Returns true if a user is an admin.
  • full_name Returns the full name of the user

Controller

The User controller is built into devise and we don't really need to touch it. In case that we want one, there's a way to override devise to have it, but as of right now it's not necessary.