sinatra-authentication 0.2.3 → 0.2.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/models/mongomapper_user.rb +2 -1
- data/readme.markdown +7 -5
- data/sinatra-authentication.gemspec +1 -1
- metadata +1 -1
@@ -4,12 +4,13 @@ class MmUser
|
|
4
4
|
key :email, String, :length => (5..40), :unique => true
|
5
5
|
key :hashed_password, String
|
6
6
|
key :salt, String
|
7
|
-
key :created_at, DateTime
|
8
7
|
key :permission_level, Integer, :default => 1
|
9
8
|
if Sinatra.const_defined?('FacebookObject')
|
10
9
|
key :fb_uid, String
|
11
10
|
end
|
12
11
|
|
12
|
+
timestamps!
|
13
|
+
|
13
14
|
attr_accessor :password, :password_confirmation
|
14
15
|
#protected equievelant? :protected => true doesn't exist in dm 0.10.0
|
15
16
|
#protected :id, :salt
|
data/readme.markdown
CHANGED
@@ -2,10 +2,11 @@
|
|
2
2
|
|
3
3
|
## INSTALLATION:
|
4
4
|
|
5
|
-
in your sinatra app simply require either "dm-core", "rufus-tokyo" or "mongo_mapper" and then "sinatra-authentication" and turn on session storage
|
5
|
+
in your sinatra app simply require either "dm-core", "rufus-tokyo" or "mongo_mapper", "digest/sha1" and then "sinatra-authentication" and turn on session storage
|
6
6
|
with a super secret key, like so:
|
7
7
|
|
8
8
|
require "dm-core"
|
9
|
+
require "digest/sha1"
|
9
10
|
require "sinatra-authentication"
|
10
11
|
|
11
12
|
use Rack::Session::Cookie, :secret => 'A1 sauce 1s so good you should use 1t on a11 yr st34ksssss'
|
@@ -13,6 +14,7 @@ with a super secret key, like so:
|
|
13
14
|
If you're using rufus-tokyo, you also need to set the database path for Users. like so:
|
14
15
|
|
15
16
|
require "rufus_tokyo"
|
17
|
+
require "digest/sha1"
|
16
18
|
require "sinatra-authentication"
|
17
19
|
TcUserTable.cabinet_path = File.dirname(__FILE__) + 'folder/where/you/wanna/store/your/database'
|
18
20
|
|
@@ -28,13 +30,13 @@ with a super secret key, like so:
|
|
28
30
|
* get/post '/users/:id/edit'
|
29
31
|
* get '/users/:id/delete'
|
30
32
|
|
33
|
+
If you fetch any of the user pages using ajax, they will automatically render without a layout
|
34
|
+
|
31
35
|
## ADDITIONAL ROUTES WHEN USING SINBOOK FOR FACEBOOK INTEGRATION:
|
32
36
|
|
33
37
|
* get '/reciever'
|
34
38
|
* get '/connect'
|
35
39
|
|
36
|
-
If you fetch any of the user pages using ajax, they will automatically render without a layout
|
37
|
-
|
38
40
|
## HELPER METHODS:
|
39
41
|
|
40
42
|
This plugin provides the following helper methods for your sinatra app:
|
@@ -46,7 +48,7 @@ This plugin provides the following helper methods for your sinatra app:
|
|
46
48
|
* render_login_logout(html_attributes)
|
47
49
|
> Which renders login/logout and singup/edit account links.
|
48
50
|
If you pass a hash of html parameters to render_login_logout all the links will get set to them.
|
49
|
-
Which useful for if you're using some sort of lightbox
|
51
|
+
Which is useful for if you're using some sort of lightbox
|
50
52
|
|
51
53
|
## SIMPLE PERMISSIONS:
|
52
54
|
|
@@ -132,7 +134,7 @@ The 'render_facebook_connect_link' helper uses html instead of fbml, so ajax req
|
|
132
134
|
will render the connect link without you needing to parse any fbml.
|
133
135
|
|
134
136
|
If the user is already logged into the app and connects with facebook via the user edit page,
|
135
|
-
it adds their fb_uid to their profile in the database
|
137
|
+
it adds their fb_uid to their profile in the database,
|
136
138
|
which will allow them to log in using their email and password, OR their facebook account.
|
137
139
|
|
138
140
|
If they aren't already logged in to the app through the normal login form,
|