Skip to content

Commit

Permalink
addded secure password to users
Browse files Browse the repository at this point in the history
  • Loading branch information
ankitchauhan2065 committed Apr 9, 2018
1 parent 849e1ab commit d9bb154
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ source 'https://rubygems.org'
# Bundle edge Rails instead: gem 'rails', github: 'rails/rails'
gem 'rails', '4.2.5'
# Use sqlite3 as the database for Active Record

gem 'bcrypt', '~> 3.1.7'
# Use SCSS for stylesheets
gem 'bootstrap-sass', '~> 3.3.7'
gem 'sass-rails', '~> 5.0'
Expand Down
2 changes: 2 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ GEM
arel (6.0.4)
autoprefixer-rails (8.2.0)
execjs
bcrypt (3.1.11)
binding_of_caller (0.8.0)
debug_inspector (>= 0.0.1)
bootstrap-sass (3.3.7)
Expand Down Expand Up @@ -164,6 +165,7 @@ PLATFORMS
ruby

DEPENDENCIES
bcrypt (~> 3.1.7)
bootstrap-sass (~> 3.3.7)
byebug
coffee-rails (~> 4.1.0)
Expand Down
5 changes: 5 additions & 0 deletions app/models/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,9 @@ class User < ActiveRecord::Base
uniqueness: { case_sensitive: false },
length: { maximum: 105 },
format: { with: VALID_EMAIL_REGEX }

has_secure_password



end
5 changes: 5 additions & 0 deletions db/migrate/20180409145314_add_password_digest_to_users.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class AddPasswordDigestToUsers < ActiveRecord::Migration
def change
add_column :users, :password_digest, :string
end
end
3 changes: 2 additions & 1 deletion db/schema.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.

ActiveRecord::Schema.define(version: 20180409122957) do
ActiveRecord::Schema.define(version: 20180409145314) do

create_table "articles", force: :cascade do |t|
t.string "title"
Expand All @@ -26,6 +26,7 @@
t.string "email"
t.datetime "created_at"
t.datetime "updated_at"
t.string "password_digest"
end

end

0 comments on commit d9bb154

Please sign in to comment.