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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c8399b31088e0c0ebd1514b698be2fd97940c32e8cebd2313f524b3fb3455559
4
- data.tar.gz: f35d459eaa67c75f5c6e1fdee759f56eb37373f518f1ad1a212dc2d24386ba26
3
+ metadata.gz: 20a17b10267da2cdedcc2d9c61b342985891da3c01897e97bcd407a535c55e61
4
+ data.tar.gz: d0bab66a323651ac3d8616b3b99b1a7ba1905326922f06efb67cee29df201790
5
5
  SHA512:
6
- metadata.gz: df35e4035a31df68cc8c230d0605ec6c897fa2b43f79cc5bf77a1b1e77de3b98c3674af336517d0b577c3794ef02e47eac8b011da72e3b4bb27f5020c53ad2cc
7
- data.tar.gz: d6666bbf5cd821d6ee4e662ec7e5574bbcfd09ef63d9979c4fca32062cd5d35c36f60ceb908a281dbc567660f941550695d8433dfeaed12b8c527b5fc4eb308c
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(:mail))
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[:mail]) if params[:mail]
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 '' unless User.current.allowed_to?(:"manage_#{controller_name}")
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(:mail, t(:'attributes.mail'), required: true, class: 'sr-only') %>
4
- <%= email_field_tag(:mail, nil, autofocus: true, placeholder: t(:'attributes.mail'), required: true, size: 35, class: 'form-control') %>
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
- <%= content_tag(:h2, t(:label_send_activation_again)) %>
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
- <p class="buttons">
9
- <%= submit_tag(t(:button_submit)) %>
10
- </p>
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: reset_password_account_path(params[:id]), method: 'put') do |f| %>
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::User) %>
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.new_activation_account_url(@user.perishable_token) %>
6
+ <% activation_url = symphonia.activation_url(@user.perishable_token) %>
6
7
  <%= link_to(activation_url, activation_url) %>
7
8
  </p>
@@ -1,3 +1,3 @@
1
1
  <%= t(:'mailer.text_html_activation_account') %>
2
2
 
3
- <%= symphonia.new_activation_account_url(@user.perishable_token) %>
3
+ <%= symphonia.activation_url(@user.perishable_token) %>
@@ -18,7 +18,7 @@ cs:
18
18
  models:
19
19
  user_session: Přihlášení
20
20
  attributes:
21
- user_session:
21
+ symphonia/user_session:
22
22
  remember_me: Zapamatovat
23
23
  time:
24
24
  past: Minulost
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
- get '/reset_password/:id', to: 'accounts#reset_password', as: 'reset_password'
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'
@@ -1,3 +1,3 @@
1
1
  module Symphonia
2
- VERSION = '3.1.1'
2
+ VERSION = '3.1.2'
3
3
  end
@@ -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: { mail: email } }
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: { mail: email } }.to have_enqueued_job.on_queue('mailers')
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: { mail: user.email } }.to have_enqueued_job.on_queue('mailers')
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: { mail: user.email } }.not_to have_enqueued_job.on_queue('mailers')
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
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: symphonia
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.1
4
+ version: 3.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lukas Pokorny