SignIn - Sabrout/Kenllen GitHub Wiki

#MCV

Model

UserModel

Controller

SessionController ##Helper SessionsHelper ##Views SignUp View #In-depth ##Controller ###Methods Available ####Public Methods login: Takes values from textfields and logs in a user. view_signin: Generates a sign in form. logged_in?: checks whether a user is logged in or not (by checking the sessions hash) logout: logs out a current logged in user ##Helper ###Methods Available log_in:logs a user in (saving in the session hash) current_user:returns the currently logged in user logged_in?:checks whether a user is logged in (boolean function) log_out:logs a user out remember:remember a user to be logged in with a cookie forget:forget a user by deleting the given token ##Views ###view_signup view_signin: a form for signIn with the following fields

Models

User

Has the following validations non of the following can be blank

  • first name: Maximum length is 12 chars
  • last name: Maximum length is 12 chars
  • user name: Minimum length is 4 chars and 12 chars as maximum length and its a unique field
  • password: Minimum length is 6 chars and maximum length is 12 chars
  • phone: Minimum length is 6 chars and maximum length is 12 chars
  • email: is unique and has a confirmation field

Has the following methods

  • remember: remembers a user
  • User.new_token:generate a string (token) for the user
  • User.digest:hashes the given string to be saved in the database
  • authenticated?(password):checks if a given password matches the one in the database
  • forget:deletes the token in the database