autho 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +11 -3
- data/examples/base_controller.rb +24 -0
- data/examples/routes.rb +2 -0
- data/examples/session_controller.rb +1 -0
- data/lib/autho.rb +1 -0
- data/lib/autho/version.rb +1 -1
- metadata +4 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1465ff18d751753c3b8267b4bae37112f4d0ffe7
|
4
|
+
data.tar.gz: e336ec06aa26aad931f82e0ec19a19ae9fd815f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 443dd7b7afb1f74c265edc0127bd26257823109c6954fab73ef9dca7b18dea7fd6d2cf70de7fa4ae4c9550324c346ddf7e5ba9a71e4d20a08a83582072c78be1
|
7
|
+
data.tar.gz: 1420eca854af30231c72b6122a7b0ce49d92608900a1e6bf8bc9cec9fc4b0f6e09f723122bb55a844e2cafaa2d8bd607cf177426550bff878c795f82b9125db6
|
data/README.md
CHANGED
@@ -26,19 +26,27 @@ Or install it yourself as:
|
|
26
26
|
|
27
27
|
## Usage
|
28
28
|
|
29
|
-
Todo. See
|
29
|
+
Todo. See `spec` and `examples` dirs.
|
30
30
|
|
31
31
|
Current parts:
|
32
32
|
|
33
33
|
* `Autho::Authentication` to find a user from email and password.
|
34
34
|
* `Autho::Session` to store, get and remove user from the session.
|
35
35
|
|
36
|
+
## Related
|
37
|
+
|
38
|
+
* [ActiveModel::SecurePassword](http://api.rubyonrails.org/classes/ActiveModel/SecurePassword/ClassMethods.html) for encrypting passwords, validating confirmation etc.
|
39
|
+
* [go_to_param](https://github.com/henrik/go_to_param/) to redirect where you wanted to go after logging in.
|
40
|
+
|
41
|
+
|
36
42
|
## TODO
|
37
43
|
|
38
|
-
* More specs
|
39
44
|
* Polish API
|
40
|
-
*
|
45
|
+
* Replicate SecurePassword?
|
41
46
|
* "Remember me"?
|
47
|
+
* Memoize in session?
|
48
|
+
* Examples of use in real code, maybe something like a sample app
|
49
|
+
|
42
50
|
|
43
51
|
## Contributing
|
44
52
|
|
@@ -0,0 +1,24 @@
|
|
1
|
+
class ApplicationController < ActionController::Base
|
2
|
+
before_filter :ensure_user_is_authenticated
|
3
|
+
|
4
|
+
def self.skip_user_authentication(opts = {})
|
5
|
+
skip_before_filter :ensure_user_is_authenticated, opts
|
6
|
+
end
|
7
|
+
|
8
|
+
def user_session
|
9
|
+
@user_session ||= UserSession.new(self, :user_id, User)
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def ensure_user_is_authenticated
|
15
|
+
unless current_user
|
16
|
+
redirect_to login_path, alert: t(:"sessions.must_authenticate")
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def current_user
|
21
|
+
user_session.user
|
22
|
+
end
|
23
|
+
helper_method :current_user
|
24
|
+
end
|
data/examples/routes.rb
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# TODO
|
data/lib/autho.rb
CHANGED
data/lib/autho/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: autho
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Henrik Nyh
|
@@ -93,6 +93,9 @@ files:
|
|
93
93
|
- README.md
|
94
94
|
- Rakefile
|
95
95
|
- autho.gemspec
|
96
|
+
- examples/base_controller.rb
|
97
|
+
- examples/routes.rb
|
98
|
+
- examples/session_controller.rb
|
96
99
|
- lib/autho.rb
|
97
100
|
- lib/autho/authentication.rb
|
98
101
|
- lib/autho/session.rb
|