salted_login_generator 1.0.1 → 1.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/USAGE +1 -1
- data/templates/user.rb +2 -2
- data/templates/users.yml +6 -6
- metadata +1 -1
data/USAGE
CHANGED
@@ -10,7 +10,7 @@ DESCRIPTION
|
|
10
10
|
This generator creates a general purpose login system.
|
11
11
|
|
12
12
|
Included:
|
13
|
-
- a User model which uses
|
13
|
+
- a User model which uses SHA1 encryption and salted hashes for passwords
|
14
14
|
- a Controller with signup, login, welcome and logoff actions
|
15
15
|
- a Notifier that integrates with the controller to prevent script based
|
16
16
|
account creation (i.e., requires account verification from the registered
|
data/templates/user.rb
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require 'digest/
|
1
|
+
require 'digest/sha1'
|
2
2
|
|
3
3
|
# this model expects a certain database layout and its based on the name/login pattern.
|
4
4
|
class User < ActiveRecord::Base
|
@@ -29,7 +29,7 @@ class User < ActiveRecord::Base
|
|
29
29
|
protected
|
30
30
|
|
31
31
|
def self.hashed(str)
|
32
|
-
return Digest::
|
32
|
+
return Digest::SHA1.hexdigest("change-me--#{str}--")[0..31]
|
33
33
|
end
|
34
34
|
|
35
35
|
before_create :generate_uuid, :crypt_password
|
data/templates/users.yml
CHANGED
@@ -3,23 +3,23 @@
|
|
3
3
|
bob:
|
4
4
|
id: 1000001
|
5
5
|
login: bob
|
6
|
-
password:
|
7
|
-
salt:
|
6
|
+
password: 1b6f8b503fd286be77c0a71694a4a08c # atest
|
7
|
+
salt: 1f5e4e58bad3d251706290e36eaca35f
|
8
8
|
email: bob@test.com
|
9
9
|
verified: 1
|
10
10
|
|
11
11
|
existingbob:
|
12
12
|
id: 1000002
|
13
13
|
login: existingbob
|
14
|
-
password:
|
15
|
-
salt:
|
14
|
+
password: 8338805a43c01ea358e742842c1d261d # atest
|
15
|
+
salt: e5d4e5959b88990bed360b91c1495347
|
16
16
|
email: existingbob@test.com
|
17
17
|
verified: 1
|
18
18
|
|
19
19
|
longbob:
|
20
20
|
id: 1000003
|
21
21
|
login: longbob
|
22
|
-
password:
|
23
|
-
salt:
|
22
|
+
password: 909347c8133bc94fa452579f36707cb4 # alongtest
|
23
|
+
salt: e422fbcffe00b2cde7ef6582fdb3b674
|
24
24
|
email: longbob@test.com
|
25
25
|
verified: 1
|