alchemy-devise 4.3.0 → 5.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (32) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +3 -3
  3. data/Rakefile +4 -2
  4. data/app/controllers/alchemy/admin/passwords_controller.rb +34 -0
  5. data/app/controllers/alchemy/admin/user_sessions_controller.rb +65 -0
  6. data/app/controllers/alchemy/admin/users_controller.rb +2 -3
  7. data/app/controllers/alchemy/base_controller_extension.rb +13 -7
  8. data/app/mailers/alchemy/notifications.rb +1 -1
  9. data/app/models/alchemy/user.rb +0 -8
  10. data/app/views/alchemy/{passwords → admin/passwords}/edit.html.erb +2 -2
  11. data/app/views/alchemy/{passwords → admin/passwords}/new.html.erb +2 -2
  12. data/app/views/alchemy/{user_sessions → admin/user_sessions}/new.html.erb +1 -1
  13. data/app/views/alchemy/admin/users/_fields.html.erb +0 -4
  14. data/app/views/alchemy/notifications/alchemy_user_created.de.text.erb +1 -1
  15. data/app/views/alchemy/notifications/alchemy_user_created.en.text.erb +1 -1
  16. data/app/views/alchemy/notifications/alchemy_user_created.es.text.erb +1 -1
  17. data/app/views/alchemy/notifications/alchemy_user_created.ru.text.erb +1 -1
  18. data/app/views/alchemy/notifications/member_created.de.text.erb +1 -1
  19. data/app/views/alchemy/notifications/member_created.en.text.erb +1 -1
  20. data/app/views/alchemy/notifications/member_created.es.text.erb +1 -1
  21. data/app/views/alchemy/notifications/member_created.ru.text.erb +1 -1
  22. data/app/views/alchemy/notifications/reset_password_instructions.de.text.erb +1 -1
  23. data/app/views/alchemy/notifications/reset_password_instructions.en.text.erb +1 -1
  24. data/app/views/alchemy/notifications/reset_password_instructions.es.text.erb +1 -1
  25. data/app/views/alchemy/notifications/reset_password_instructions.ru.text.erb +1 -1
  26. data/config/initializers/alchemy.rb +6 -0
  27. data/config/routes.rb +19 -14
  28. data/db/migrate/20131015124700_create_alchemy_users.rb +0 -1
  29. data/lib/alchemy/devise/version.rb +1 -1
  30. metadata +19 -18
  31. data/app/controllers/alchemy/passwords_controller.rb +0 -31
  32. 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: 16abe852531b458c5467ae7f0bc7215cd1f97aa1e0778f52175a1b446fc49f92
4
- data.tar.gz: cb08640f244c3622bc34e9796d3876f9b648765129a9d39f62c4be2281b9c679
3
+ metadata.gz: bceaf41fec555e993944005a9fd8b3999c8d6cfe02c9d95d194907ed1315327f
4
+ data.tar.gz: be271d71719f1b1f3e54e91d20e8b4750f269eeaa984da3ea96e4e49242a9814
5
5
  SHA512:
6
- metadata.gz: a7b5b4e45e51d231b83d50d279816869250d90c26cca96f701d627e075636f55476e198320037701c34cd33e0be4bdae6873060f09582bf439ce6d780fd20606
7
- data.tar.gz: 056c257c023881486a96e15176de2c8802dbac68ff3766dd3e10fe63c040e607d5358828fa277fa74d38115872f4fd5d760a473def8283f64a17ff4de4c6a9fa
6
+ metadata.gz: 611103643240ab89a34a77e0b280180f6dd10cedf5fa59f1cae96c384cd4f8141d331841d71e2b52b7990dc17b41b797bea868e0e3d91ba1ab2d7c6294170d99
7
+ data.tar.gz: 8567891ceb7104874d92f681bd2cc2e24946d3d4adf80063d02b4b1289cccf70498a74975c8526dad727fd5d54c64bba0af4a19d0df90d747360502efd16bbb0
data/README.md CHANGED
@@ -1,10 +1,10 @@
1
- ## Devise based authentication for AlchemyCMS 4.2
1
+ ## Devise based authentication for AlchemyCMS
2
2
 
3
3
  [![Build Status](https://secure.travis-ci.org/AlchemyCMS/alchemy-devise.svg?branch=master)](http://travis-ci.org/AlchemyCMS/alchemy-devise)
4
4
 
5
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)
6
6
 
7
- AlchemyCMS has no authentication in its core. So it is possibly 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.
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
 
9
9
  ## Install
10
10
 
@@ -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,34 @@
1
+ module Alchemy
2
+ module Admin
3
+ class PasswordsController < ::Devise::PasswordsController
4
+ include Alchemy::Admin::Locale
5
+
6
+ if Alchemy.gem_version <= Gem::Version.new("4.9")
7
+ before_action { enforce_ssl if ssl_required? && !request.ssl? }
8
+ end
9
+
10
+ helper "Alchemy::Admin::Base"
11
+
12
+ layout "alchemy/admin"
13
+
14
+ private
15
+
16
+ # Override for Devise method
17
+ def new_session_path(resource_name)
18
+ alchemy.admin_login_path
19
+ end
20
+
21
+ def admin_edit_password_url(_resource, options = {})
22
+ alchemy.admin_edit_password_url(options)
23
+ end
24
+
25
+ def after_resetting_password_path_for(resource)
26
+ if can? :index, :alchemy_admin_dashboard
27
+ alchemy.admin_dashboard_path
28
+ else
29
+ alchemy.root_path
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,65 @@
1
+ # frozen_string_literal: true
2
+
3
+ require_dependency "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
@@ -2,7 +2,7 @@ module Alchemy
2
2
  module Admin
3
3
  class UsersController < ResourcesController
4
4
 
5
- before_action :set_roles_and_genders, except: [:index, :destroy]
5
+ before_action :set_roles, except: [:index, :destroy]
6
6
 
7
7
  load_and_authorize_resource class: Alchemy::User,
8
8
  only: [:edit, :update, :destroy]
@@ -67,13 +67,12 @@ module Alchemy
67
67
 
68
68
  private
69
69
 
70
- def set_roles_and_genders
70
+ def set_roles
71
71
  if can_update_role?
72
72
  @user_roles = User::ROLES.map do |role|
73
73
  [User.human_rolename(role), role]
74
74
  end
75
75
  end
76
- @user_genders = User.genders_for_select
77
76
  end
78
77
 
79
78
  def user_params
@@ -1,12 +1,18 @@
1
- Alchemy::BaseController.class_eval do
2
- before_action :store_user_request_time
1
+ module Alchemy
2
+ module BaseControllerExtension
3
+ def self.prepended(base)
4
+ base.before_action(:store_user_request_time)
5
+ end
3
6
 
4
- private
7
+ private
5
8
 
6
- # Stores the users request time.
7
- def store_user_request_time
8
- if alchemy_user_signed_in?
9
- current_alchemy_user.store_request_time!
9
+ # Stores the users request time.
10
+ def store_user_request_time
11
+ if alchemy_user_signed_in?
12
+ current_alchemy_user.store_request_time!
13
+ end
10
14
  end
11
15
  end
12
16
  end
17
+
18
+ Alchemy::BaseController.prepend Alchemy::BaseControllerExtension
@@ -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")
@@ -8,7 +8,6 @@ module Alchemy
8
8
  :lastname,
9
9
  :login,
10
10
  :email,
11
- :gender,
12
11
  :language,
13
12
  :password,
14
13
  :password_confirmation,
@@ -41,13 +40,6 @@ module Alchemy
41
40
  Alchemy.t("user_roles.#{role}")
42
41
  end
43
42
 
44
- def genders_for_select
45
- [
46
- [Alchemy.t('male'), 'male'],
47
- [Alchemy.t('female'), 'female']
48
- ]
49
- end
50
-
51
43
  def logged_in_timeout
52
44
  Config.get(:auto_logout_time).minutes.to_i
53
45
  end
@@ -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,7 +1,3 @@
1
- <%= f.input :gender,
2
- collection: @user_genders,
3
- prompt: Alchemy.t('Please choose'),
4
- input_html: {class: 'alchemy_selectbox'} %>
5
1
  <%= f.input :firstname %>
6
2
  <%= f.input :lastname %>
7
3
  <%= f.input :login, autofocus: true %>
@@ -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
  Ваш пароль не изменится до тех пор, пока вы не перейдете по ссылке и сами не измените его.
@@ -18,3 +18,9 @@ Alchemy.user_class_name = 'Alchemy::User'
18
18
  Alchemy.signup_path = '/admin/signup'
19
19
  Alchemy.login_path = '/admin/login'
20
20
  Alchemy.logout_path = '/admin/logout'
21
+
22
+ if Alchemy.respond_to?(:logout_method)
23
+ Rails.application.config.after_initialize do
24
+ Alchemy.logout_method = Devise.sign_out_via
25
+ end
26
+ end
@@ -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
@@ -6,7 +6,6 @@ class CreateAlchemyUsers < ActiveRecord::Migration[4.2]
6
6
  t.string "lastname"
7
7
  t.string "login"
8
8
  t.string "email"
9
- t.string "gender"
10
9
  t.string "language"
11
10
  t.string "encrypted_password", limit: 128, default: "", null: false
12
11
  t.string "password_salt", limit: 128, default: "", null: false
@@ -1,5 +1,5 @@
1
1
  module Alchemy
2
2
  module Devise
3
- VERSION = "4.3.0"
3
+ VERSION = "5.0.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.3.0
4
+ version: 5.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Thomas von Deyen
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-08-23 00:00:00.000000000 Z
11
+ date: 2020-11-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: alchemy_cms
@@ -16,40 +16,40 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 4.1.0.beta
19
+ version: 4.1.0
20
20
  - - "<"
21
21
  - !ruby/object:Gem::Version
22
- version: '4.99'
22
+ version: '5.1'
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.beta
29
+ version: 4.1.0
30
30
  - - "<"
31
31
  - !ruby/object:Gem::Version
32
- version: '4.99'
32
+ version: '5.1'
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: devise
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - ">="
38
38
  - !ruby/object:Gem::Version
39
- version: 4.6.0
39
+ version: 4.7.1
40
40
  - - "<"
41
41
  - !ruby/object:Gem::Version
42
- version: '4.99'
42
+ version: '5'
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - ">="
48
48
  - !ruby/object:Gem::Version
49
- version: 4.6.0
49
+ version: 4.7.1
50
50
  - - "<"
51
51
  - !ruby/object:Gem::Version
52
- version: '4.99'
52
+ version: '5'
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: capybara
55
55
  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,8 +210,9 @@ 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
214
- signing_key:
213
+ rubygems_version: 3.1.4
214
+ signing_key:
215
215
  specification_version: 4
216
216
  summary: Devise based user authentication for AlchemyCMS.
217
217
  test_files: []
218
+ ...
@@ -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