monban 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +1 -0
- data/README.md +35 -1
- data/lib/monban/version.rb +1 -1
- data/monban.gemspec +1 -1
- metadata +2 -2
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -9,8 +9,8 @@ Monban makes authentication simple:
|
|
9
9
|
|
10
10
|
- Uses warden
|
11
11
|
- Provides convenient controller helpers
|
12
|
+
- Provides a rails generator for default controllers and views
|
12
13
|
- TODO: Very customizable
|
13
|
-
- TODO: provides a generator for default controllers and views
|
14
14
|
|
15
15
|
Monban doesn't do the following:
|
16
16
|
|
@@ -29,6 +29,14 @@ Then inside of your ApplicationController add the following:
|
|
29
29
|
|
30
30
|
include Monban::ControllerHelpers
|
31
31
|
|
32
|
+
You may also generate a scaffold to start with:
|
33
|
+
|
34
|
+
rails g monban:scaffold
|
35
|
+
|
36
|
+
This will generate a bare bones starting point. If you don't want the full stack you can just generate some controllers with:
|
37
|
+
|
38
|
+
rails g monban:controllers
|
39
|
+
|
32
40
|
## Usage
|
33
41
|
|
34
42
|
Monban does currently have some expectations, but these will change. Here are the current requirements:
|
@@ -56,6 +64,32 @@ And this filter:
|
|
56
64
|
|
57
65
|
- `require_login`
|
58
66
|
|
67
|
+
### Advanced Functionality
|
68
|
+
|
69
|
+
You may perform a look up on a user using multiple fields by doing something like the following:
|
70
|
+
|
71
|
+
class SessionsController < ApplicationController
|
72
|
+
def create
|
73
|
+
if user = authenticate_session(session_params, email_or_username: [:email, :username])
|
74
|
+
sign_in user
|
75
|
+
redirect_to root_path
|
76
|
+
else
|
77
|
+
flash.now.notice = "Invalid username or password"
|
78
|
+
render :new
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
private
|
83
|
+
|
84
|
+
def session_params
|
85
|
+
params.require(:session).permit(:email_or_username, :password)
|
86
|
+
end
|
87
|
+
|
88
|
+
end
|
89
|
+
|
90
|
+
This will allow the user to enter either their username or email to login
|
91
|
+
|
92
|
+
|
59
93
|
## Contributing
|
60
94
|
|
61
95
|
1. Fork it
|
data/lib/monban/version.rb
CHANGED
data/monban.gemspec
CHANGED
@@ -10,7 +10,7 @@ Gem::Specification.new do |gem|
|
|
10
10
|
gem.email = ["halogenandtoast@gmail.com"]
|
11
11
|
gem.description = %q{simple rails authentication}
|
12
12
|
gem.summary = %q{Making rails authentication as simple as possible}
|
13
|
-
gem.homepage = ""
|
13
|
+
gem.homepage = "https://github.com/halogenandtoast/monban"
|
14
14
|
|
15
15
|
gem.files = `git ls-files`.split($/)
|
16
16
|
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: monban
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -231,7 +231,7 @@ files:
|
|
231
231
|
- spec/rails_app/public/favicon.ico
|
232
232
|
- spec/rails_app/script/rails
|
233
233
|
- spec/spec_helper.rb
|
234
|
-
homepage:
|
234
|
+
homepage: https://github.com/halogenandtoast/monban
|
235
235
|
licenses: []
|
236
236
|
post_install_message:
|
237
237
|
rdoc_options: []
|