revise_auth 0.5.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +46 -2
- data/app/controllers/revise_auth/registrations_controller.rb +5 -1
- data/app/controllers/revise_auth/sessions_controller.rb +0 -4
- data/app/controllers/revise_auth_controller.rb +6 -1
- data/app/views/revise_auth/password_resets/new.html.erb +2 -0
- data/app/views/revise_auth/registrations/new.html.erb +2 -0
- data/app/views/revise_auth/sessions/new.html.erb +2 -4
- data/app/views/revise_auth/shared/_links.html.erb +15 -0
- data/config/locales/cs.yml +4 -0
- data/config/locales/de.yml +4 -0
- data/config/locales/el.yml +4 -0
- data/config/locales/en.yml +4 -0
- data/config/locales/es.yml +4 -0
- data/config/locales/fr.yml +4 -0
- data/config/locales/nl.yml +4 -0
- data/config/locales/pt.yml +4 -0
- data/config/locales/tr.yml +4 -0
- data/config/locales/zh-TW.yml +4 -0
- data/lib/generators/revise_auth/model_generator.rb +4 -0
- data/lib/revise_auth/authentication.rb +1 -1
- data/lib/revise_auth/model.rb +1 -1
- data/lib/revise_auth/test/helpers.rb +16 -0
- data/lib/revise_auth/version.rb +1 -1
- data/lib/revise_auth.rb +8 -3
- metadata +5 -4
- data/lib/tasks/revise_auth_tasks.rake +0 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6a6403810d3c60e03cc0e09a4a756770fe53de27701578209642bbac3c080270
|
4
|
+
data.tar.gz: a04b03a82250b048aa26a7922ce984da15dd7270b45d1e277112a22e870f3d06
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 78f5d30aa78e0ce1fc7c25b1a33cc502a780fa23d55f93f2e6a2f939cab5378659abdb68f8bf132486f4268f3b5217e886dd42cb32c77c28b7f5aa3a2aae4b31
|
7
|
+
data.tar.gz: 2cc5056ce0b8007b4fec974a9a073c1bf68ef65334fe0161f70f6b1a371d82a12eec56fc41f0f11dad8d647da3244c6d6bc48cad1b2da78ac653a31585a501b8
|
data/README.md
CHANGED
@@ -33,7 +33,7 @@ $ rails g revise_auth:model
|
|
33
33
|
Optionally, you can add other fields such as `first_name` and `last_name`:
|
34
34
|
|
35
35
|
```bash
|
36
|
-
$ rails g revise_auth:model
|
36
|
+
$ rails g revise_auth:model first_name last_name
|
37
37
|
```
|
38
38
|
|
39
39
|
And then run:
|
@@ -53,7 +53,7 @@ You can accomplish this in a few different ways:
|
|
53
53
|
|
54
54
|
### Routes
|
55
55
|
|
56
|
-
|
56
|
+
The model generator will automatically add ReviseAuth's routes to your router:
|
57
57
|
|
58
58
|
```
|
59
59
|
# config/routes.rb
|
@@ -140,6 +140,50 @@ authenticated do
|
|
140
140
|
end
|
141
141
|
```
|
142
142
|
|
143
|
+
### Password Length
|
144
|
+
|
145
|
+
The minimum acceptable password length for validation defaults to 12 characters but this can be configured in either `config/initializers/revise_auth.rb` or your environment configuration:
|
146
|
+
|
147
|
+
```ruby
|
148
|
+
ReviseAuth.configure do |config|
|
149
|
+
config.minimum_password_length = 42
|
150
|
+
end
|
151
|
+
```
|
152
|
+
|
153
|
+
## Test helpers
|
154
|
+
|
155
|
+
ReviseAuth comes with handy helpers you can use in your tests:
|
156
|
+
|
157
|
+
```ruby
|
158
|
+
# POST /login with the given user and password
|
159
|
+
login(user, password: "password")
|
160
|
+
# DELETE /logout
|
161
|
+
logout
|
162
|
+
```
|
163
|
+
|
164
|
+
Include the `ReviseAuth::Test::Helpers` module to make them available in your tests.
|
165
|
+
|
166
|
+
```ruby
|
167
|
+
class ActionDispatch::IntegrationTest
|
168
|
+
include ReviseAuth::Test::Helpers
|
169
|
+
end
|
170
|
+
```
|
171
|
+
|
172
|
+
Then in your tests:
|
173
|
+
|
174
|
+
```ruby
|
175
|
+
class MyControllerTest < ActionDispatch::IntegrationTest
|
176
|
+
setup do
|
177
|
+
@user = users(:bob)
|
178
|
+
login @user
|
179
|
+
end
|
180
|
+
|
181
|
+
test "..." do
|
182
|
+
# ...
|
183
|
+
end
|
184
|
+
end
|
185
|
+
```
|
186
|
+
|
143
187
|
## Contributing
|
144
188
|
|
145
189
|
If you have an issue you'd like to submit, please do so using the issue tracker in GitHub. In order for us to help you in the best way possible, please be as detailed as you can.
|
@@ -9,7 +9,7 @@ class ReviseAuth::RegistrationsController < ReviseAuthController
|
|
9
9
|
@user = User.new(sign_up_params)
|
10
10
|
if @user.save
|
11
11
|
login(@user)
|
12
|
-
redirect_to
|
12
|
+
redirect_to resolve_after_register_path
|
13
13
|
else
|
14
14
|
render :new, status: :unprocessable_entity
|
15
15
|
end
|
@@ -41,4 +41,8 @@ class ReviseAuth::RegistrationsController < ReviseAuthController
|
|
41
41
|
def profile_params
|
42
42
|
params.require(:user).permit(ReviseAuth.update_params)
|
43
43
|
end
|
44
|
+
|
45
|
+
def resolve_after_register_path
|
46
|
+
try(:after_register_path) || return_to_location || root_path
|
47
|
+
end
|
44
48
|
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
<% if controller_name == "sessions" %>
|
2
|
+
<div>
|
3
|
+
<%= link_to t(".reset_password"), new_password_reset_path %>
|
4
|
+
</div>
|
5
|
+
<% else %>
|
6
|
+
<div>
|
7
|
+
<%= link_to t(".log_in"), login_path %>
|
8
|
+
</div>
|
9
|
+
<% end %>
|
10
|
+
|
11
|
+
<% if controller_name != "registrations" %>
|
12
|
+
<div>
|
13
|
+
<%= link_to t(".sign_up"), sign_up_path %>
|
14
|
+
</div>
|
15
|
+
<% end %>
|
data/config/locales/cs.yml
CHANGED
data/config/locales/de.yml
CHANGED
data/config/locales/el.yml
CHANGED
data/config/locales/en.yml
CHANGED
data/config/locales/es.yml
CHANGED
@@ -60,5 +60,9 @@ es:
|
|
60
60
|
invalid_email_or_password: Email o contraseña inválidas.
|
61
61
|
new:
|
62
62
|
log_in: Iniciar sesión
|
63
|
+
shared:
|
64
|
+
links:
|
65
|
+
log_in: Iniciar sesión
|
63
66
|
reset_password: Resetear contraseña
|
67
|
+
sign_up: Registrate
|
64
68
|
sign_up_or_login: Registrate o inicia sesión para continuar.
|
data/config/locales/fr.yml
CHANGED
@@ -60,5 +60,9 @@ fr:
|
|
60
60
|
invalid_email_or_password: Email ou mot de passe incorrect.
|
61
61
|
new:
|
62
62
|
log_in: Log in
|
63
|
+
shared:
|
64
|
+
links:
|
65
|
+
log_in: Log in
|
63
66
|
reset_password: Reset your password
|
67
|
+
sign_up: Sign up
|
64
68
|
sign_up_or_login: Vous devez être connecté ou vous enregistrer pour continuer.
|
data/config/locales/nl.yml
CHANGED
data/config/locales/pt.yml
CHANGED
data/config/locales/tr.yml
CHANGED
data/config/locales/zh-TW.yml
CHANGED
@@ -20,6 +20,10 @@ module ReviseAuth
|
|
20
20
|
inject_into_class "app/models/user.rb", "User", " include ReviseAuth::Model\n" if behavior == :invoke
|
21
21
|
end
|
22
22
|
|
23
|
+
def add_revise_auth_routes
|
24
|
+
route "revise_auth"
|
25
|
+
end
|
26
|
+
|
23
27
|
def copy_initializer
|
24
28
|
template "initializer.rb", "config/initializers/revise_auth.rb"
|
25
29
|
end
|
@@ -70,7 +70,7 @@ module ReviseAuth
|
|
70
70
|
# the controllers defined inside revise_auth. Useful if you want to apply a before
|
71
71
|
# filter to all controllers, except the ones in revise_auth:
|
72
72
|
#
|
73
|
-
# before_action :authenticate_user!,
|
73
|
+
# before_action :authenticate_user!, unless: :revise_auth_controller?
|
74
74
|
def revise_auth_controller?
|
75
75
|
is_a?(::ReviseAuthController)
|
76
76
|
end
|
data/lib/revise_auth/model.rb
CHANGED
@@ -21,7 +21,7 @@ module ReviseAuth
|
|
21
21
|
|
22
22
|
validates :email, format: {with: URI::MailTo::EMAIL_REGEXP}, presence: true, uniqueness: true
|
23
23
|
validates :unconfirmed_email, format: {with: URI::MailTo::EMAIL_REGEXP}, allow_blank: true
|
24
|
-
validates_length_of :password, minimum:
|
24
|
+
validates_length_of :password, minimum: ReviseAuth.minimum_password_length, allow_nil: true
|
25
25
|
end
|
26
26
|
|
27
27
|
# Generates a confirmation token and send email to the user
|
data/lib/revise_auth/version.rb
CHANGED
data/lib/revise_auth.rb
CHANGED
@@ -3,13 +3,18 @@ require "revise_auth/engine"
|
|
3
3
|
require "revise_auth/routes"
|
4
4
|
|
5
5
|
module ReviseAuth
|
6
|
+
include ActiveSupport::Configurable
|
7
|
+
|
6
8
|
autoload :Authentication, "revise_auth/authentication"
|
7
9
|
autoload :Current, "revise_auth/current"
|
8
10
|
autoload :Model, "revise_auth/model"
|
9
11
|
autoload :RouteConstraint, "revise_auth/route_constraint"
|
10
12
|
|
11
|
-
|
13
|
+
module Test
|
14
|
+
autoload :Helpers, "revise_auth/test/helpers"
|
15
|
+
end
|
12
16
|
|
13
|
-
config_accessor :sign_up_params, default: [:
|
14
|
-
config_accessor :update_params, default: [
|
17
|
+
config_accessor :sign_up_params, default: [:email, :password, :password_confirmation]
|
18
|
+
config_accessor :update_params, default: []
|
19
|
+
config_accessor :minimum_password_length, default: 12
|
15
20
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: revise_auth
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Oliver
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-06-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|
@@ -62,6 +62,7 @@ files:
|
|
62
62
|
- app/views/revise_auth/registrations/edit.html.erb
|
63
63
|
- app/views/revise_auth/registrations/new.html.erb
|
64
64
|
- app/views/revise_auth/sessions/new.html.erb
|
65
|
+
- app/views/revise_auth/shared/_links.html.erb
|
65
66
|
- config/i18n-tasks.yml
|
66
67
|
- config/locales/cs.yml
|
67
68
|
- config/locales/de.yml
|
@@ -84,8 +85,8 @@ files:
|
|
84
85
|
- lib/revise_auth/model.rb
|
85
86
|
- lib/revise_auth/route_constraint.rb
|
86
87
|
- lib/revise_auth/routes.rb
|
88
|
+
- lib/revise_auth/test/helpers.rb
|
87
89
|
- lib/revise_auth/version.rb
|
88
|
-
- lib/tasks/revise_auth_tasks.rake
|
89
90
|
homepage: https://github.com/excid3/revise_auth
|
90
91
|
licenses:
|
91
92
|
- MIT
|
@@ -108,7 +109,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
108
109
|
- !ruby/object:Gem::Version
|
109
110
|
version: '0'
|
110
111
|
requirements: []
|
111
|
-
rubygems_version: 3.5.
|
112
|
+
rubygems_version: 3.5.11
|
112
113
|
signing_key:
|
113
114
|
specification_version: 4
|
114
115
|
summary: Simple authentication for Ruby on Rails apps
|