Bubbles_glow

≡ Hypertextopia Manifesto ≡

 
Corner_fold
  • Citation
  • Description
  • Explanation
Picture_7_catalog
 
Flowchart_grey_24

Author

require 'digest/sha1'
class Author < ActiveRecord::Base
  include Comparable
  include ImageReady
  validates_presence_of :first_name, :hashed_password, :salt, :username, :email
  validates_uniqueness_of :username
  has_many :stories, :dependent => :destroy, :order => 'title ASC'
  has_one :image, :as => :image_ready, :dependent => :destroy
  has_one :feature, :as => :featureable, :dependent => :destroy


 
This loads in digest/sha1, which is a module for cryptographic encoding. The Author uses this to encrypt the passwords, so that no passwords are stored on Hypertextopia, only their encrypted hashes. Even if someone were to steal the database and run off with it, they would be unable to read the passwords.