mirror of
https://github.com/TracksApp/tracks.git
synced 2026-01-06 17:28:50 +01:00
Salting is unnecessary, BCrypt takes care of it
Source: http://en.wikipedia.org/w/index.php?title=Bcrypt&oldid=439692871
This commit is contained in:
parent
42437eadfa
commit
e7301608a6
2 changed files with 5 additions and 5 deletions
|
|
@ -124,7 +124,7 @@ class User < ActiveRecord::Base
|
|||
|
||||
if Tracks::Config.auth_schemes.include?('database')
|
||||
return candidate if candidate.auth_type == 'database' &&
|
||||
BCrypt::Password.new(candidate.crypted_password) == salted(pass)
|
||||
BCrypt::Password.new(candidate.crypted_password) == pass
|
||||
end
|
||||
|
||||
if Tracks::Config.auth_schemes.include?('ldap')
|
||||
|
|
@ -222,7 +222,7 @@ protected
|
|||
end
|
||||
|
||||
def self.hash(s)
|
||||
BCrypt::Password.create salted s
|
||||
BCrypt::Password.create s
|
||||
end
|
||||
|
||||
def crypt_password
|
||||
|
|
|
|||
6
test/fixtures/users.yml
vendored
6
test/fixtures/users.yml
vendored
|
|
@ -2,7 +2,7 @@
|
|||
admin_user:
|
||||
id: 1
|
||||
login: admin
|
||||
crypted_password: <%= BCrypt::Password.create("#{Tracks::Config.salt}--abracadabra--") %>
|
||||
crypted_password: <%= BCrypt::Password.create("abracadabra") %>
|
||||
token: <%= Digest::SHA1.hexdigest("adminSat Feb 25 17:14:00 GMT 20060.236961325863376") %>
|
||||
is_admin: true
|
||||
first_name: Admin
|
||||
|
|
@ -12,7 +12,7 @@ admin_user:
|
|||
other_user:
|
||||
id: 2
|
||||
login: jane
|
||||
crypted_password: <%= BCrypt::Password.create("#{Tracks::Config.salt}--sesame--") %>
|
||||
crypted_password: <%= BCrypt::Password.create("sesame") %>
|
||||
token: <%= Digest::SHA1.hexdigest("janeSun Feb 19 14:42:45 GMT 20060.408173979260027") %>
|
||||
is_admin: false
|
||||
first_name: Jane
|
||||
|
|
@ -32,7 +32,7 @@ ldap_user:
|
|||
sms_user:
|
||||
id: 4
|
||||
login: sms_user
|
||||
crypted_password: <%= BCrypt::Password.create("#{Tracks::Config.salt}--sesame--") %>
|
||||
crypted_password: <%= BCrypt::Password.create("sesame") %>
|
||||
token: <%= Digest::SHA1.hexdigest("sms_userSun Feb 19 14:42:45 GMT 20060.408173979260027") %>
|
||||
is_admin: false
|
||||
first_name: SMS
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue