alchemy-devise 1.1.0 → 2.0.0
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/assets/stylesheets/alchemy/login.scss +11 -18
- data/app/assets/stylesheets/alchemy/users.scss +4 -6
- data/app/controllers/alchemy/admin/users_controller.rb +31 -23
- data/app/controllers/alchemy/base_controller_extension.rb +1 -1
- data/app/controllers/alchemy/passwords_controller.rb +6 -6
- data/app/controllers/alchemy/user_sessions_controller.rb +8 -15
- data/app/controllers/alchemy/users_controller.rb +19 -10
- data/app/mailers/alchemy/notifications.rb +1 -1
- data/app/models/alchemy/user.rb +14 -16
- data/app/views/alchemy/admin/users/_fields.html.erb +25 -0
- data/app/views/alchemy/admin/users/_user.html.erb +20 -25
- data/app/views/alchemy/admin/users/edit.html.erb +3 -6
- data/app/views/alchemy/admin/users/index.html.erb +6 -6
- data/app/views/alchemy/admin/users/new.html.erb +3 -6
- data/app/views/alchemy/notifications/{registered_user_created.de.text.erb → member_created.de.text.erb} +0 -0
- data/app/views/alchemy/notifications/{registered_user_created.en.text.erb → member_created.en.text.erb} +0 -0
- data/app/views/alchemy/passwords/edit.html.erb +9 -21
- data/app/views/alchemy/passwords/new.html.erb +7 -16
- data/app/views/alchemy/user_sessions/new.html.erb +11 -30
- data/app/views/alchemy/users/new.html.erb +7 -8
- data/config/initializers/alchemy.rb +4 -0
- data/config/locales/alchemy.nl.yml +41 -0
- data/config/locales/devise.nl.yml +58 -0
- data/config/locales/simple_form.de.yml +6 -0
- data/config/locales/simple_form.en.yml +6 -0
- data/config/locales/simple_form.nl.yml +6 -0
- data/config/routes.rb +1 -1
- data/db/migrate/20131225232042_add_alchemy_roles_to_alchemy_users.rb +2 -2
- data/lib/alchemy/devise/ability.rb +22 -0
- data/lib/alchemy/devise/engine.rb +0 -5
- data/lib/alchemy/devise/version.rb +1 -1
- metadata +17 -12
- data/app/views/alchemy/admin/users/_table.html.erb +0 -69
- data/config/authorization_rules.rb +0 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3886a8e19ee775f3fb20d7bf77175b073bb718a0
|
4
|
+
data.tar.gz: 1c535e7e01e5b41f09391e571135235827652071
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 502f382ed855aadf4643e05b2ea60b66ea8499b9c462806e09e784fea63d60b19d871a8476bd1df0a030972954229cff808c6c75c8685198c01471c2169ba3ca
|
7
|
+
data.tar.gz: d4b8b2c782f6105f5f979e0aa3556be86c139697efbcd5026a927ce9721ac21934d53df55a419a9c4c7577d49a5b8f833609e7234fa5a916bb24f4aa6388b4b6
|
@@ -1,35 +1,28 @@
|
|
1
1
|
div#alchemy_greeting {
|
2
|
-
width:
|
3
|
-
margin
|
4
|
-
margin-left: auto;
|
5
|
-
padding: 2*$default-padding;
|
6
|
-
margin-top: -4em;
|
7
|
-
text-align: center;
|
8
|
-
|
9
|
-
p {
|
10
|
-
margin-top: 1em;
|
11
|
-
margin-bottom: 1em;
|
12
|
-
}
|
2
|
+
width: 424px;
|
3
|
+
margin: -4em auto 0 auto;
|
13
4
|
|
14
|
-
|
15
|
-
margin-
|
16
|
-
margin-bottom: 0;
|
17
|
-
font-size: 1.2em;
|
5
|
+
img {
|
6
|
+
margin-left: 158px;
|
18
7
|
}
|
19
8
|
}
|
20
9
|
|
10
|
+
#logo {
|
11
|
+
width: 240px;
|
12
|
+
height: 70px;
|
13
|
+
}
|
14
|
+
|
21
15
|
div.login_signup_box {
|
22
16
|
width: 390px;
|
23
17
|
padding: 4*$default-padding;
|
24
18
|
border: $default-border;
|
25
19
|
background-color: $medium-gray;
|
26
|
-
@extend
|
20
|
+
@extend %rounded-border;
|
27
21
|
margin: 2em auto;
|
28
|
-
|
29
|
-
input[type="text"], input.thin_border { width: 250px }
|
30
22
|
}
|
31
23
|
|
32
24
|
html.no-js {
|
25
|
+
|
33
26
|
div.login_signup_box, div#alchemy_greeting h1 {
|
34
27
|
display: none;
|
35
28
|
}
|
@@ -2,18 +2,21 @@ module Alchemy
|
|
2
2
|
module Admin
|
3
3
|
class UsersController < ResourcesController
|
4
4
|
|
5
|
-
|
6
|
-
filter_access_to [:index, :new, :create], :attribute_check => false
|
5
|
+
before_action :set_roles_and_genders, except: [:index, :destroy]
|
7
6
|
|
8
|
-
|
7
|
+
load_and_authorize_resource class: Alchemy::User,
|
8
|
+
only: [:edit, :update, :destroy]
|
9
|
+
|
10
|
+
authorize_resource class: Alchemy::User,
|
11
|
+
only: [:index, :new, :create]
|
9
12
|
|
10
13
|
handles_sortable_columns do |c|
|
11
14
|
c.default_sort_value = :login
|
12
15
|
end
|
13
16
|
|
14
17
|
def index
|
15
|
-
if
|
16
|
-
users = User.where([
|
18
|
+
if params[:query].present?
|
19
|
+
@users = User.where([
|
17
20
|
"login LIKE ? OR email LIKE ? OR firstname LIKE ? OR lastname LIKE ?",
|
18
21
|
"%#{params[:query]}%",
|
19
22
|
"%#{params[:query]}%",
|
@@ -21,13 +24,17 @@ module Alchemy
|
|
21
24
|
"%#{params[:query]}%"
|
22
25
|
])
|
23
26
|
else
|
24
|
-
users = User.
|
27
|
+
@users = User.all
|
25
28
|
end
|
26
|
-
@users = users.page(params[:page] || 1).per(per_page_value_for_screen_size).order(sort_order)
|
29
|
+
@users = @users.page(params[:page] || 1).per(per_page_value_for_screen_size).order(sort_order)
|
30
|
+
end
|
31
|
+
|
32
|
+
def new
|
33
|
+
@user = User.new(send_credentials: true)
|
27
34
|
end
|
28
35
|
|
29
36
|
def create
|
30
|
-
@user = User.create(
|
37
|
+
@user = User.create(user_params)
|
31
38
|
render_errors_or_redirect(
|
32
39
|
@user,
|
33
40
|
admin_users_path,
|
@@ -37,11 +44,10 @@ module Alchemy
|
|
37
44
|
|
38
45
|
def update
|
39
46
|
# User is fetched via before filter
|
40
|
-
params[:user].delete(:alchemy_roles) unless permitted_to?(:update_roles)
|
41
47
|
if params[:user][:password].present?
|
42
|
-
@user.update_attributes(
|
48
|
+
@user.update_attributes(user_params)
|
43
49
|
else
|
44
|
-
@user.update_without_password(
|
50
|
+
@user.update_without_password(user_params)
|
45
51
|
end
|
46
52
|
render_errors_or_redirect(
|
47
53
|
@user,
|
@@ -54,28 +60,30 @@ module Alchemy
|
|
54
60
|
# User is fetched via before filter
|
55
61
|
name = @user.name
|
56
62
|
if @user.destroy
|
57
|
-
flash[:notice] = _t("User deleted", :
|
58
|
-
end
|
59
|
-
respond_to do |format|
|
60
|
-
format.html { redirect_to admin_users_path }
|
61
|
-
format.js do
|
62
|
-
@redirect_url = admin_users_path
|
63
|
-
render action: 'redirect'
|
64
|
-
end
|
63
|
+
flash[:notice] = _t("User deleted", name: name)
|
65
64
|
end
|
65
|
+
do_redirect_to admin_users_path
|
66
66
|
end
|
67
67
|
|
68
68
|
private
|
69
69
|
|
70
|
-
def load_user
|
71
|
-
@user = User.find(params[:id])
|
72
|
-
end
|
73
|
-
|
74
70
|
def set_roles_and_genders
|
75
71
|
@user_roles = User::ROLES.map { |role| [User.human_rolename(role), role] }
|
76
72
|
@user_genders = User.genders_for_select
|
77
73
|
end
|
78
74
|
|
75
|
+
def user_params
|
76
|
+
params.require(:user).permit(*secure_attributes)
|
77
|
+
end
|
78
|
+
|
79
|
+
def secure_attributes
|
80
|
+
if can?(:update_role, Alchemy::User)
|
81
|
+
User::PERMITTED_ATTRIBUTES + [{alchemy_roles: []}]
|
82
|
+
else
|
83
|
+
User::PERMITTED_ATTRIBUTES
|
84
|
+
end
|
85
|
+
end
|
86
|
+
|
79
87
|
end
|
80
88
|
end
|
81
89
|
end
|
@@ -1,10 +1,10 @@
|
|
1
1
|
module Alchemy
|
2
2
|
class PasswordsController < ::Devise::PasswordsController
|
3
|
-
include
|
4
|
-
|
3
|
+
include Locale
|
4
|
+
|
5
|
+
before_action { enforce_ssl if ssl_required? && !request.ssl? }
|
5
6
|
|
6
|
-
|
7
|
-
before_filter :set_translation
|
7
|
+
helper 'Alchemy::Admin::Base', 'Alchemy::Pages'
|
8
8
|
|
9
9
|
layout 'alchemy/login'
|
10
10
|
|
@@ -19,8 +19,8 @@ module Alchemy
|
|
19
19
|
alchemy.edit_password_url(options)
|
20
20
|
end
|
21
21
|
|
22
|
-
def
|
23
|
-
if
|
22
|
+
def after_resetting_password_path_for(resource)
|
23
|
+
if can? :index, :alchemy_admin_dashboard
|
24
24
|
alchemy.admin_dashboard_path
|
25
25
|
else
|
26
26
|
alchemy.root_path
|
@@ -1,12 +1,11 @@
|
|
1
1
|
module Alchemy
|
2
2
|
class UserSessionsController < ::Devise::SessionsController
|
3
|
-
|
4
|
-
|
5
|
-
|
3
|
+
include Locale
|
4
|
+
|
5
|
+
before_action(except: 'destroy') { enforce_ssl if ssl_required? && !request.ssl? }
|
6
|
+
before_action :check_user_count, :only => :new
|
6
7
|
|
7
|
-
|
8
|
-
before_filter :set_translation
|
9
|
-
before_filter :check_user_count, :only => :new
|
8
|
+
helper 'Alchemy::Admin::Base', 'Alchemy::Pages'
|
10
9
|
|
11
10
|
layout 'alchemy/login'
|
12
11
|
|
@@ -16,13 +15,13 @@ module Alchemy
|
|
16
15
|
|
17
16
|
def create
|
18
17
|
authenticate_user!
|
19
|
-
if
|
18
|
+
if user_signed_in?
|
20
19
|
store_screen_size
|
21
20
|
if session[:redirect_path].blank?
|
22
21
|
redirect_path = admin_dashboard_path
|
23
22
|
else
|
24
23
|
# We have to strip double slashes from beginning of path, because of strange rails/rack bug.
|
25
|
-
redirect_path = session[:redirect_path].gsub(
|
24
|
+
redirect_path = session[:redirect_path].gsub(/\A\/{2,}/, '/')
|
26
25
|
end
|
27
26
|
redirect_to redirect_path, :notice => t(:signed_in, :scope => 'devise.sessions')
|
28
27
|
else
|
@@ -30,10 +29,6 @@ module Alchemy
|
|
30
29
|
end
|
31
30
|
end
|
32
31
|
|
33
|
-
def leave
|
34
|
-
render layout: !request.xhr?
|
35
|
-
end
|
36
|
-
|
37
32
|
def destroy
|
38
33
|
current_alchemy_user.try(:unlock_pages!)
|
39
34
|
cookies.clear
|
@@ -46,8 +41,6 @@ module Alchemy
|
|
46
41
|
def check_user_count
|
47
42
|
if User.count == 0
|
48
43
|
redirect_to signup_path
|
49
|
-
else
|
50
|
-
return true
|
51
44
|
end
|
52
45
|
end
|
53
46
|
|
@@ -55,7 +48,7 @@ module Alchemy
|
|
55
48
|
session[:screen_size] = params[:user_screensize]
|
56
49
|
end
|
57
50
|
|
58
|
-
#
|
51
|
+
# Overwriting the default of Devise
|
59
52
|
def after_sign_out_path_for(resource_or_scope)
|
60
53
|
if request.referer.blank? || request.referer.to_s =~ /admin/
|
61
54
|
root_path
|
@@ -1,33 +1,34 @@
|
|
1
1
|
module Alchemy
|
2
2
|
class UsersController < BaseController
|
3
|
+
include Locale
|
3
4
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
before_filter :load_genders
|
8
|
-
|
9
|
-
layout 'alchemy/admin'
|
5
|
+
before_action { enforce_ssl if ssl_required? && !request.ssl? }
|
6
|
+
before_action :check_user_count
|
7
|
+
before_action :load_genders
|
10
8
|
|
11
9
|
helper 'Alchemy::Admin::Base'
|
12
10
|
|
11
|
+
layout 'alchemy/admin'
|
12
|
+
|
13
13
|
def new
|
14
14
|
@signup = true
|
15
|
-
@user = User.new(:
|
15
|
+
@user = User.new(send_credentials: true)
|
16
16
|
end
|
17
17
|
|
18
18
|
def create
|
19
|
-
@user = User.new(
|
19
|
+
@user = User.new(user_params)
|
20
|
+
@user.alchemy_roles = %w(admin)
|
20
21
|
if @user.save
|
21
22
|
flash[:notice] = _t('Successfully signup admin user')
|
22
23
|
sign_in :user, @user
|
23
|
-
redirect_to
|
24
|
+
redirect_to admin_pages_path
|
24
25
|
else
|
25
26
|
@signup = true
|
26
27
|
render :new
|
27
28
|
end
|
28
29
|
rescue Errno::ECONNREFUSED => e
|
29
30
|
flash[:error] = _t(:signup_mail_delivery_error)
|
30
|
-
redirect_to
|
31
|
+
redirect_to admin_pages_path
|
31
32
|
end
|
32
33
|
|
33
34
|
private
|
@@ -42,5 +43,13 @@ module Alchemy
|
|
42
43
|
end
|
43
44
|
end
|
44
45
|
|
46
|
+
def user_params
|
47
|
+
params.require(:user).permit(*secure_attributes)
|
48
|
+
end
|
49
|
+
|
50
|
+
def secure_attributes
|
51
|
+
User::PERMITTED_ATTRIBUTES
|
52
|
+
end
|
53
|
+
|
45
54
|
end
|
46
55
|
end
|
data/app/models/alchemy/user.rb
CHANGED
@@ -3,7 +3,18 @@ require 'acts-as-taggable-on'
|
|
3
3
|
|
4
4
|
module Alchemy
|
5
5
|
class User < ActiveRecord::Base
|
6
|
-
|
6
|
+
PERMITTED_ATTRIBUTES = [
|
7
|
+
:firstname,
|
8
|
+
:lastname,
|
9
|
+
:login,
|
10
|
+
:email,
|
11
|
+
:gender,
|
12
|
+
:language,
|
13
|
+
:password,
|
14
|
+
:password_confirmation,
|
15
|
+
:send_credentials,
|
16
|
+
:tag_list
|
17
|
+
]
|
7
18
|
DEVISE_MODULES = [
|
8
19
|
:database_authenticatable,
|
9
20
|
:trackable,
|
@@ -21,20 +32,6 @@ module Alchemy
|
|
21
32
|
acts_as_taggable
|
22
33
|
acts_as_tagger
|
23
34
|
|
24
|
-
attr_accessible(
|
25
|
-
:alchemy_roles,
|
26
|
-
:firstname,
|
27
|
-
:lastname,
|
28
|
-
:login,
|
29
|
-
:email,
|
30
|
-
:gender,
|
31
|
-
:language,
|
32
|
-
:password,
|
33
|
-
:password_confirmation,
|
34
|
-
:send_credentials,
|
35
|
-
:tag_list
|
36
|
-
)
|
37
|
-
|
38
35
|
attr_accessor :send_credentials
|
39
36
|
|
40
37
|
has_many :folded_pages
|
@@ -136,6 +133,7 @@ module Alchemy
|
|
136
133
|
end
|
137
134
|
end
|
138
135
|
alias_method :name, :fullname
|
136
|
+
alias_method :alchemy_display_name, :fullname
|
139
137
|
|
140
138
|
# Returns true if the last request not longer ago then the logged_in_time_out
|
141
139
|
def logged_in?
|
@@ -170,7 +168,7 @@ module Alchemy
|
|
170
168
|
if has_role?('author') || has_role?('editor') || has_role?('admin')
|
171
169
|
Notifications.alchemy_user_created(self).deliver
|
172
170
|
else
|
173
|
-
Notifications.
|
171
|
+
Notifications.member_created(self).deliver
|
174
172
|
end
|
175
173
|
end
|
176
174
|
|
@@ -0,0 +1,25 @@
|
|
1
|
+
<%= f.input :gender,
|
2
|
+
collection: @user_genders,
|
3
|
+
prompt: _t('Please choose'),
|
4
|
+
input_html: {class: 'alchemy_selectbox'} %>
|
5
|
+
<%= f.input :firstname %>
|
6
|
+
<%= f.input :lastname %>
|
7
|
+
<%= f.input :login, autofocus: true %>
|
8
|
+
<%= f.input :email %>
|
9
|
+
<%= f.input :language, collection: translations_for_select, include_blank: false, input_html: {class: 'alchemy_selectbox'} %>
|
10
|
+
<%= f.input :password %>
|
11
|
+
<%= f.input :password_confirmation %>
|
12
|
+
<% if can? :update_role, @user %>
|
13
|
+
<%= f.input :alchemy_roles,
|
14
|
+
collection: Alchemy::User::ROLES.map { |role| [Alchemy::User.human_rolename(role), role] },
|
15
|
+
input_html: {multiple: true, class: 'alchemy_selectbox'},
|
16
|
+
as: 'select' %>
|
17
|
+
<% end %>
|
18
|
+
<% unless @signup %>
|
19
|
+
<div class="input tag_list">
|
20
|
+
<%= f.label :tag_list %>
|
21
|
+
<%= render 'alchemy/admin/partials/autocomplete_tag_list', f: f, object: @user %>
|
22
|
+
</div>
|
23
|
+
<% end %>
|
24
|
+
<%= f.input :send_credentials, as: 'boolean' %>
|
25
|
+
<%= f.submit _t(:save) %>
|
@@ -1,5 +1,5 @@
|
|
1
1
|
<tr class="<%= cycle('even', 'odd') %>">
|
2
|
-
<td class="icon"><%= content_tag 'span', '', :
|
2
|
+
<td class="icon"><%= content_tag 'span', '', class: "icon user#{user.gender == 'female' ? ' female' : ' male'}" %></td>
|
3
3
|
<td>
|
4
4
|
<%= render_icon(user.logged_in? ? 'online' : 'offline') %>
|
5
5
|
</td>
|
@@ -8,32 +8,27 @@
|
|
8
8
|
<td><%= user.lastname %></td>
|
9
9
|
<td class="email"><%= user.email %></td>
|
10
10
|
<td><%= _t(user.language, scope: 'translations', default: _t(:unknown)) %></td>
|
11
|
-
<td><%= user.last_sign_in_at.present? ? l(user.last_sign_in_at, :
|
11
|
+
<td><%= user.last_sign_in_at.present? ? l(user.last_sign_in_at, format: :default) : _t(:unknown) %></td>
|
12
12
|
<td class="role"><%= user.human_roles_string %></td>
|
13
13
|
<td class="tools">
|
14
|
-
|
15
|
-
<%=
|
16
|
-
|
17
|
-
_t(:
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
{
|
28
|
-
:
|
29
|
-
:
|
30
|
-
:size => '420x580'
|
31
|
-
},
|
32
|
-
{
|
33
|
-
:class => "icon user_edit#{user.gender == 'female' ? ' female' : ' male'}",
|
34
|
-
:title => _t(:edit_user)
|
14
|
+
<% if can?(:destroy, user) %>
|
15
|
+
<%= delete_button alchemy.admin_user_path(user), {
|
16
|
+
message: _t(:confirm_to_delete_user),
|
17
|
+
title: _t(:delete_user),
|
18
|
+
icon: "user_delete#{user.gender == 'female' ? ' female' : ' male'}"
|
19
|
+
} %>
|
20
|
+
<% end %>
|
21
|
+
<% if can?(:edit, user) %>
|
22
|
+
<%= link_to_dialog '',
|
23
|
+
alchemy.edit_admin_user_path(user), {
|
24
|
+
title: _t(:edit_user),
|
25
|
+
overflow: true,
|
26
|
+
size: '430x560'
|
27
|
+
}, {
|
28
|
+
class: "icon user_edit#{user.gender == 'female' ? ' female' : ' male'}",
|
29
|
+
title: _t(:edit_user)
|
35
30
|
}
|
36
|
-
|
37
|
-
|
31
|
+
%>
|
32
|
+
<% end %>
|
38
33
|
</td>
|
39
34
|
</tr>
|
@@ -1,6 +1,3 @@
|
|
1
|
-
|
2
|
-
<%=
|
3
|
-
|
4
|
-
<%= render :partial => 'table', :locals => {:f => f} %>
|
5
|
-
<% end %>
|
6
|
-
</div>
|
1
|
+
<%= alchemy_form_for [:admin, @user] do |f| %>
|
2
|
+
<%= render 'fields', f: f %>
|
3
|
+
<% end %>
|
@@ -5,12 +5,12 @@
|
|
5
5
|
label: _t(:create_user),
|
6
6
|
url: alchemy.new_admin_user_path,
|
7
7
|
title: _t(:create_user),
|
8
|
-
hotkey: 'alt
|
9
|
-
|
8
|
+
hotkey: 'alt+n',
|
9
|
+
dialog_options: {
|
10
10
|
title: _t(:create_user),
|
11
|
-
size: "
|
11
|
+
size: "430x560"
|
12
12
|
},
|
13
|
-
if_permitted_to: [:
|
13
|
+
if_permitted_to: [:create, Alchemy::User]
|
14
14
|
}
|
15
15
|
]
|
16
16
|
) %>
|
@@ -39,13 +39,13 @@
|
|
39
39
|
<th>
|
40
40
|
<%= sortable_column(Alchemy::User.human_attribute_name('last_sign_in_at'), column: :last_sign_in_at) %>
|
41
41
|
</th>
|
42
|
-
<th class="role"><%= Alchemy::User.human_attribute_name('
|
42
|
+
<th class="role"><%= Alchemy::User.human_attribute_name('roles') %></th>
|
43
43
|
<th class="tools"></th>
|
44
44
|
</tr>
|
45
45
|
<%= render partial: 'alchemy/admin/users/user', collection: @users %>
|
46
46
|
</table>
|
47
47
|
|
48
|
-
<%= paginate @users %>
|
48
|
+
<%= paginate @users, theme: 'alchemy' %>
|
49
49
|
|
50
50
|
<% elsif params[:query] %>
|
51
51
|
|
@@ -1,6 +1,3 @@
|
|
1
|
-
|
2
|
-
<%=
|
3
|
-
|
4
|
-
<%= render :partial => 'table', :locals => {:f => f} %>
|
5
|
-
<% end %>
|
6
|
-
</div>
|
1
|
+
<%= alchemy_form_for [:admin, @user] do |f| %>
|
2
|
+
<%= render 'fields', f: f %>
|
3
|
+
<% end %>
|
File without changes
|
File without changes
|
@@ -1,35 +1,23 @@
|
|
1
1
|
<div id="login_box">
|
2
2
|
<div id="alchemy_greeting">
|
3
|
-
<%= image_tag("alchemy/alchemy-logo.
|
3
|
+
<%= image_tag("alchemy/alchemy-logo.svg", style: "width: 240px; height: 70px") %>
|
4
4
|
</div>
|
5
5
|
<div class="login_signup_box">
|
6
|
-
|
6
|
+
<% if @user.errors.blank? %>
|
7
7
|
<%= render_message do %>
|
8
8
|
<h1><%= _t 'Password reset' %></h1>
|
9
9
|
<p><%= _t 'Please enter a new password' %></p>
|
10
10
|
<% end %>
|
11
|
-
|
11
|
+
<% else %>
|
12
12
|
<div id="errors" style="display: block">
|
13
13
|
<%= devise_error_messages! %>
|
14
14
|
</div>
|
15
|
-
|
16
|
-
<%=
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
</tr>
|
22
|
-
<tr>
|
23
|
-
<td class="label"><%= f.label :password_confirmation, _t("Confirm new password") %></td>
|
24
|
-
<td class="input"><%= f.password_field :password_confirmation %></td>
|
25
|
-
</tr>
|
26
|
-
<tr>
|
27
|
-
<td colspan="2" class="submit">
|
28
|
-
<%= f.hidden_field :reset_password_token %>
|
29
|
-
<%= f.button _t("Change password") %>
|
30
|
-
</td>
|
31
|
-
</tr>
|
32
|
-
</table>
|
15
|
+
<% end %>
|
16
|
+
<%= alchemy_form_for resource, as: resource_name, url: update_password_path, method: 'patch' do |f| %>
|
17
|
+
<%= f.hidden_field :reset_password_token %>
|
18
|
+
<%= f.input :password, autofocus: true, label: _t("New password") %>
|
19
|
+
<%= f.input :password_confirmation, label: _t("Confirm new password") %>
|
20
|
+
<%= f.submit _t("Change password") %>
|
33
21
|
<% end %>
|
34
22
|
</div>
|
35
23
|
</div>
|
@@ -1,30 +1,21 @@
|
|
1
1
|
<div id="login_box">
|
2
2
|
<div id="alchemy_greeting">
|
3
|
-
<%= image_tag("alchemy/alchemy-logo.
|
3
|
+
<%= image_tag("alchemy/alchemy-logo.svg", style: "width: 240px; height: 70px") %>
|
4
4
|
</div>
|
5
5
|
<div class="login_signup_box">
|
6
|
-
|
6
|
+
<% if @user.errors.blank? %>
|
7
7
|
<%= render_message do %>
|
8
8
|
<h1><%= _t 'Password reset' %></h1>
|
9
9
|
<p><%= _t 'Please enter your email address' %></p>
|
10
10
|
<% end %>
|
11
|
-
|
11
|
+
<% else %>
|
12
12
|
<div id="errors" style="display: block">
|
13
13
|
<%= devise_error_messages! %>
|
14
14
|
</div>
|
15
|
-
|
16
|
-
<%=
|
17
|
-
|
18
|
-
|
19
|
-
<td class="label"><%= f.label :email %></td>
|
20
|
-
<td class="input"><%= f.email_field :email, :autofocus => true %></td>
|
21
|
-
</tr>
|
22
|
-
<tr>
|
23
|
-
<td colspan="2" class="submit">
|
24
|
-
<%= f.button _t("Send reset instructions") %>
|
25
|
-
</td>
|
26
|
-
</tr>
|
27
|
-
</table>
|
15
|
+
<% end %>
|
16
|
+
<%= alchemy_form_for :user, url: reset_password_path, html: {method: 'post'} do |f| %>
|
17
|
+
<%= f.input :email, autofocus: true %>
|
18
|
+
<%= f.submit _t("Send reset instructions") %>
|
28
19
|
<% end %>
|
29
20
|
</div>
|
30
21
|
</div>
|
@@ -1,37 +1,18 @@
|
|
1
1
|
<div id="login_box">
|
2
2
|
<div id="alchemy_greeting">
|
3
|
-
<%= image_tag
|
3
|
+
<%= image_tag 'alchemy/alchemy-logo.svg', id: 'logo' %>
|
4
4
|
</div>
|
5
5
|
<div class="login_signup_box">
|
6
|
-
<%=
|
7
|
-
<%= f.
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
</tr>
|
17
|
-
<tr>
|
18
|
-
<td class="label">
|
19
|
-
<%= f.label :password %>
|
20
|
-
</td>
|
21
|
-
<td class="input">
|
22
|
-
<%= f.password_field :password, :class => 'thin_border' %>
|
23
|
-
<p class="foot_note">
|
24
|
-
<%= link_to _t('Forgot your password?'), new_password_path %>
|
25
|
-
</p>
|
26
|
-
</td>
|
27
|
-
</tr>
|
28
|
-
<tr>
|
29
|
-
<td colspan="2" class="submit">
|
30
|
-
<%= hidden_field_tag 'user_screensize' %>
|
31
|
-
<%= f.button _t(:login), :class => 'button', :name => nil %>
|
32
|
-
</td>
|
33
|
-
</tr>
|
34
|
-
</table>
|
6
|
+
<%= alchemy_form_for :user, url: {action: 'create'}, id: 'login' do |f| %>
|
7
|
+
<%= f.input :login, autofocus: true %>
|
8
|
+
<%= f.input :password %>
|
9
|
+
<p class="foot_note">
|
10
|
+
<%= link_to _t('Forgot your password?'), new_password_path %>
|
11
|
+
</p>
|
12
|
+
<div class="submit">
|
13
|
+
<%= hidden_field_tag 'user_screensize' %>
|
14
|
+
<button><%= _t(:login) %></button>
|
15
|
+
</div>
|
35
16
|
<% end %>
|
36
17
|
</div>
|
37
18
|
</div>
|
@@ -1,14 +1,13 @@
|
|
1
1
|
<div id="alchemy_greeting">
|
2
|
-
<%= image_tag
|
3
|
-
<h1><%= _t('Welcome to Alchemy') %></h1>
|
4
|
-
<p>
|
5
|
-
<%= _t("Please Signup") %>
|
6
|
-
</p>
|
2
|
+
<%= image_tag 'alchemy/alchemy-logo.svg', id: 'logo' %>
|
7
3
|
</div>
|
8
4
|
|
9
5
|
<div id="user_signup" class="login_signup_box">
|
10
|
-
<%=
|
11
|
-
|
12
|
-
|
6
|
+
<%= render_message do %>
|
7
|
+
<h1><%= _t('Welcome to Alchemy') %></h1>
|
8
|
+
<p><%= _t("Please Signup") %></p>
|
9
|
+
<% end %>
|
10
|
+
<%= alchemy_form_for @user do |f| %>
|
11
|
+
<%= render 'alchemy/admin/users/fields', f: f %>
|
13
12
|
<% end %>
|
14
13
|
</div>
|
@@ -1,6 +1,9 @@
|
|
1
|
+
require 'alchemy/devise/ability'
|
2
|
+
|
1
3
|
Alchemy::Modules.register_module({
|
2
4
|
name: 'users',
|
3
5
|
engine_name: 'alchemy',
|
6
|
+
position: 4.1,
|
4
7
|
navigation: {
|
5
8
|
name: 'modules.users',
|
6
9
|
controller: 'alchemy/admin/users',
|
@@ -17,3 +20,4 @@ Alchemy::Modules.register_module({
|
|
17
20
|
Alchemy.user_class_name = 'Alchemy::User'
|
18
21
|
Alchemy.login_path = '/admin/login'
|
19
22
|
Alchemy.logout_path = '/admin/logout'
|
23
|
+
Alchemy.register_ability Alchemy::Devise::Ability
|
@@ -0,0 +1,41 @@
|
|
1
|
+
nl:
|
2
|
+
alchemy:
|
3
|
+
confirm_to_delete_user: "Wilt u deze gebruiker zeker verwijderen?"
|
4
|
+
create_user: "Nieuwe gebruiker aanmaken"
|
5
|
+
delete_user: "Deze gebruiker verwijderen"
|
6
|
+
edit_user: "Eigenschappen van de gebruiker aanpassen"
|
7
|
+
modules:
|
8
|
+
user_sessions: "Aanmelden"
|
9
|
+
users: "Gebruikers"
|
10
|
+
"No users found": "Geen gebruikers gevonden"
|
11
|
+
|
12
|
+
activerecord:
|
13
|
+
models:
|
14
|
+
alchemy/user:
|
15
|
+
one: Gebruiker
|
16
|
+
other: Gebruikers
|
17
|
+
|
18
|
+
attributes:
|
19
|
+
alchemy/user:
|
20
|
+
email: "Email"
|
21
|
+
firstname: "Voornaam"
|
22
|
+
gender: "Geslacht"
|
23
|
+
language: "Taal"
|
24
|
+
lastname: "Achternaam"
|
25
|
+
last_sign_in_at: "Laatst aangemeld op"
|
26
|
+
login: "Gebruikersnaam"
|
27
|
+
name: "Naam"
|
28
|
+
password: "Wachtwoord"
|
29
|
+
password_confirmation: "Bevestiging wachtwoord"
|
30
|
+
alchemy_roles: "Gebruikersrollen"
|
31
|
+
send_credentials: "Email met gegevens versturen"
|
32
|
+
tag_list: Tags
|
33
|
+
|
34
|
+
errors:
|
35
|
+
models:
|
36
|
+
alchemy/user:
|
37
|
+
attributes:
|
38
|
+
email:
|
39
|
+
invalid: "Is geen valide e-mailadres"
|
40
|
+
alchemy_roles:
|
41
|
+
blank: "Er moet tenminste één rol worden geselecteerd."
|
@@ -0,0 +1,58 @@
|
|
1
|
+
|
2
|
+
nl:
|
3
|
+
devise:
|
4
|
+
confirmations:
|
5
|
+
confirmed: Je account is bevestigd.
|
6
|
+
send_instructions: Je ontvangt via e-mail instructies hoe je je account kan bevestigen.
|
7
|
+
send_paranoid_instructions: Als we je e-mail adres terugvinden in onze database, zal je binnen enkele ogenblikken een e-mail ontvangen met de instructies hoe je je account kan bevestigen.
|
8
|
+
failure:
|
9
|
+
already_authenticated: Je bent reeds aangemeld.
|
10
|
+
inactive: Je account is nog niet geactiveerd.
|
11
|
+
invalid: Ongeldig e-mail of wachtwoord.
|
12
|
+
last_attempt:
|
13
|
+
locked: Je account is vergrendeld.
|
14
|
+
not_found_in_database: Ongeldige email of wachtwoord.
|
15
|
+
timeout: Je sessie is verlopen, meld je opnieuw aan om door te gaan.
|
16
|
+
unauthenticated: Je dient je aan te melden of in te schrijven om door te gaan.
|
17
|
+
unconfirmed: Je dient eerst je account te bevestigen.
|
18
|
+
mailer:
|
19
|
+
confirmation_instructions:
|
20
|
+
subject: Bevestiging
|
21
|
+
reset_password_instructions:
|
22
|
+
subject: Wachtwoord resetten
|
23
|
+
unlock_instructions:
|
24
|
+
subject: Ontgrendelinstructies
|
25
|
+
omniauth_callbacks:
|
26
|
+
failure: We konden je niet aanmelden op je %{kind} omdat "%{reason}".
|
27
|
+
success: Je bent succesvol ingelogd op je %{kind} account.
|
28
|
+
passwords:
|
29
|
+
no_token: Deze pagina is alleen bereikbaar via een wachtwoord reset e-mail. Als je wel via een wachtwoord reset email komt, zorg er dan voor dat je de volledige URL gebruikt.
|
30
|
+
send_instructions: Je ontvangt via e-mail instructies hoe je je wachtwoord moet resetten.
|
31
|
+
send_paranoid_instructions: Als we je e-mail adres terugvinden in onze database, zal je binnen enkele ogenblikken via e-mail een link ontvangen om je paswoord te resetten.
|
32
|
+
updated: Je wachtwoord is gewijzigd. Je bent nu aangemeld.
|
33
|
+
updated_not_active: Je wachtwoord werd met succes gewijzigd.
|
34
|
+
registrations:
|
35
|
+
destroyed: Je account is verwijderd, wellicht tot ziens!
|
36
|
+
signed_up: Je bent inschreven.
|
37
|
+
signed_up_but_inactive: Je bent ingeschreven, maar we konden je niet inloggen omdat je account nog niet is geactiveerd.
|
38
|
+
signed_up_but_locked: Je bent ingeschreven, maar we konden je niet inloggen omdat je account is gelocked.
|
39
|
+
signed_up_but_unconfirmed: Een e-mail met een confirmatie link is naar je e-mail adres gestuurd. Open de link in je browser om je account te activeren.
|
40
|
+
update_needs_confirmation: Je account is geüpdatet, maar we moeten je e-mail adres nog valideren. Een e-mail met een confirmatie link is naar je e-mail adres gestuurd. Open de link in je browser om je e-mail adres te confirmeren.
|
41
|
+
updated: Je account gegevens zijn opgeslagen.
|
42
|
+
sessions:
|
43
|
+
signed_in: Je bent succesvol ingelogd.
|
44
|
+
signed_out: Je bent succesvol uitgelogd.
|
45
|
+
unlocks:
|
46
|
+
send_instructions: Je ontvangt via e-mail instructies hoe je je account kan unlocken.
|
47
|
+
send_paranoid_instructions: Als we je e-mail adres terugvinden in onze database, zal je binnen enkele ogenblikken via e-mail, de instructies ontvangen hoe je je account kan unlocken.
|
48
|
+
unlocked: Je account is ge-unlocked. Je kan nu weer inloggen.
|
49
|
+
errors:
|
50
|
+
messages:
|
51
|
+
already_confirmed: is reeds bevestigd
|
52
|
+
confirmation_period_expired: moet binnen %{period} worden bevestigd, a.u.b. plaats een nieuw verzoek
|
53
|
+
expired: is verlopen, vraag een nieuwe aan
|
54
|
+
not_found: niet gevonden
|
55
|
+
not_locked: is niet gesloten
|
56
|
+
not_saved:
|
57
|
+
one: '1 error verhinderde het opslaan van deze %{resource}:'
|
58
|
+
other: '%{count} errors verhinderde het opslaan van deze %{resource}:'
|
data/config/routes.rb
CHANGED
@@ -17,7 +17,7 @@ Alchemy::Engine.routes.draw do
|
|
17
17
|
get '/admin/passwords' => 'passwords#new', :as => :new_password
|
18
18
|
get '/admin/passwords/:id/edit/:reset_password_token' => 'passwords#edit', :as => :edit_password
|
19
19
|
post '/admin/passwords' => 'passwords#create', :as => :reset_password
|
20
|
-
|
20
|
+
patch '/admin/passwords' => 'passwords#update', :as => :update_password
|
21
21
|
end
|
22
22
|
|
23
23
|
namespace :admin do
|
@@ -4,12 +4,12 @@ class AddAlchemyRolesToAlchemyUsers < ActiveRecord::Migration
|
|
4
4
|
if column_exists?(:alchemy_users, :roles)
|
5
5
|
remove_index :alchemy_users, name: "index_alchemy_users_on_roles"
|
6
6
|
rename_column :alchemy_users, :roles, :alchemy_roles
|
7
|
-
change_column :alchemy_users, :alchemy_roles, :string, default: "
|
7
|
+
change_column :alchemy_users, :alchemy_roles, :string, default: "member"
|
8
8
|
end
|
9
9
|
|
10
10
|
# Creating :alchemy_roles column for new apps.
|
11
11
|
unless column_exists?(:alchemy_users, :alchemy_roles)
|
12
|
-
add_column :alchemy_users, :alchemy_roles, :string, default: "
|
12
|
+
add_column :alchemy_users, :alchemy_roles, :string, default: "member"
|
13
13
|
end
|
14
14
|
|
15
15
|
unless index_exists?(:alchemy_users, :alchemy_roles, name: "index_alchemy_users_on_alchemy_roles")
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Alchemy
|
2
|
+
module Devise
|
3
|
+
class Ability
|
4
|
+
include CanCan::Ability
|
5
|
+
|
6
|
+
def initialize(user)
|
7
|
+
return if user.nil?
|
8
|
+
if user.has_role?(:member) || user.has_role?(:author) || user.has_role?(:editor)
|
9
|
+
can [:read, :update], Alchemy.user_class, id: user.id
|
10
|
+
end
|
11
|
+
if user.has_role?(:editor) || user.has_role?(:admin)
|
12
|
+
can :index, [:alchemy_admin_users]
|
13
|
+
can :read, Alchemy.user_class
|
14
|
+
end
|
15
|
+
if user.has_role?(:admin)
|
16
|
+
can :manage, Alchemy.user_class
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
@@ -7,11 +7,6 @@ module Alchemy
|
|
7
7
|
isolate_namespace Alchemy
|
8
8
|
engine_name 'alchemy_devise'
|
9
9
|
|
10
|
-
initializer "alchemy_devise.add_authorization_rules" do
|
11
|
-
rules = File.join(File.dirname(__FILE__), '../../..', 'config/authorization_rules.rb')
|
12
|
-
Alchemy::Auth::Engine.get_instance.load(rules)
|
13
|
-
end
|
14
|
-
|
15
10
|
config.to_prepare do
|
16
11
|
require_relative '../../../app/controllers/alchemy/base_controller_extension.rb'
|
17
12
|
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
|
+
version: 2.0.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: 2014-
|
11
|
+
date: 2014-07-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: alchemy_cms
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 3.0.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 3.0.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: devise
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -42,16 +42,16 @@ dependencies:
|
|
42
42
|
name: rspec-rails
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- -
|
45
|
+
- - '='
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '2.
|
47
|
+
version: '2.99'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- -
|
52
|
+
- - '='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '2.
|
54
|
+
version: '2.99'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: capybara
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
@@ -98,33 +98,38 @@ files:
|
|
98
98
|
- app/controllers/alchemy/users_controller.rb
|
99
99
|
- app/mailers/alchemy/notifications.rb
|
100
100
|
- app/models/alchemy/user.rb
|
101
|
-
- app/views/alchemy/admin/users/
|
101
|
+
- app/views/alchemy/admin/users/_fields.html.erb
|
102
102
|
- app/views/alchemy/admin/users/_user.html.erb
|
103
103
|
- app/views/alchemy/admin/users/edit.html.erb
|
104
104
|
- app/views/alchemy/admin/users/index.html.erb
|
105
105
|
- app/views/alchemy/admin/users/new.html.erb
|
106
106
|
- app/views/alchemy/notifications/alchemy_user_created.de.text.erb
|
107
107
|
- app/views/alchemy/notifications/alchemy_user_created.en.text.erb
|
108
|
-
- app/views/alchemy/notifications/
|
109
|
-
- app/views/alchemy/notifications/
|
108
|
+
- app/views/alchemy/notifications/member_created.de.text.erb
|
109
|
+
- app/views/alchemy/notifications/member_created.en.text.erb
|
110
110
|
- app/views/alchemy/notifications/reset_password_instructions.de.text.erb
|
111
111
|
- app/views/alchemy/notifications/reset_password_instructions.en.text.erb
|
112
112
|
- app/views/alchemy/passwords/edit.html.erb
|
113
113
|
- app/views/alchemy/passwords/new.html.erb
|
114
114
|
- app/views/alchemy/user_sessions/new.html.erb
|
115
115
|
- app/views/alchemy/users/new.html.erb
|
116
|
-
- config/authorization_rules.rb
|
117
116
|
- config/initializers/alchemy.rb
|
118
117
|
- config/initializers/devise.rb
|
119
118
|
- config/locales/alchemy.de.yml
|
120
119
|
- config/locales/alchemy.en.yml
|
120
|
+
- config/locales/alchemy.nl.yml
|
121
121
|
- config/locales/devise.de.yml
|
122
122
|
- config/locales/devise.en.yml
|
123
|
+
- config/locales/devise.nl.yml
|
124
|
+
- config/locales/simple_form.de.yml
|
125
|
+
- config/locales/simple_form.en.yml
|
126
|
+
- config/locales/simple_form.nl.yml
|
123
127
|
- config/routes.rb
|
124
128
|
- config/spring.rb
|
125
129
|
- db/migrate/20131015124700_create_alchemy_users.rb
|
126
130
|
- db/migrate/20131225232042_add_alchemy_roles_to_alchemy_users.rb
|
127
131
|
- lib/alchemy/devise.rb
|
132
|
+
- lib/alchemy/devise/ability.rb
|
128
133
|
- lib/alchemy/devise/engine.rb
|
129
134
|
- lib/alchemy/devise/version.rb
|
130
135
|
homepage: http://alchemy-cms.com
|
@@ -1,69 +0,0 @@
|
|
1
|
-
<table>
|
2
|
-
<tr>
|
3
|
-
<td class="label"><%= f.label 'gender' %></td>
|
4
|
-
<td class="select"><%= f.select 'gender', options_for_select(@user_genders, @user.gender), {:prompt => _t('Please choose')}, :class => 'alchemy_selectbox long', :autofocus => true -%></td>
|
5
|
-
</tr>
|
6
|
-
<tr>
|
7
|
-
<td class="label"><%= f.label 'firstname' %></td>
|
8
|
-
<td class="input"><%= f.text_field 'firstname', :class => 'thin_border long' %></td>
|
9
|
-
</tr>
|
10
|
-
<tr>
|
11
|
-
<td class="label"><%= f.label 'lastname' %></td>
|
12
|
-
<td class="input"><%= f.text_field 'lastname', :class => 'thin_border long' %></td>
|
13
|
-
</tr>
|
14
|
-
<tr>
|
15
|
-
<td class="label mandatory"><%= f.label 'login' %></td>
|
16
|
-
<td class="input"><%= f.text_field 'login', :class => 'thin_border long', :required => true, :autofocus => true %></td>
|
17
|
-
</tr>
|
18
|
-
<tr>
|
19
|
-
<td class="label mandatory"><%= f.label 'email' %></td>
|
20
|
-
<td class="input"><%= f.email_field 'email', :class => 'thin_border long', :required => true %></td>
|
21
|
-
</tr>
|
22
|
-
<tr>
|
23
|
-
<td class="label"><%= f.label 'language' %></td>
|
24
|
-
<td class="select"><%= f.select 'language', translations_for_select, {}, {:class => 'alchemy_selectbox long'} %></td>
|
25
|
-
</tr>
|
26
|
-
<tr>
|
27
|
-
<td class="label mandatory"><%= f.label 'password' %></td>
|
28
|
-
<td class="input mandatory"><%= f.password_field 'password', :class => 'thin_border long', :autocomplete => "off", :required => action_name == 'signup' %></td>
|
29
|
-
</tr>
|
30
|
-
<tr>
|
31
|
-
<td class="label mandatory"><%= f.label 'password_confirmation' %></td>
|
32
|
-
<td class="input"><%= f.password_field 'password_confirmation', :class => 'thin_border long', :autocomplete => "off", :required => action_name == 'signup' %></td>
|
33
|
-
</tr>
|
34
|
-
<% if @signup %>
|
35
|
-
<%= f.hidden_field :alchemy_roles %>
|
36
|
-
<% elsif permitted_to? :update_roles %>
|
37
|
-
<tr>
|
38
|
-
<td class="label"><%= f.label 'alchemy_roles' %></td>
|
39
|
-
<td id="user_roles">
|
40
|
-
<% Alchemy::User::ROLES.each do |role| %>
|
41
|
-
<label>
|
42
|
-
<%= check_box_tag 'user[alchemy_roles][]', role, @user.has_role?(role) %>
|
43
|
-
<%= Alchemy::User.human_rolename(role) %>
|
44
|
-
</label>
|
45
|
-
<% end %>
|
46
|
-
</td>
|
47
|
-
</tr>
|
48
|
-
<% end %>
|
49
|
-
<% unless @signup %>
|
50
|
-
<tr>
|
51
|
-
<td class="label"><%= f.label :tag_list %></td>
|
52
|
-
<td class="input">
|
53
|
-
<%= render 'alchemy/admin/partials/autocomplete_tag_list', :f => f, :object => @user %>
|
54
|
-
</td>
|
55
|
-
</tr>
|
56
|
-
<% end %>
|
57
|
-
<tr>
|
58
|
-
<td> </td>
|
59
|
-
<td class="checkbox long">
|
60
|
-
<%= f.check_box(:send_credentials, checked: @user.new_record?) %>
|
61
|
-
<%= f.label(:send_credentials) %>
|
62
|
-
</td>
|
63
|
-
</tr>
|
64
|
-
<tr>
|
65
|
-
<td class="submit" colspan="2">
|
66
|
-
<%= f.button _t(:save), :class => 'button' %>
|
67
|
-
</td>
|
68
|
-
</tr>
|
69
|
-
</table>
|
@@ -1,30 +0,0 @@
|
|
1
|
-
authorization do
|
2
|
-
role :registered do
|
3
|
-
has_permission_on :alchemy_admin_users, :to => [:edit, :update] do
|
4
|
-
if_attribute :id => is {user.id}
|
5
|
-
end
|
6
|
-
end
|
7
|
-
|
8
|
-
role :author do
|
9
|
-
includes :registered
|
10
|
-
has_permission_on :alchemy_admin_users, :to => [:index]
|
11
|
-
end
|
12
|
-
|
13
|
-
role :editor do
|
14
|
-
includes :author
|
15
|
-
end
|
16
|
-
|
17
|
-
role :admin do
|
18
|
-
includes :editor
|
19
|
-
has_permission_on :alchemy_admin_users, :to => [:manage, :update_roles]
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
privileges do
|
24
|
-
# default privilege hierarchies to facilitate RESTful Rails apps
|
25
|
-
privilege :manage, :includes => [:create, :read, :update, :delete]
|
26
|
-
privilege :read, :includes => [:index, :show]
|
27
|
-
privilege :create, :includes => :new
|
28
|
-
privilege :update, :includes => :edit
|
29
|
-
privilege :delete, :includes => :destroy
|
30
|
-
end
|