symphonia 3.1.1 → 3.1.2
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.
- checksums.yaml +4 -4
- data/app/controllers/symphonia/accounts_controller.rb +2 -2
- data/app/helpers/symphonia/application_helper.rb +1 -1
- data/app/views/symphonia/accounts/lost_password.html.erb +2 -2
- data/app/views/symphonia/accounts/new_activation.html.erb +12 -9
- data/app/views/symphonia/accounts/reset_password.html.erb +1 -4
- data/app/views/symphonia/login/_form.html.erb +1 -1
- data/app/views/symphonia/notifier/activation_user.html.erb +2 -1
- data/app/views/symphonia/notifier/activation_user.text.erb +1 -1
- data/config/locales/cs.yml +1 -1
- data/config/routes.rb +2 -2
- data/lib/symphonia/version.rb +1 -1
- data/spec/controllers/account_controller_spec.rb +14 -5
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 20a17b10267da2cdedcc2d9c61b342985891da3c01897e97bcd407a535c55e61
|
4
|
+
data.tar.gz: d0bab66a323651ac3d8616b3b99b1a7ba1905326922f06efb67cee29df201790
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9b69046408165cd02eff6feb800c07b1a0e693016dbefbebd41b5e3e0cbc0624cbf5b1d719f2d08cf99c824cc3ef0de04b459a22c0983098d9720eaef03b40e3
|
7
|
+
data.tar.gz: e4c433771edd87a948bd9a0f961e7bd6872b8421cc6cd50aa6ecab3cd9e316e231a741c8bb0135133f2fa64258919a75972a2c01506a93de7f0ee5bac19ae4c3
|
@@ -68,7 +68,7 @@ module Symphonia
|
|
68
68
|
end
|
69
69
|
|
70
70
|
def resend_activation
|
71
|
-
@user = find_account_by_mail(params.require(:
|
71
|
+
@user = find_account_by_mail(params.require(:email))
|
72
72
|
if @user
|
73
73
|
if @user.active?
|
74
74
|
redirect_to root_path, flash: { error: t(:text_user_alerady_active) }
|
@@ -115,7 +115,7 @@ module Symphonia
|
|
115
115
|
end
|
116
116
|
|
117
117
|
def lost_password
|
118
|
-
@user = find_account_by_mail(params[:
|
118
|
+
@user = find_account_by_mail(params[:email]) if params[:email]
|
119
119
|
if @user
|
120
120
|
if @user.active?
|
121
121
|
@user.reset_perishable_token!
|
@@ -191,7 +191,7 @@ module Symphonia
|
|
191
191
|
end
|
192
192
|
|
193
193
|
def link_to_new_entity(options = {})
|
194
|
-
return ''
|
194
|
+
return '' if !options.has_key?(:skip_permission_check) && !User.current.allowed_to?(:"manage_#{controller_name}")
|
195
195
|
|
196
196
|
anchor = options.has_key?(:anchor) ? options.delete(:anchor) : 'page_header'
|
197
197
|
label = options.delete(:label) || t("label_#{controller_name.singularize}_new")
|
@@ -1,6 +1,6 @@
|
|
1
1
|
<%= form_tag symphonia.lost_password_account_path do %>
|
2
2
|
<div class="form-group required">
|
3
|
-
<%= label_tag(:
|
4
|
-
<%= email_field_tag(:
|
3
|
+
<%= label_tag(:email, t(:'attributes.mail'), required: true, class: 'sr-only') %>
|
4
|
+
<%= email_field_tag(:email, nil, autofocus: true, placeholder: t(:'attributes.mail'), required: true, size: 35, class: 'form-control') %>
|
5
5
|
</div>
|
6
6
|
<% end %>
|
@@ -1,11 +1,14 @@
|
|
1
|
-
<%=
|
2
|
-
<%= form_tag({:action => 'resend_activation'}, :class => 'tabular') do %>
|
3
|
-
<p>
|
4
|
-
<%= label_tag(:mail, Symphonia::User.human_attribute_name(:mail), :required => true) %>
|
5
|
-
<%= email_field_tag(:mail, nil, :required => true, :size => 35) %>
|
6
|
-
</p>
|
1
|
+
<%= title :label_send_activation_again %>
|
7
2
|
|
8
|
-
|
9
|
-
|
10
|
-
|
3
|
+
<%= symphonia_form_tag({ action: 'resend_activation' }) do |f| %>
|
4
|
+
<div class="row">
|
5
|
+
<div class="col-md-6 col-xs-12 mx-auto">
|
6
|
+
<div class="card w-75 mx-auto">
|
7
|
+
<div class="card-body">
|
8
|
+
<%= f.email_field :email, required: true, size: 35 %>
|
9
|
+
<%= f.submit t(:button_submit), class: "btn btn-primary btn-block" %>
|
10
|
+
</div>
|
11
|
+
</div>
|
12
|
+
</div>
|
13
|
+
</div>
|
11
14
|
<% end %>
|
@@ -3,15 +3,12 @@
|
|
3
3
|
<div class="card w-75 mx-auto">
|
4
4
|
<div class="card-body">
|
5
5
|
<h4 class="card-title"><%= t(:label_reset_password) %></h4>
|
6
|
-
<%= symphonia_form_tag(url:
|
6
|
+
<%= symphonia_form_tag(url: symphonia.reset_password_path(params[:id]), method: 'put') do |f| %>
|
7
7
|
<%= f.error_messages %>
|
8
8
|
<%= f.password_field(:password, label: t(:'attributes.password'), required: true, wrapper_class: 'required') -%>
|
9
|
-
<%#= f.password_field(:password_confirmation, label: t(:'attributes.password_confirmation'), required: true, wrapper_class: 'required') -%>
|
10
9
|
|
11
10
|
<%= f.submit(t(:button_submit), class: 'btn btn-primary btn-block') -%>
|
12
|
-
|
13
11
|
<% end %>
|
14
|
-
|
15
12
|
</div>
|
16
13
|
</div>
|
17
14
|
</div>
|
@@ -10,7 +10,7 @@
|
|
10
10
|
|
11
11
|
<%= f.form_group class: 'text-center' do %>
|
12
12
|
<%= f.submit t(:button_login), class: 'btn btn-primary btn-block' %>
|
13
|
-
<% if f.object.is_a?(Symphonia::
|
13
|
+
<% if f.object.is_a?(Symphonia::UserSession) %>
|
14
14
|
<%= link_to(t(:label_reset_password), lost_password_account_path, remote: true, class: 'btn btn-link btn-sm ') %>
|
15
15
|
<% if Symphonia.config[:allow_registrations] %>
|
16
16
|
<%= link_to(t(:button_register), register_path, class: 'btn btn-link btn-sm ') %>
|
@@ -1,7 +1,8 @@
|
|
1
|
+
<h1><%= t(:meta_title) %></h1>
|
1
2
|
<p>
|
2
3
|
<%= t(:'mailer.text_html_activation_account') %>
|
3
4
|
</p>
|
4
5
|
<p>
|
5
|
-
<% activation_url = symphonia.
|
6
|
+
<% activation_url = symphonia.activation_url(@user.perishable_token) %>
|
6
7
|
<%= link_to(activation_url, activation_url) %>
|
7
8
|
</p>
|
data/config/locales/cs.yml
CHANGED
data/config/routes.rb
CHANGED
@@ -9,8 +9,8 @@ Symphonia::Engine.routes.draw do
|
|
9
9
|
get '/register', to: 'accounts#register', as: 'account_register'
|
10
10
|
post '/register', to: 'accounts#create'
|
11
11
|
|
12
|
-
get '/activation/:activation_code', to: 'accounts#activation'
|
13
|
-
|
12
|
+
get '/activation/:activation_code', to: 'accounts#activation', as: 'activation'
|
13
|
+
match '/reset_password/:id', to: 'accounts#reset_password', as: 'reset_password', via: [:get, :put]
|
14
14
|
|
15
15
|
scope 'admin' do
|
16
16
|
get 'user/current', to: 'users#show', as: 'user_current'
|
data/lib/symphonia/version.rb
CHANGED
@@ -27,7 +27,7 @@ module Symphonia
|
|
27
27
|
context '#resend_activation' do
|
28
28
|
|
29
29
|
let(:email) { Faker::Internet.email }
|
30
|
-
subject { get :resend_activation, params: {
|
30
|
+
subject { get :resend_activation, params: { email: email } }
|
31
31
|
|
32
32
|
it 'non exist user' do
|
33
33
|
is_expected.to redirect_to :root
|
@@ -44,7 +44,7 @@ module Symphonia
|
|
44
44
|
user = FactoryBot.create(:user, email: email, status: 'pending')
|
45
45
|
token = user.perishable_token.dup
|
46
46
|
|
47
|
-
expect { get :resend_activation, params: {
|
47
|
+
expect { get :resend_activation, params: { email: email } }.to have_enqueued_job.on_queue('mailers')
|
48
48
|
expect(response).to have_http_status :redirect
|
49
49
|
|
50
50
|
expect(user.reload.perishable_token).not_to eq token
|
@@ -75,16 +75,25 @@ module Symphonia
|
|
75
75
|
it 'with mail' do
|
76
76
|
user = FactoryBot.create(:user, status: 'active')
|
77
77
|
|
78
|
-
expect { post :lost_password, params: {
|
78
|
+
expect { post :lost_password, params: { email: user.email } }.to have_enqueued_job.on_queue('mailers')
|
79
79
|
expect(flash[:error]).to be_nil
|
80
80
|
end
|
81
81
|
|
82
82
|
it 'with inactive user' do
|
83
83
|
user = FactoryBot.create(:user, status: 'pending')
|
84
|
-
expect { post :lost_password, params: {
|
84
|
+
expect { post :lost_password, params: { email: user.email } }.not_to have_enqueued_job.on_queue('mailers')
|
85
85
|
expect(flash[:error]).not_to be :blank
|
86
86
|
end
|
87
87
|
end
|
88
88
|
|
89
|
+
context "#reset_password" do
|
90
|
+
subject { FactoryBot.create :user }
|
91
|
+
it "reset" do
|
92
|
+
put :reset_password, params: { id: subject.perishable_token, password: "secret-pass-1" }
|
93
|
+
expect(response).to redirect_to /user\/current/
|
94
|
+
expect { subject.reload }.to change(subject, :crypted_password)
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
89
98
|
end
|
90
|
-
end
|
99
|
+
end
|