alchemy-devise 4.4.0 → 5.1.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (29) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +4 -4
  3. data/Rakefile +4 -2
  4. data/app/controllers/alchemy/admin/passwords_controller.rb +38 -0
  5. data/app/controllers/alchemy/admin/user_sessions_controller.rb +65 -0
  6. data/app/mailers/alchemy/notifications.rb +1 -1
  7. data/app/views/alchemy/{passwords → admin/passwords}/edit.html.erb +2 -2
  8. data/app/views/alchemy/{passwords → admin/passwords}/new.html.erb +2 -2
  9. data/app/views/alchemy/{user_sessions → admin/user_sessions}/new.html.erb +1 -1
  10. data/app/views/alchemy/admin/users/index.html.erb +15 -16
  11. data/app/views/alchemy/notifications/alchemy_user_created.de.text.erb +1 -1
  12. data/app/views/alchemy/notifications/alchemy_user_created.en.text.erb +1 -1
  13. data/app/views/alchemy/notifications/alchemy_user_created.es.text.erb +1 -1
  14. data/app/views/alchemy/notifications/alchemy_user_created.ru.text.erb +1 -1
  15. data/app/views/alchemy/notifications/member_created.de.text.erb +1 -1
  16. data/app/views/alchemy/notifications/member_created.en.text.erb +1 -1
  17. data/app/views/alchemy/notifications/member_created.es.text.erb +1 -1
  18. data/app/views/alchemy/notifications/member_created.ru.text.erb +1 -1
  19. data/app/views/alchemy/notifications/reset_password_instructions.de.text.erb +1 -1
  20. data/app/views/alchemy/notifications/reset_password_instructions.en.text.erb +1 -1
  21. data/app/views/alchemy/notifications/reset_password_instructions.es.text.erb +1 -1
  22. data/app/views/alchemy/notifications/reset_password_instructions.ru.text.erb +1 -1
  23. data/config/initializers/alchemy.rb +14 -12
  24. data/config/routes.rb +19 -14
  25. data/lib/alchemy/devise/ability.rb +3 -3
  26. data/lib/alchemy/devise/version.rb +1 -1
  27. metadata +12 -12
  28. data/app/controllers/alchemy/passwords_controller.rb +0 -31
  29. data/app/controllers/alchemy/user_sessions_controller.rb +0 -62
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7e352204aef8262b7a4b3cffe5ef3e7a58781194d777a481c3b99300f92499d6
4
- data.tar.gz: 6fa7ec4f94b5333fe8cad0897f821d80fedb297f932f4d904cbd4eeecce5cd2b
3
+ metadata.gz: 4566c3a7aadd785a139dc528390802f45533b65636401ca375e6042d91a9a5bb
4
+ data.tar.gz: 44d966cecce3748e86cbf44a610379e969985d809059e31429807f343ffae5f2
5
5
  SHA512:
6
- metadata.gz: 2b6ac50b6a59132a6232a481da65290dc7500f7ab44397cfce25df98ef28d2609340e65edc190d9dca48e74409b5a3eb394aa5f015f8e72f134fcb2b0d1f025c
7
- data.tar.gz: bba4952131d61b8f33ec9670ffa9a2178ebe6095e52453f27e2c604b0918d9b528fd09d1f32a3f7d8a2a7896525b1f85004b695c04b0687a4a3066516a761cfe
6
+ metadata.gz: bb99df8c86c7dc025f2530a1a2c148a6a31dc24e3b4bf4eee5751ba74d1402da286632af41e1256e8d2c03285aeb85cb7c2fc0396667cb52676f815ac76ad683
7
+ data.tar.gz: dc2b39ae26a2979f2e363fc3cbe569347e138f3e238d4cbe500ac1879e94effb5887b08ab37b3886f01a3b5d88da628256c049ac5e219ce01d01151e1fa806a6
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
- ## Devise based authentication for AlchemyCMS 4.2
1
+ ## Devise based authentication for AlchemyCMS
2
2
 
3
- [![Build Status](https://secure.travis-ci.org/AlchemyCMS/alchemy-devise.svg?branch=master)](http://travis-ci.org/AlchemyCMS/alchemy-devise)
3
+ [![Build Status](https://secure.travis-ci.com/AlchemyCMS/alchemy-devise.svg?branch=main)](http://travis-ci.com/AlchemyCMS/alchemy-devise)
4
4
 
5
- [![Gem Version](https://badge.fury.io/rb/alchemy-devise.svg)](http://badge.fury.io/rb/alchemy-devise) [![Test Coverage](https://codeclimate.com/github/AlchemyCMS/alchemy-devise/badges/coverage.svg)](https://codeclimate.com/github/AlchemyCMS/alchemy-devise/coverage) [![Code Climate](https://codeclimate.com/github/AlchemyCMS/alchemy-devise/badges/gpa.svg)](https://codeclimate.com/github/AlchemyCMS/alchemy-devise) [![security](https://hakiri.io/github/AlchemyCMS/alchemy-devise/master.svg)](https://hakiri.io/github/AlchemyCMS/alchemy-devise/master)
5
+ [![Gem Version](https://badge.fury.io/rb/alchemy-devise.svg)](http://badge.fury.io/rb/alchemy-devise) [![Test Coverage](https://codeclimate.com/github/AlchemyCMS/alchemy-devise/badges/coverage.svg)](https://codeclimate.com/github/AlchemyCMS/alchemy-devise/coverage) [![Code Climate](https://codeclimate.com/github/AlchemyCMS/alchemy-devise/badges/gpa.svg)](https://codeclimate.com/github/AlchemyCMS/alchemy-devise) [![security](https://hakiri.io/github/AlchemyCMS/alchemy-devise/main.svg)](https://hakiri.io/github/AlchemyCMS/alchemy-devise/main)
6
6
 
7
7
  AlchemyCMS has no authentication in its core. So it is possible to bring your own authentication and use it to authorize users in AlchemyCMS. If you don't have your own authentication, you can use this gem.
8
8
 
@@ -12,7 +12,7 @@ Just put the gem into your projects `Gemfile`.
12
12
 
13
13
  ```ruby
14
14
  # Gemfile
15
- gem 'alchemy-devise', github: 'AlchemyCMS/alchemy-devise', branch: '4.2-stable'
15
+ gem 'alchemy-devise'
16
16
  ```
17
17
 
18
18
  and run `bundle install`.
data/Rakefile CHANGED
@@ -33,7 +33,9 @@ namespace :alchemy do
33
33
  system <<-BASH
34
34
  cd spec/dummy
35
35
  export RAILS_ENV=test
36
- bin/rake db:create db:environment:set db:migrate
36
+ bin/rake railties:install:migrations
37
+ bin/rake db:drop db:create db:migrate
38
+ bin/rails g alchemy:install --force --auto-accept
37
39
  bin/rails g alchemy:devise:install --force
38
40
  cd -
39
41
  BASH
@@ -46,7 +48,7 @@ BASH
46
48
  original_file = './CHANGELOG.md'
47
49
  new_file = original_file + '.new'
48
50
  backup = original_file + '.old'
49
- changes = `git rev-list #{ENV['PREVIOUS_VERSION']}...master | bundle exec github_fast_changelog AlchemyCMS/alchemy-devise`
51
+ changes = `git rev-list v#{ENV['PREVIOUS_VERSION']}...main | bundle exec github_fast_changelog AlchemyCMS/alchemy-devise`
50
52
  File.open(new_file, 'w') do |fo|
51
53
  fo.puts changes
52
54
  File.foreach(original_file) do |li|
@@ -0,0 +1,38 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "alchemy/version"
4
+
5
+ module Alchemy
6
+ module Admin
7
+ class PasswordsController < ::Devise::PasswordsController
8
+ include Alchemy::Admin::Locale
9
+
10
+ if Alchemy.gem_version <= Gem::Version.new("4.9")
11
+ before_action { enforce_ssl if ssl_required? && !request.ssl? }
12
+ end
13
+
14
+ helper "Alchemy::Admin::Base"
15
+
16
+ layout "alchemy/admin"
17
+
18
+ private
19
+
20
+ # Override for Devise method
21
+ def new_session_path(resource_name)
22
+ alchemy.admin_login_path
23
+ end
24
+
25
+ def admin_edit_password_url(_resource, options = {})
26
+ alchemy.admin_edit_password_url(options)
27
+ end
28
+
29
+ def after_resetting_password_path_for(resource)
30
+ if can? :index, :alchemy_admin_dashboard
31
+ alchemy.admin_dashboard_path
32
+ else
33
+ alchemy.root_path
34
+ end
35
+ end
36
+ end
37
+ end
38
+ end
@@ -0,0 +1,65 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "alchemy/version"
4
+
5
+ module Alchemy
6
+ module Admin
7
+ class UserSessionsController < ::Devise::SessionsController
8
+ include Alchemy::Admin::Locale
9
+
10
+ protect_from_forgery prepend: true
11
+
12
+ if Alchemy.gem_version <= Gem::Version.new("4.9")
13
+ before_action except: "destroy" do
14
+ enforce_ssl if ssl_required? && !request.ssl?
15
+ end
16
+ end
17
+ before_action :check_user_count, :only => :new
18
+
19
+ helper "Alchemy::Admin::Base"
20
+
21
+ layout "alchemy/admin"
22
+
23
+ def create
24
+ authenticate_user!
25
+
26
+ if user_signed_in?
27
+ if session[:redirect_path].blank?
28
+ redirect_path = admin_dashboard_path
29
+ else
30
+ # We have to strip double slashes from beginning of path, because of strange rails/rack bug.
31
+ redirect_path = session[:redirect_path].gsub(/\A\/{2,}/, "/")
32
+ end
33
+ redirect_to redirect_path,
34
+ notice: t(:signed_in, scope: "devise.sessions")
35
+ else
36
+ super
37
+ end
38
+ end
39
+
40
+ def destroy
41
+ current_alchemy_user.try(:unlock_pages!)
42
+ cookies.clear
43
+ session.clear
44
+ super
45
+ end
46
+
47
+ private
48
+
49
+ def check_user_count
50
+ if User.count == 0
51
+ redirect_to admin_signup_path
52
+ end
53
+ end
54
+
55
+ # Overwriting the default of Devise
56
+ def after_sign_out_path_for(resource_or_scope)
57
+ if request.referer.blank? || request.referer.to_s =~ /admin/
58
+ root_path
59
+ else
60
+ request.referer
61
+ end
62
+ end
63
+ end
64
+ end
65
+ end
@@ -5,7 +5,7 @@ module Alchemy
5
5
 
6
6
  def member_created(user)
7
7
  @user = user
8
- @url = login_url
8
+
9
9
  mail(
10
10
  to: user.email,
11
11
  subject: Alchemy.t("Your user credentials")
@@ -10,13 +10,13 @@
10
10
  <%= devise_error_messages! %>
11
11
  </div>
12
12
  <% end %>
13
- <%= alchemy_form_for resource, as: resource_name, url: update_password_path, method: 'patch' do |f| %>
13
+ <%= alchemy_form_for resource, as: resource_name, url: admin_update_password_path, method: 'patch' do |f| %>
14
14
  <%= f.hidden_field :reset_password_token %>
15
15
  <%= f.input :password, autofocus: true, label: Alchemy.t("New password") %>
16
16
  <%= f.input :password_confirmation, label: Alchemy.t("Confirm new password") %>
17
17
  <div class="input link">
18
18
  <small>
19
- <%= link_to Alchemy.t(:back), alchemy.login_path %>
19
+ <%= link_to Alchemy.t(:back), alchemy.admin_login_path %>
20
20
  </small>
21
21
  </div>
22
22
  <%= f.submit Alchemy.t("Change password") %>
@@ -10,13 +10,13 @@
10
10
  <%= devise_error_messages! %>
11
11
  </div>
12
12
  <% end %>
13
- <%= alchemy_form_for :user, url: reset_password_path, html: {method: 'post'} do |f| %>
13
+ <%= alchemy_form_for :user, url: admin_reset_password_path, html: {method: 'post'} do |f| %>
14
14
  <%= f.input :email,
15
15
  autofocus: true,
16
16
  input_html: {value: params[:email]} %>
17
17
  <div class="input link">
18
18
  <small>
19
- <%= link_to Alchemy.t(:back), alchemy.login_path %>
19
+ <%= link_to Alchemy.t(:back), alchemy.admin_login_path %>
20
20
  </small>
21
21
  </div>
22
22
  <%= f.submit Alchemy.t("Send reset instructions"), input_html: {class: 'secondary'} %>
@@ -5,7 +5,7 @@
5
5
  <%= f.input :password %>
6
6
  <div class="input link">
7
7
  <small>
8
- <%= link_to Alchemy.t('Forgot your password?'), new_password_path %>
8
+ <%= link_to Alchemy.t('Forgot your password?'), admin_new_password_path %>
9
9
  </small>
10
10
  </div>
11
11
  <div class="submit">
@@ -1,22 +1,21 @@
1
- <%= toolbar(
2
- buttons: [
3
- {
4
- icon: :plus,
5
- label: Alchemy.t(:create_user),
6
- url: alchemy.new_admin_user_path,
1
+ <%= content_for :toolbar do %>
2
+ <%= toolbar_button(
3
+ icon: :plus,
4
+ label: Alchemy.t(:create_user),
5
+ url: alchemy.new_admin_user_path,
6
+ title: Alchemy.t(:create_user),
7
+ hotkey: 'alt+n',
8
+ dialog_options: {
7
9
  title: Alchemy.t(:create_user),
8
- hotkey: 'alt+n',
9
- dialog_options: {
10
- title: Alchemy.t(:create_user),
11
- size: "430x560"
12
- },
13
- if_permitted_to: [:create, Alchemy::User]
14
- }
15
- ]
16
- ) %>
10
+ size: "430x560"
11
+ },
12
+ if_permitted_to: [:create, Alchemy::User]
13
+ ) %>
14
+ <%= render "alchemy/admin/partials/search_form" %>
15
+ <% end %>
17
16
 
18
17
  <div id="archive_all" class="resources-table-wrapper">
19
- <%= resources_header %>
18
+ <%= render "alchemy/admin/resources/table_header" %>
20
19
  <% if @users.any? %>
21
20
 
22
21
  <table class="list" id="user_list">
@@ -10,6 +10,6 @@ Aus Sicherheitsgründen stellen wir Ihr Passwort hier nicht dar.
10
10
 
11
11
  Wenn Sie Ihr Passwort vergessen haben oder dies Ihr erster Login ist, gehen Sie bitte auf:
12
12
 
13
- <%= alchemy.new_password_url %>
13
+ <%= alchemy.admin_new_password_url %>
14
14
 
15
15
  Viel Spaß mit Alchemy!
@@ -10,6 +10,6 @@ For security reasons we do not show your password here.
10
10
 
11
11
  If you forgot your password or this is your first login, please goto:
12
12
 
13
- <%= alchemy.new_password_url %>
13
+ <%= alchemy.admin_new_password_url %>
14
14
 
15
15
  Have much fun with Alchemy!
@@ -10,6 +10,6 @@ Por razones de seguridad no mostraremos aquí tu contraseña.
10
10
 
11
11
  Si has olvidado tu contraseña o es tu primer acceso, por favor, accede a:
12
12
 
13
- <%= alchemy.new_password_url %>
13
+ <%= alchemy.admin_new_password_url %>
14
14
 
15
15
  ¡Disfruta de tu web con Alchemy!
@@ -10,6 +10,6 @@
10
10
 
11
11
  Если вы забыли ваш пароль или если это ваш первый визит, пожалуйста, перейдите по ссылке:
12
12
 
13
- <%= alchemy.new_password_url %>
13
+ <%= alchemy.admin_new_password_url %>
14
14
 
15
15
  Наслаждайтесь использованием Alchemy!
@@ -8,6 +8,6 @@ Es wurde ein Zufallspasswort generiert. Aus Sicherheitsgründen wird dieses hier
8
8
 
9
9
  Klicken Sie bitte daher auf den folgenden Link (*), um sich ein neues Passwort zu vergeben:
10
10
 
11
- <%= alchemy.new_password_url(email: @user.email) %>
11
+ <%= alchemy.admin_new_password_url(email: @user.email) %>
12
12
 
13
13
  *) Sollte dies nicht funktionieren, so kopieren Sie Sich bitte diesen Link und tragen Sie ihn in die Adresszeile Ihres Webbrowsers ein.
@@ -8,6 +8,6 @@ The password was randomly created. For security reasons it is not displayed here
8
8
 
9
9
  Please follow this link (*) to reset your password:
10
10
 
11
- <%= alchemy.new_password_url(email: @user.email) %>
11
+ <%= alchemy.admin_new_password_url(email: @user.email) %>
12
12
 
13
13
  *) If this does not work, please copy the url and paste it into the address bar of your web browser.
@@ -8,6 +8,6 @@ La contraseña se ha generado aleatoriamente. Por razones de seguridad no se mos
8
8
 
9
9
  Por favor, accede este enlace (*) para reiniciar tu contraseña:
10
10
 
11
- <%= alchemy.new_password_url(email: @user.email) %>
11
+ <%= alchemy.admin_new_password_url(email: @user.email) %>
12
12
 
13
13
  *) Si esto no funciona, por favor, copia el enlace y pegalo en el campo de direcciones de tu navegador web.
@@ -8,6 +8,6 @@
8
8
 
9
9
  Пожалуйста, пройдите по ссылке (*), чтобы назначить собственный пароль:
10
10
 
11
- <%= alchemy.new_password_url(email: @user.email) %>
11
+ <%= alchemy.admin_new_password_url(email: @user.email) %>
12
12
 
13
13
  *) Если ссылка не работает, пожалуйста, скопируйте ее в адресную строку вашего браузера.
@@ -2,7 +2,7 @@ Hallo <%= @user.fullname %>.
2
2
 
3
3
  Sie haben angefordert Ihr Passwort zurückzusetzen. Dies kann durch anklicken des nachfolgenden Links bestätigt werden.
4
4
 
5
- <%= alchemy.edit_password_url(@user, reset_password_token: @token) %>
5
+ <%= alchemy.admin_edit_password_url(@user, reset_password_token: @token) %>
6
6
 
7
7
  Wenn Sie diese Zurücksetzung nicht angefragt haben, dann können Sie diese E-Mail einfach ignorieren.
8
8
  Ihr Passwort wird erst dann zurückgesetzt, wenn Sie den Link anklicken.
@@ -2,7 +2,7 @@ Hello <%= @user.name %>.
2
2
 
3
3
  You have requested to change your password. Please confirm this by clicking the link below.
4
4
 
5
- <%= alchemy.edit_password_url(@user, reset_password_token: @token) %>
5
+ <%= alchemy.admin_edit_password_url(@user, reset_password_token: @token) %>
6
6
 
7
7
  If you didn't request this, please ignore this email.
8
8
  Your password won't change until you access the link above and create a new one.
@@ -2,7 +2,7 @@ Hola <%= @user.name %>.
2
2
 
3
3
  Has solicitado modificar tu contraseña. Por favor, confírmalo pulsando en el siguiente enlace.
4
4
 
5
- <%= alchemy.edit_password_url(@user, reset_password_token: @token) %>
5
+ <%= alchemy.admin_edit_password_url(@user, reset_password_token: @token) %>
6
6
 
7
7
  Si no has sido tu el que ha hecho la solicitud, ignora este correo.
8
8
  Tu contraseña no cambiará hasta que no accedas al enlace de arriba y generes una nueva.
@@ -2,7 +2,7 @@
2
2
 
3
3
  Вы сделали запрос на смену пароля. Пожалуйста подтвердите это, нажав на ссылку ниже.
4
4
 
5
- <%= alchemy.edit_password_url(@user, reset_password_token: @token) %>
5
+ <%= alchemy.admin_edit_password_url(@user, reset_password_token: @token) %>
6
6
 
7
7
  Если вы не делали запрос, просто проигнорируйте это письмо.
8
8
  Ваш пароль не изменится до тех пор, пока вы не перейдете по ссылке и сами не измените его.
@@ -1,23 +1,25 @@
1
- require 'alchemy/devise/ability'
1
+ # frozen_string_literal: true
2
+
3
+ require "alchemy/devise/ability"
2
4
 
3
5
  Alchemy.register_ability(Alchemy::Devise::Ability)
4
6
 
5
7
  Alchemy::Modules.register_module({
6
- name: 'users',
7
- engine_name: 'alchemy',
8
+ name: "users",
9
+ engine_name: "alchemy",
8
10
  position: 4.1,
9
11
  navigation: {
10
- name: 'modules.users',
11
- controller: 'alchemy/admin/users',
12
- action: 'index',
13
- icon: 'users'
14
- }
12
+ name: "modules.users",
13
+ controller: "/alchemy/admin/users",
14
+ action: "index",
15
+ icon: "users",
16
+ },
15
17
  })
16
18
 
17
- Alchemy.user_class_name = 'Alchemy::User'
18
- Alchemy.signup_path = '/admin/signup'
19
- Alchemy.login_path = '/admin/login'
20
- Alchemy.logout_path = '/admin/logout'
19
+ Alchemy.user_class_name = "Alchemy::User"
20
+ Alchemy.signup_path = "/admin/signup"
21
+ Alchemy.login_path = "/admin/login"
22
+ Alchemy.logout_path = "/admin/logout"
21
23
 
22
24
  if Alchemy.respond_to?(:logout_method)
23
25
  Rails.application.config.after_initialize do
@@ -1,22 +1,29 @@
1
1
  Alchemy::Engine.routes.draw do
2
- devise_for :user,
3
- class_name: 'Alchemy::User',
4
- controllers: {
5
- sessions: 'alchemy/user_sessions'
6
- },
7
- skip: [:sessions, :passwords]
2
+ namespace :admin, {
3
+ path: Alchemy.admin_path,
4
+ constraints: Alchemy.admin_constraints
5
+ } do
6
+
7
+ devise_for :user,
8
+ class_name: 'Alchemy::User',
9
+ singular: :user,
10
+ skip: :all,
11
+ controllers: {
12
+ sessions: 'alchemy/admin/user_sessions',
13
+ passwords: 'alchemy/admin/passwords'
14
+ },
15
+ router_name: :alchemy
8
16
 
9
- scope Alchemy.admin_path, {constraints: Alchemy.admin_constraints} do
10
17
  devise_scope :user do
11
- get '/dashboard' => 'admin/dashboard#index',
18
+ get '/dashboard' => 'dashboard#index',
12
19
  :as => :user_root
13
- get '/signup' => 'admin/users#signup',
14
- :as => :admin_signup
20
+ get '/signup' => 'users#signup',
21
+ :as => :signup
15
22
  get '/login' => 'user_sessions#new',
16
23
  :as => :login
17
24
  post '/login' => 'user_sessions#create'
18
- delete '/logout' => 'user_sessions#destroy',
19
- :as => :logout
25
+ match '/logout' => 'user_sessions#destroy',
26
+ :as => :logout, via: Devise.sign_out_via
20
27
 
21
28
  get '/passwords' => 'passwords#new',
22
29
  :as => :new_password
@@ -27,9 +34,7 @@ Alchemy::Engine.routes.draw do
27
34
  patch '/passwords' => 'passwords#update',
28
35
  :as => :update_password
29
36
  end
30
- end
31
37
 
32
- namespace :admin, {path: Alchemy.admin_path, constraints: Alchemy.admin_constraints} do
33
38
  resources :users
34
39
  end
35
40
  end
@@ -10,16 +10,16 @@ module Alchemy
10
10
  can :create, Alchemy::User if Alchemy::User.count == 0
11
11
 
12
12
  if member? || author? || editor?
13
- can [:show, :update], Alchemy.user_class, id: user.id
13
+ can [:show, :update], Alchemy::User, id: user.id
14
14
  end
15
15
 
16
16
  if editor? || admin?
17
17
  can :index, :alchemy_admin_users
18
- can :read, Alchemy.user_class
18
+ can :read, Alchemy::User
19
19
  end
20
20
 
21
21
  if admin?
22
- can :manage, Alchemy.user_class
22
+ can :manage, Alchemy::User
23
23
  end
24
24
  end
25
25
 
@@ -1,5 +1,5 @@
1
1
  module Alchemy
2
2
  module Devise
3
- VERSION = "4.4.0"
3
+ VERSION = "5.1.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: alchemy-devise
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.4.0
4
+ version: 5.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas von Deyen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-01-09 00:00:00.000000000 Z
11
+ date: 2021-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: alchemy_cms
@@ -16,20 +16,20 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 4.1.0
19
+ version: 5.0.0
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '5.1'
22
+ version: '6'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - ">="
28
28
  - !ruby/object:Gem::Version
29
- version: 4.1.0
29
+ version: 5.0.0
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '5.1'
32
+ version: '6'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: devise
35
35
  requirement: !ruby/object:Gem::Requirement
@@ -148,12 +148,15 @@ files:
148
148
  - app/assets/stylesheets/alchemy-devise/login.scss
149
149
  - app/assets/stylesheets/alchemy-devise/users.scss
150
150
  - app/assets/stylesheets/alchemy/admin/alchemy-devise.css
151
+ - app/controllers/alchemy/admin/passwords_controller.rb
152
+ - app/controllers/alchemy/admin/user_sessions_controller.rb
151
153
  - app/controllers/alchemy/admin/users_controller.rb
152
154
  - app/controllers/alchemy/base_controller_extension.rb
153
- - app/controllers/alchemy/passwords_controller.rb
154
- - app/controllers/alchemy/user_sessions_controller.rb
155
155
  - app/mailers/alchemy/notifications.rb
156
156
  - app/models/alchemy/user.rb
157
+ - app/views/alchemy/admin/passwords/edit.html.erb
158
+ - app/views/alchemy/admin/passwords/new.html.erb
159
+ - app/views/alchemy/admin/user_sessions/new.html.erb
157
160
  - app/views/alchemy/admin/users/_fields.html.erb
158
161
  - app/views/alchemy/admin/users/_user.html.erb
159
162
  - app/views/alchemy/admin/users/edit.html.erb
@@ -172,9 +175,6 @@ files:
172
175
  - app/views/alchemy/notifications/reset_password_instructions.en.text.erb
173
176
  - app/views/alchemy/notifications/reset_password_instructions.es.text.erb
174
177
  - app/views/alchemy/notifications/reset_password_instructions.ru.text.erb
175
- - app/views/alchemy/passwords/edit.html.erb
176
- - app/views/alchemy/passwords/new.html.erb
177
- - app/views/alchemy/user_sessions/new.html.erb
178
178
  - config/initializers/alchemy.rb
179
179
  - config/routes.rb
180
180
  - config/spring.rb
@@ -210,7 +210,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
210
210
  - !ruby/object:Gem::Version
211
211
  version: '0'
212
212
  requirements: []
213
- rubygems_version: 3.0.3
213
+ rubygems_version: 3.1.4
214
214
  signing_key:
215
215
  specification_version: 4
216
216
  summary: Devise based user authentication for AlchemyCMS.
@@ -1,31 +0,0 @@
1
- module Alchemy
2
- class PasswordsController < ::Devise::PasswordsController
3
- include Alchemy::Admin::Locale
4
-
5
- before_action { enforce_ssl if ssl_required? && !request.ssl? }
6
-
7
- helper 'Alchemy::Admin::Base'
8
-
9
- layout 'alchemy/admin'
10
-
11
- private
12
-
13
- # Override for Devise method
14
- def new_session_path(resource_name)
15
- alchemy.login_path
16
- end
17
-
18
- def edit_password_url(resource, options={})
19
- alchemy.edit_password_url(options)
20
- end
21
-
22
- def after_resetting_password_path_for(resource)
23
- if can? :index, :alchemy_admin_dashboard
24
- alchemy.admin_dashboard_path
25
- else
26
- alchemy.root_path
27
- end
28
- end
29
-
30
- end
31
- end
@@ -1,62 +0,0 @@
1
- module Alchemy
2
- class UserSessionsController < ::Devise::SessionsController
3
- include Alchemy::Admin::Locale
4
-
5
- protect_from_forgery prepend: true
6
-
7
- before_action except: 'destroy' do
8
- enforce_ssl if ssl_required? && !request.ssl?
9
- end
10
-
11
- before_action :check_user_count, :only => :new
12
-
13
- helper 'Alchemy::Admin::Base'
14
-
15
- layout 'alchemy/admin'
16
-
17
- def new
18
- super
19
- end
20
-
21
- def create
22
- authenticate_user!
23
-
24
- if user_signed_in?
25
- if session[:redirect_path].blank?
26
- redirect_path = admin_dashboard_path
27
- else
28
- # We have to strip double slashes from beginning of path, because of strange rails/rack bug.
29
- redirect_path = session[:redirect_path].gsub(/\A\/{2,}/, '/')
30
- end
31
- redirect_to redirect_path,
32
- notice: t(:signed_in, scope: 'devise.sessions')
33
- else
34
- super
35
- end
36
- end
37
-
38
- def destroy
39
- current_alchemy_user.try(:unlock_pages!)
40
- cookies.clear
41
- session.clear
42
- super
43
- end
44
-
45
- private
46
-
47
- def check_user_count
48
- if User.count == 0
49
- redirect_to admin_signup_path
50
- end
51
- end
52
-
53
- # Overwriting the default of Devise
54
- def after_sign_out_path_for(resource_or_scope)
55
- if request.referer.blank? || request.referer.to_s =~ /admin/
56
- root_path
57
- else
58
- request.referer
59
- end
60
- end
61
- end
62
- end