bootswatch_rails 3.1.1.9 → 3.1.1.10

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/lib/bootswatch_rails/version.rb +1 -1
  3. data/lib/generators/bootswatch_rails/install/install_generator.rb +1 -1
  4. data/lib/generators/bootswatch_rails/install/templates/app/views/layouts/application.html.erb +3 -3
  5. data/lib/generators/bootswatch_rails/install/templates/app/views/layouts/centered.html.erb +2 -2
  6. data/lib/generators/bootswatch_rails/install/templates/lib/templates/erb/scaffold/show.html.erb +1 -1
  7. data/lib/generators/bootswatch_rails/sorcery/sorcery_generator.rb +164 -0
  8. data/lib/generators/bootswatch_rails/sorcery/templates/_form.html.erb +19 -0
  9. data/lib/generators/bootswatch_rails/sorcery/templates/change.html.erb +13 -0
  10. data/lib/generators/bootswatch_rails/sorcery/templates/edit.html.erb +3 -0
  11. data/lib/generators/bootswatch_rails/sorcery/templates/index.html.erb +37 -0
  12. data/lib/generators/bootswatch_rails/sorcery/templates/initializer.rb +114 -0
  13. data/lib/generators/bootswatch_rails/sorcery/templates/log_in.html.erb +16 -0
  14. data/lib/generators/bootswatch_rails/sorcery/templates/new.html.erb +3 -0
  15. data/lib/generators/bootswatch_rails/sorcery/templates/password.html.erb +10 -0
  16. data/lib/generators/bootswatch_rails/sorcery/templates/reset_password_email.html.erb +8 -0
  17. data/lib/generators/bootswatch_rails/sorcery/templates/show.html.erb +58 -0
  18. data/lib/generators/bootswatch_rails/sorcery/templates/sorcery.de.yml +64 -0
  19. data/lib/generators/bootswatch_rails/sorcery/templates/user_mailer.rb +14 -0
  20. data/lib/generators/bootswatch_rails/sorcery/templates/user_migration.rb +60 -0
  21. data/lib/generators/bootswatch_rails/sorcery/templates/user_model.rb +13 -0
  22. data/lib/generators/bootswatch_rails/sorcery/templates/users_controller.rb +151 -0
  23. data/vendor/assets/stylesheets/amelia.css +11 -2
  24. data/vendor/assets/stylesheets/cosmo.css +6 -3
  25. data/vendor/assets/stylesheets/cyborg.css +6 -3
  26. data/vendor/assets/stylesheets/lumen.css +9 -0
  27. data/vendor/assets/stylesheets/slate.css +12 -0
  28. data/vendor/assets/stylesheets/superhero.css +9 -0
  29. metadata +19 -3
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7989183c9f2fb3c5b184ac9d940b442830f3fd74
4
- data.tar.gz: 793aff92aa704ba265311bf984fd4f7bac9bfc45
3
+ metadata.gz: 07d95e02e359636014ad1526bf7d9aefd0ec7793
4
+ data.tar.gz: 995facc0d2f1a13e3a75194ff4f1c4588ca0b205
5
5
  SHA512:
6
- metadata.gz: 4ea6cc933b50074ea9accaa20d48768693d499f576a3732807fce8bb617713360a099c1f59854f8b819ff66fc3535d12c85dd18686969ba1446698c6dd5e2140
7
- data.tar.gz: b756e1db9d89740df404e5af74f9e6061922188d54791e19296b4e6b6a870152457a77d501daa751a3a0bd0b54e549b08b0448a5a76d96959a34852c143ffcb1
6
+ metadata.gz: 438bb65b155e53dcc666949c3c014d6676ff260b36a74c264733ab2e6a34ca6ae0a8921459c6e59c7036b7e6d1e2bea4f7a4c98e6aaa7fb0210b634439f39783
7
+ data.tar.gz: e38e2cf9b143c50da825e8e958b14d375ec91aaa376d743f76d0036c853d2e59a1b528bffd594dea43606318b4cdd1c1774e0499383c241ca12d83a5114f1f23
@@ -1,5 +1,5 @@
1
1
  module BootswatchRails
2
- VERSION = "3.1.1.9"
2
+ VERSION = "3.1.1.10"
3
3
  THEMES = [:amelia, :cerulean, :cosmo, :custom, :cyborg, :darkly, :flatly, :journal, :lumen, :readable, :simplex, :slate, :spacelab, :superhero, :united, :yeti]
4
4
  DEFAULT = 1
5
5
  end
@@ -29,7 +29,7 @@ module BootswatchRails
29
29
  " helper_method :default_theme",
30
30
  "",
31
31
  " def current_theme",
32
- " @current_theme = current_user.theme if user_signed_in?",
32
+ " @current_theme = current_user.theme if current_user.present?",
33
33
  " @current_theme ||= default_theme",
34
34
  " end",
35
35
  " helper_method :current_theme",
@@ -4,10 +4,10 @@
4
4
 
5
5
  <body>
6
6
  <%= render 'layouts/topnav' %>
7
-
7
+
8
8
  <div class="container" id="main-content">
9
9
  <div class="row">
10
- <%- if user_signed_in? -%>
10
+ <%- if current_user.present? -%>
11
11
  <div class="col-md-9">
12
12
  <%= render 'layouts/flash' %>
13
13
  <%= yield %>
@@ -23,7 +23,7 @@
23
23
  <%- end -%>
24
24
  </div>
25
25
  </div>
26
-
26
+
27
27
  <%= render 'layouts/footer' %>
28
28
  </body>
29
29
  </html>
@@ -12,8 +12,8 @@
12
12
  <%= yield %>
13
13
  </div>
14
14
  </div>
15
-
16
- <%= render 'layouts/footer' %>
17
15
  </div>
16
+
17
+ <%= render 'layouts/footer' %>
18
18
  </body>
19
19
  </html>
@@ -10,7 +10,7 @@
10
10
  <td>
11
11
  <%- if attribute.name.include?("picture") -%>
12
12
  <p>
13
- <%%= link_to "Anzeigen in Originalgröße", '#' %>
13
+ <%%= link_to "TODO: Anzeigen in Originalgröße", '#' %>
14
14
  </p>
15
15
  <%%= image_tag(@<%= singular_table_name %>.<%= attribute.name %>_url(:display)) %>
16
16
  <%- elsif attribute.type == :boolean -%>
@@ -0,0 +1,164 @@
1
+ require 'rails/generators/active_record'
2
+
3
+ module BootswatchRails
4
+ USER_STATUS = %w(guest member admin sysadm)
5
+
6
+ module Generators
7
+ class SorceryGenerator < ActiveRecord::Generators::Base
8
+ desc "Install model, views and controller for Sorcery."
9
+ argument :name, type: :string, default: "user",
10
+ banner: "user model (default 'user')"
11
+ class_option :user_activation, type: :boolean, default: false,
12
+ desc: 'User activation by email with optional success email'
13
+ class_option :reset_password, type: :boolean, default: false,
14
+ desc: 'Reset password with email verification'
15
+ class_option :remember_me, type: :boolean, default: false,
16
+ desc: 'Remember me with configurable expiration'
17
+ class_option :session_timeout, type: :boolean, default: false,
18
+ desc: 'Configurable session timeout'
19
+ class_option :brute_force_protection, type: :boolean, default: false,
20
+ desc: 'Brute force login hammering protection'
21
+ class_option :http_basic_auth, type: :boolean, default: false,
22
+ desc: 'A before filter for requesting authentication with HTTP Basic'
23
+ class_option :activity_logging, type: :boolean, default: false,
24
+ desc: 'Automatic logging of last login, logout and activity'
25
+ class_option :external, type: :boolean, default: false,
26
+ desc: 'OAuth1 and OAuth2 support (Twitter, Facebook, etc.)'
27
+ class_option :layout, type: :string, default: 'centered',
28
+ desc: 'Layout to be used for rendering login.html.erb'
29
+ source_root File.expand_path("../templates", __FILE__)
30
+
31
+ def add_migration
32
+ migration_template "user_migration.rb", "db/migrate/create_#{table_name}.rb"
33
+ end
34
+
35
+ def add_model
36
+ template "user_model.rb", "app/models/#{name}.rb"
37
+ end
38
+
39
+ def add_mailer
40
+ return unless reset_password?
41
+ template "user_mailer.rb", "app/mailers/#{name}_mailer.rb"
42
+ template "reset_password_email.html.erb", "app/views/#{name}_mailer/reset_password_email.html.erb"
43
+ end
44
+
45
+ def add_controller
46
+ template "users_controller.rb", "app/controllers/#{table_name}_controller.rb"
47
+ end
48
+
49
+ def add_views
50
+ views = %w[edit _form index log_in new show]
51
+ views += %w[password change] if reset_password?
52
+ views.each do |view|
53
+ template "#{view}.html.erb", "app/views/#{table_name}/#{view}.html.erb"
54
+ end
55
+ end
56
+
57
+ def add_routes
58
+ lines = [
59
+ "resources :#{table_name} do",
60
+ " collection do",
61
+ " get 'log_in'",
62
+ " post 'access'",
63
+ " get 'log_out'"
64
+ ]
65
+ lines << [
66
+ " get 'password'",
67
+ " post 'reset'"
68
+ ] if reset_password?
69
+ lines << [
70
+ " end"
71
+ ]
72
+ lines << [
73
+ " member do",
74
+ " get 'change'",
75
+ " patch 'refresh'",
76
+ " put 'refresh'",
77
+ " end"
78
+ ] if reset_password?
79
+ lines << [
80
+ " end",
81
+ ""
82
+ ]
83
+ route lines.join("\n")
84
+ end
85
+
86
+ def add_initializer
87
+ template "initializer.rb", "config/initializers/sorcery.rb"
88
+ end
89
+
90
+ def add_locales
91
+ %w[de].each do |locale|
92
+ template "sorcery.#{locale}.yml", "config/locales/sorcery.#{locale}.yml"
93
+ end
94
+ end
95
+
96
+ protected
97
+
98
+ def user_activation?
99
+ options.user_activation?
100
+ end
101
+
102
+ def reset_password?
103
+ options.reset_password?
104
+ end
105
+
106
+ def remember_me?
107
+ options.remember_me?
108
+ end
109
+
110
+ def session_timeout?
111
+ options.session_timeout?
112
+ end
113
+
114
+ def brute_force_protection?
115
+ options.brute_force_protection?
116
+ end
117
+
118
+ def http_basic_auth?
119
+ options.http_basic_auth?
120
+ end
121
+
122
+ def activity_logging?
123
+ options.activity_logging?
124
+ end
125
+
126
+ def external?
127
+ options.external?
128
+ end
129
+
130
+ def submodules
131
+ modules = []
132
+ modules << ":user_activation" if user_activation?
133
+ modules << ":reset_password" if reset_password?
134
+ modules << ":remember_me" if remember_me?
135
+ modules << ":session_timeout" if session_timeout?
136
+ modules << ":brute_force_protection" if brute_force_protection?
137
+ modules << ":http_basic_auth" if http_basic_auth?
138
+ modules << ":activity_logging" if activity_logging?
139
+ modules << ":external" if external?
140
+ modules.join(', ')
141
+ end
142
+
143
+ def layout
144
+ options.layout
145
+ end
146
+
147
+ def migration_name
148
+ "create_#{table_name}"
149
+ end
150
+
151
+ def mailer_name
152
+ "#{name}_mailer"
153
+ end
154
+
155
+ def controller_name
156
+ "#{table_name}_controller"
157
+ end
158
+
159
+ def whitelist
160
+ ":email, :name, :active, :status, :password, :password_confirmation, :theme"
161
+ end
162
+ end
163
+ end
164
+ end
@@ -0,0 +1,19 @@
1
+ <%%= simple_form_for(@<%= name %>) do |f| %>
2
+ <%%= f.error_notification %>
3
+
4
+ <%%= f.input :email %>
5
+ <%%= f.input :name %>
6
+ <%%= f.input :active %>
7
+ <%%= f.input :password %>
8
+ <%%= f.input :password_confirmation %>
9
+ <%%= f.input :status %>
10
+ <%%= f.input :theme %>
11
+
12
+ <%%= f.button :submit, class: 'btn btn-primary' %>
13
+ <%%- if @<%= name %>.new_record? -%>
14
+ <%%= link_to t('actions.back.index'), <%= table_name %>_path, class: 'btn btn-default' %>
15
+ <%%- else -%>
16
+ <%%= link_to t('actions.back.show'), @<%= name %>, class: 'btn btn-default' %>
17
+ <%%= link_to t('actions.back.index'), <%= table_name %>_path, class: 'btn btn-default' %>
18
+ <%%- end -%>
19
+ <%% end %>
@@ -0,0 +1,13 @@
1
+ <h2><%%= t('sorcery.reset.choose') %></h2>
2
+
3
+ <%%= simple_form_for(@<%= name %>, url: {action: "refresh"}) do |f| %>
4
+ <%%= f.error_notification %>
5
+
6
+ <%%= f.input :email, disabled: true, required: false %>
7
+ <%%= f.input :reset_password_token, as: :hidden %>
8
+ <%%= f.input :password, required: true %>
9
+ <%%= f.input :password_confirmation, required: true %>
10
+
11
+ <%%= f.button :submit, t('sorcery.reset.change'), class: 'btn btn-primary' %>
12
+ <%%= link_to t('sorcery.reset.back'), log_in_<%= table_name %>_path, class: 'btn btn-default' %>
13
+ <%% end %>
@@ -0,0 +1,3 @@
1
+ <h2><%%= t('headers.edit', name: t('activerecord.models.<%= name %>.one')) %></h2>
2
+
3
+ <%%= render 'form' %>
@@ -0,0 +1,37 @@
1
+ <h2><%%= t('headers.index', name: t('activerecord.models.<%= name %>.other')) %></h2>
2
+
3
+ <table class="table table-striped table-hover">
4
+ <thead>
5
+ <tr>
6
+ <th><%%= t('activerecord.attributes.<%= name %>.email') %></th>
7
+ <th><%%= t('activerecord.attributes.<%= name %>.name') %></th>
8
+ <th><%%= t('activerecord.attributes.<%= name %>.active') %></th>
9
+ <th><%%= t('activerecord.attributes.<%= name %>.status') %></th>
10
+ <th><%%= t('activerecord.attributes.<%= name %>.theme') %></th>
11
+ <th class="index-actions"><%%= t('actions.title') %></th>
12
+ </tr>
13
+ </thead>
14
+
15
+ <tbody>
16
+ <%% @<%= table_name %>.each do |<%= name %>| %>
17
+ <tr>
18
+ <td><%%= <%= name %>.email %></td>
19
+ <td><%%= <%= name %>.name %></td>
20
+ <td><%%= <%= name %>.active ? t('simple_form.yes') : t('simple_form.no') %></td>
21
+ <td><%%= t('enums.<%= name %>.status.' + <%= name %>.status) %></td>
22
+ <td><%%= <%= name %>.theme %></td>
23
+ <td class="index-actions">
24
+ <%%= link_to t('actions.show'), <%= name %>, class: 'btn btn-default btn-xs' %>
25
+ <br>
26
+ <%%= link_to t('actions.edit'), [:edit, <%= name %>], class: 'btn btn-default btn-xs' %>
27
+ <br>
28
+ <%%= link_to t('actions.destroy'), <%= name %>, method: :delete, data: { confirm: t('actions.confirm') }, class: 'btn btn-danger btn-xs' %>
29
+ </td>
30
+ </tr>
31
+ <%% end %>
32
+ </tbody>
33
+ </table>
34
+
35
+ <br>
36
+
37
+ <%%= link_to t('actions.add', name: t('activerecord.models.<%= name %>.one')), new_<%= name %>_path, class: 'btn btn-primary' %>
@@ -0,0 +1,114 @@
1
+ #
2
+ # This initializer was derived from the original Sorcery initializer
3
+ #
4
+
5
+ Rails.application.config.sorcery.submodules = [<%= submodules %>]
6
+
7
+ Rails.application.config.sorcery.configure do |config|
8
+ # -- core --
9
+ # config.not_authenticated_action = :not_authenticated
10
+ # config.save_return_to_url = true
11
+ # config.cookie_domain = nil
12
+ <%- if session_timeout? -%>
13
+
14
+ # -- session_timeout --
15
+ # config.session_timeout = 3600
16
+ # config.session_timeout_from_last_action = false
17
+ <%- end -%>
18
+ <%- if http_basic_auth? -%>
19
+
20
+ # -- http_basic_auth --
21
+ # config.controller_to_realm_map = { "application" => "Application" }
22
+ <%- end -%>
23
+ <%- if activity_logging? -%>
24
+
25
+ # -- activity_logging --
26
+ # config.register_login_time = true
27
+ # config.register_logout_time = true
28
+ # config.register_last_activity_time = true
29
+ <%- end -%>
30
+ <%- if external? -%>
31
+
32
+ # -- external --
33
+ # config.external_providers = []
34
+ # config.ca_file = 'path/to/ca_file'
35
+ <%- end -%>
36
+
37
+ # --- user config ---
38
+ config.user_config do |user|
39
+ # -- core --
40
+ # user.username_attribute_names = [:email]
41
+ # user.password_attribute_name = :password
42
+ # user.downcase_username_before_authenticating = false
43
+ # user.email_attribute_name = :email
44
+ # user.crypted_password_attribute_name = :crypted_password
45
+ # user.salt_join_token = ""
46
+ # user.salt_attribute_name = :salt
47
+ # user.stretches = nil
48
+ # user.encryption_key = nil
49
+ # user.custom_encryption_provider = nil
50
+ # user.encryption_algorithm = :bcrypt
51
+ # user.subclasses_inherit_config = false
52
+ <%- if user_activation? -%>
53
+
54
+ # -- user_activation --
55
+ # user.activation_state_attribute_name = :activation_state
56
+ # user.activation_token_attribute_name = :activation_token
57
+ # user.activation_token_expires_at_attribute_name = :activation_token_expires_at
58
+ # user.activation_token_expiration_period = nil
59
+ # user.user_activation_mailer = nil
60
+ # user.activation_mailer_disabled = false
61
+ # user.activation_needed_email_method_name = :activation_needed_email
62
+ # user.activation_success_email_method_name = :activation_success_email
63
+ # user.prevent_non_active_users_to_login = true
64
+ <%- end -%>
65
+ <%- if reset_password? -%>
66
+
67
+ # -- reset_password --
68
+ # user.reset_password_token_attribute_name = :reset_password_token
69
+ # user.reset_password_token_expires_at_attribute_name = :reset_password_token_expires_at
70
+ # user.reset_password_email_sent_at_attribute_name = :reset_password_email_sent_at
71
+ user.reset_password_mailer = <%= class_name %>Mailer
72
+ # user.reset_password_email_method_name = :reset_password_email
73
+ # user.reset_password_mailer_disabled = false
74
+ # user.reset_password_expiration_period = nil
75
+ # user.reset_password_time_between_emails = 300
76
+ <%- end -%>
77
+ <%- if remember_me? -%>
78
+
79
+ # -- remember_me --
80
+ # user.remember_me_httponly = true
81
+ # user.remember_me_for = 604800
82
+ <%- end -%>
83
+ <%- if brute_force_protection? -%>
84
+
85
+ # -- brute_force_protection --
86
+ # user.failed_logins_count_attribute_name = :failed_logins_count
87
+ # user.lock_expires_at_attribute_name = :lock_expires_at
88
+ # user.consecutive_login_retries_amount_limit = 50
89
+ # user.login_lock_time_period = 3600
90
+ # user.unlock_token_attribute_name = :unlock_token
91
+ # user.unlock_token_email_method_name = :send_unlock_token_email
92
+ # user.unlock_token_mailer_disabled = false
93
+ # user.unlock_token_mailer = nil
94
+ <%- end -%>
95
+ <%- if activity_logging? -%>
96
+
97
+ # -- activity_logging --
98
+ # user.last_login_at_attribute_name = :last_login_at
99
+ # user.last_logout_at_attribute_name = :last_logout_at
100
+ # user.last_activity_at_attribute_name = :last_activity_at
101
+ # user.activity_timeout = 600
102
+ <%- end -%>
103
+ <%- if external? -%>
104
+
105
+ # -- external --
106
+ # user.authentications_class = nil
107
+ # user.authentications_user_id_attribute_name = :user_id
108
+ # user.provider_attribute_name = :provider
109
+ # user.provider_uid_attribute_name = :uid
110
+ <%- end -%>
111
+ end
112
+
113
+ config.user_class = "<%= class_name %>"
114
+ end
@@ -0,0 +1,16 @@
1
+ <h2><%%= t('sorcery.header') %></h2>
2
+
3
+ <%%= simple_form_for(@<%= name %>, url: {action: "access"}) do |f| %>
4
+ <%%= f.error_notification %>
5
+
6
+ <%%= f.input :email %>
7
+ <%%= f.input :password %>
8
+ <%- if remember_me? -%>
9
+ <%%= f.input :remember_me %>
10
+ <%- end -%>
11
+
12
+ <%%= f.button :submit, t('sorcery.submit'), class: 'btn btn-primary' %>
13
+ <%- if reset_password? -%>
14
+ <%%= link_to t('sorcery.reset.forgot'), password_<%= table_name %>_path, class: 'btn btn-default' %>
15
+ <%- end -%>
16
+ <%% end %>
@@ -0,0 +1,3 @@
1
+ <h2><%%= t('headers.new', name: t('activerecord.models.<%= name %>.one')) %></h2>
2
+
3
+ <%%= render 'form' %>
@@ -0,0 +1,10 @@
1
+ <h2><%%= t('sorcery.reset.header') %></h2>
2
+
3
+ <%%= simple_form_for(@<%= name %>, url: {action: "reset"}) do |f| %>
4
+ <%%= f.error_notification %>
5
+
6
+ <%%= f.input :email %>
7
+
8
+ <%%= f.button :submit, t('sorcery.reset.send'), class: 'btn btn-primary' %>
9
+ <%%= link_to t('sorcery.reset.back'), log_in_<%= table_name %>_path, class: 'btn btn-default' %>
10
+ <%% end %>
@@ -0,0 +1,8 @@
1
+ Hello, <%%= @<%= name %>.email %>
2
+ ===============================================
3
+
4
+ You have requested to reset your password.
5
+
6
+ To choose a new password, just follow this link: <%%= @url %>.
7
+
8
+ Have a great day!
@@ -0,0 +1,58 @@
1
+ <h2><%%= t('headers.show', name: t('activerecord.models.<%= name %>.one')) %></h2>
2
+
3
+ <table class="table table-striped table-hover">
4
+ <tbody>
5
+ <tr>
6
+ <td><%%= t('activerecord.attributes.<%= name %>.email') %></td>
7
+ <td><%%= @<%= name %>.email %></td>
8
+ </tr>
9
+ <tr>
10
+ <td><%%= t('activerecord.attributes.<%= name %>.name') %></td>
11
+ <td><%%= @<%= name %>.name %></td>
12
+ </tr>
13
+ <tr>
14
+ <td><%%= t('activerecord.attributes.<%= name %>.active') %></td>
15
+ <td><%%= @<%= name %>.active ? t('simple_form.yes') : t('simple_form.no') %></td>
16
+ </tr>
17
+ <tr>
18
+ <td><%%= t('activerecord.attributes.<%= name %>.status') %></td>
19
+ <td><%%= t('enums.<%= name %>.status.' + @<%= name %>.status) %></td>
20
+ </tr>
21
+ <tr>
22
+ <td><%%= t('activerecord.attributes.<%= name %>.theme') %></td>
23
+ <td><%%= @<%= name %>.theme %></td>
24
+ </tr>
25
+ <%- if activity_logging? -%>
26
+ <tr>
27
+ <td><%%= t('activerecord.attributes.<%= name %>.last_login_at') %></td>
28
+ <td><%%= @<%= name %>.last_login_at %></td>
29
+ </tr>
30
+ <tr>
31
+ <td><%%= t('activerecord.attributes.<%= name %>.last_login_from_ip_address') %></td>
32
+ <td><%%= @<%= name %>.last_login_from_ip_address %></td>
33
+ </tr>
34
+ <tr>
35
+ <td><%%= t('activerecord.attributes.<%= name %>.last_logout_at') %></td>
36
+ <td><%%= @<%= name %>.last_logout_at %></td>
37
+ </tr>
38
+ <tr>
39
+ <td><%%= t('activerecord.attributes.<%= name %>.last_activity_at') %></td>
40
+ <td><%%= @<%= name %>.last_activity_at %></td>
41
+ </tr>
42
+ <%- end -%>
43
+ <%- if brute_force_protection? -%>
44
+ <tr>
45
+ <td><%%= t('activerecord.attributes.<%= name %>.failed_logins_count') %></td>
46
+ <td><%%= @<%= name %>.failed_logins_count %></td>
47
+ </tr>
48
+ <tr>
49
+ <td><%%= t('activerecord.attributes.<%= name %>.lock_expires_at') %></td>
50
+ <td><%%= @<%= name %>.lock_expires_at %></td>
51
+ </tr>
52
+ <%- end -%>
53
+ </tbody>
54
+ </table>
55
+
56
+ <%%= link_to t('actions.edit'), [:edit, @<%= name %>], class: 'btn btn-primary' %>
57
+ <%%= link_to t('actions.back.index'), <%= table_name %>_path, class: 'btn btn-default' %>
58
+ <%%= link_to t('actions.destroy'), @<%= name %>, method: :delete, data: { confirm: t('actions.confirm') }, class: 'btn btn-danger' %>
@@ -0,0 +1,64 @@
1
+ de:
2
+ sorcery:
3
+ log_in: "Login"
4
+ log_out: "Logout"
5
+ sign_up: "Benutzerkonto anlegen"
6
+ header: "Anmelden am System"
7
+ submit: "Login"
8
+ <%- if reset_password? -%>
9
+ reset:
10
+ forgot: "Kennwort vergessen?"
11
+ header: "Kennwort anfordern"
12
+ send: "Anleitung senden"
13
+ back: "Zurück zum Login"
14
+ delivered: "Eine Anleitung wurde an Ihre E-Mail Adresse gesendet."
15
+ missing: "Keine E-Mail Adresse angegeben."
16
+ choose: "Eingabe neues Kennwort"
17
+ change: "Kennwort ändern"
18
+ success: "Das Kennwort wurde aktualisiert."
19
+ failed: "Das Kennwort konnte nicht aktualisiert werden."
20
+ <%- end -%>
21
+ new_password: "Neues Kennwort"
22
+ failed: "E-Mail oder Kennwort ungültig"
23
+ success: "Willkommen und frohes Schaffen!"
24
+ goodbye: "Tschüss und bis bald."
25
+
26
+ <%= name %>_mailer:
27
+ reset_password_email:
28
+ subject: "Kennwort für #{name} zurücksetzen"
29
+
30
+ enums:
31
+ <%= name %>:
32
+ status:
33
+ guest: "Gast"
34
+ member: "Mitglied"
35
+ admin: "Admin"
36
+ sysadm: "System-Admin"
37
+
38
+ activerecord:
39
+ models:
40
+ <%= name %>:
41
+ one: "Benutzer"
42
+ other: "Benutzer"
43
+ attributes:
44
+ <%= name %>:
45
+ email: "E-Mail"
46
+ name: "Name"
47
+ active: "Aktiv"
48
+ status: "Status"
49
+ theme: "Oberfläche"
50
+ password: "Kennwort"
51
+ password_confirmation: "Kennwort wiederholen"
52
+ <%- if remember_me? -%>
53
+ remember_me: "Angemeldet bleiben"
54
+ <%- end -%>
55
+ <%- if activity_logging? -%>
56
+ last_login_at: "Letzte Anmeldung"
57
+ last_logout_at: "Letzte Abmeldung"
58
+ last_activity_at: "Letzte Aktivität"
59
+ last_login_from_ip_address: "Letzte IP-Adresse"
60
+ <%- end -%>
61
+ <%- if brute_force_protection? -%>
62
+ failed_logins_count: "Fehlversuche Anmeldung"
63
+ lock_expires_at: "Gesperrt bis"
64
+ <%- end -%>
@@ -0,0 +1,14 @@
1
+ class <%= mailer_name.camelize %> < ActionMailer::Base
2
+ default from: "from@example.com"
3
+
4
+ # Subject can be set in your I18n file at config/locales/en.yml
5
+ # with the following lookup:
6
+ #
7
+ # en.<%= name %>_mailer.reset_password_email.subject
8
+ #
9
+ def reset_password_email(<%= name %>)
10
+ @<%= name %> = <%= name %>
11
+ @url = change_<%= name %>_url(<%= name %>.reset_password_token)
12
+ mail to: <%= name %>.email
13
+ end
14
+ end
@@ -0,0 +1,60 @@
1
+ class <%= migration_name.camelize %> < ActiveRecord::Migration
2
+ def change
3
+ create_table :<%= table_name %> do |t|
4
+ t.string :email, null: false
5
+ t.string :name
6
+ t.boolean :active, default: true
7
+ t.integer :status, default: 0
8
+ t.integer :theme, default: BootswatchRails::DEFAULT
9
+
10
+ t.string :crypted_password, null: false
11
+ t.string :salt, null: false
12
+ <%- if user_activation? -%>
13
+ t.string :activation_state, default: nil
14
+ t.string :activation_token, default: nil
15
+ t.datetime :activation_token_expires_at, default: nil
16
+ <%- end -%>
17
+ <%- if reset_password? -%>
18
+ t.string :reset_password_token, default: nil
19
+ t.datetime :reset_password_token_expires_at, default: nil
20
+ t.datetime :reset_password_email_sent_at, default: nil
21
+ <%- end -%>
22
+ <%- if remember_me? -%>
23
+ t.boolean :remember_me
24
+ t.string :remember_me_token, default: nil
25
+ t.datetime :remember_me_token_expires_at, default: nil
26
+ <%- end -%>
27
+ <%- if brute_force_protection? -%>
28
+ t.integer :failed_logins_count, default: 0
29
+ t.datetime :lock_expires_at, default: nil
30
+ t.string :unlock_token, default: nil
31
+ <%- end -%>
32
+ <%- if activity_logging? -%>
33
+ t.datetime :last_login_at, default: nil
34
+ t.datetime :last_logout_at, default: nil
35
+ t.datetime :last_activity_at, default: nil
36
+ t.string :last_login_from_ip_address, default: nil
37
+ <%- end -%>
38
+
39
+ t.timestamps
40
+ end
41
+
42
+ add_index :<%= table_name %>, :email, unique: true
43
+ add_index :<%= table_name %>, :status
44
+ <%- if user_activation? -%>
45
+ add_index :<%= table_name %>, :activation_token
46
+ <%- end -%>
47
+ <%- if reset_password? -%>
48
+ add_index :<%= table_name %>, :reset_password_token
49
+ <%- end -%>
50
+ <%- if remember_me? -%>
51
+ add_index :<%= table_name %>, :remember_me_token
52
+ <%- end -%>
53
+ <%- if brute_force_protection? -%>
54
+ add_index :<%= table_name %>, :unlock_token
55
+ <%- end -%>
56
+ <%- if activity_logging? -%>
57
+ add_index :<%= table_name %>, [:last_logout_at, :last_activity_at]
58
+ <%- end -%>
59
+ end
60
+ end
@@ -0,0 +1,13 @@
1
+ class <%= class_name %> < ActiveRecord::Base
2
+ authenticates_with_sorcery!
3
+ validates :email, presence: true, uniqueness: true
4
+ validates :password, presence: true, on: :create
5
+ validates :password, length: { minimum: 6 }, unless: Proc.new { |a| a.password.blank? }
6
+ validates :password, confirmation: true
7
+ validates :password_confirmation, presence: true, on: :create
8
+
9
+ enum status: <%= BootswatchRails::USER_STATUS %>
10
+ validates :status, presence: true
11
+
12
+ enum theme: BootswatchRails::THEMES
13
+ end
@@ -0,0 +1,151 @@
1
+ class <%= controller_name.camelize %> < ApplicationController
2
+ before_action :set_<%= name %>, only: [:show, :edit, :update, :destroy]
3
+
4
+ # GET /<%= table_name %>
5
+ # GET /<%= table_name %>.json
6
+ def index
7
+ @<%= table_name %> = <%= class_name %>.order(:email)
8
+ end
9
+
10
+ # GET /<%= table_name %>/1
11
+ # GET /<%= table_name %>/1.json
12
+ def show
13
+ end
14
+
15
+ # GET /<%= table_name %>/new
16
+ def new
17
+ @<%= name %> = <%= class_name %>.new
18
+ end
19
+
20
+ # POST /<%= table_name %>
21
+ # POST /<%= table_name %>.json
22
+ def create
23
+ @<%= name %> = <%= class_name %>.new(<%= name %>_params)
24
+
25
+ respond_to do |format|
26
+ if @<%= name %>.save
27
+ format.html { redirect_to @<%= name %>, notice: t('results.created', name: t('activerecord.models.<%= name %>.one')) }
28
+ format.json { render :show, status: :created, location: @<%= name %> }
29
+ else
30
+ format.html { render :new }
31
+ format.json { render json: @<%= name %>.errors, status: :unprocessable_entity }
32
+ end
33
+ end
34
+ end
35
+
36
+ # GET /<%= table_name %>/1/edit
37
+ def edit
38
+ end
39
+
40
+ # PATCH/PUT /<%= table_name %>/1
41
+ # PATCH/PUT /<%= table_name %>/1.json
42
+ def update
43
+ respond_to do |format|
44
+ if @<%= name %>.update(<%= name %>_params)
45
+ format.html { redirect_to @<%= name %>, notice: t('results.updated', name: t('activerecord.models.<%= name %>.one')) }
46
+ format.json { render :show, status: :ok, location: @<%= name %> }
47
+ else
48
+ format.html { render :edit }
49
+ format.json { render json: @<%= name %>.errors, status: :unprocessable_entity }
50
+ end
51
+ end
52
+ end
53
+
54
+ # GET /<%= table_name %>/log_in
55
+ def log_in
56
+ @<%= name %> = <%= class_name %>.new
57
+ render layout: '<%= layout %>'
58
+ end
59
+
60
+ # POST /<%= table_name %>/access
61
+ def access
62
+ @<%= name %> = <%= class_name %>.find_by email: params[:<%= name %>][:email]
63
+ if @<%= name %>.present? and @<%= name %>.active
64
+ <%- if remember_me? -%>
65
+ @<%= name %> = login(params[:<%= name %>][:email], params[:<%= name %>][:password], params[:<%= name %>][:remember_me])
66
+ <%- else -%>
67
+ @<%= name %> = login(params[:<%= name %>][:email], params[:<%= name %>][:password])
68
+ <%- end -%>
69
+ else
70
+ @<%= name %> = nil
71
+ end
72
+ if @<%= name %>.present?
73
+ redirect_back_or_to root_path, notice: t('sorcery.success')
74
+ else
75
+ redirect_to log_in_users_path, alert: t('sorcery.failed')
76
+ end
77
+ end
78
+ <%- if reset_password? -%>
79
+
80
+ # GET /<%= table_name %>/password
81
+ def password
82
+ @<%= name %> = <%= class_name %>.new
83
+ render layout: '<%= layout %>'
84
+ end
85
+
86
+ # POST /<%= table_name %>/reset
87
+ def reset
88
+ if params[:<%= name %>][:email].present?
89
+ @<%= name %> = <%= class_name %>.find_by email: params[:<%= name %>][:email]
90
+ @<%= name %>.deliver_reset_password_instructions! if @<%= name %>
91
+ redirect_to log_in_<%= table_name %>_path, notice: t('sorcery.reset.delivered')
92
+ else
93
+ redirect_to log_in_<%= table_name %>_path, alert: t('sorcery.reset.missing')
94
+ end
95
+ end
96
+
97
+ # GET /<%= table_name %>/token/change
98
+ def change
99
+ @<%= name %> = <%= class_name %>.load_from_reset_password_token(params[:id])
100
+ @token = params[:id]
101
+ if @<%= name %>.blank?
102
+ not_authenticated
103
+ return
104
+ end
105
+ render layout: '<%= layout %>'
106
+ end
107
+
108
+ # PATCH/PUT /<%= table_name %>/token/refresh
109
+ def refresh
110
+ @token = params[:<%= name %>][:reset_password_token]
111
+ @<%= name %> = <%= class_name %>.load_from_reset_password_token(@token)
112
+ if @<%= name %>.blank?
113
+ not_authenticated
114
+ return
115
+ end
116
+ @<%= name %>.password_confirmation = params[:<%= name %>][:password_confirmation]
117
+ if @<%= name %>.change_password!(params[:<%= name %>][:password])
118
+ redirect_to root_path, notice: t('sorcery.reset.success')
119
+ else
120
+ redirect_to change_<%= name %>_path(@token), alert: t('sorcery.reset.failed')
121
+ end
122
+ end
123
+ <%- end -%>
124
+
125
+ # DELETE /<%= table_name %>/1
126
+ # DELETE /<%= table_name %>/1.json
127
+ def destroy
128
+ @<%= name %>.destroy
129
+ respond_to do |format|
130
+ format.html { redirect_to <%= table_name %>_url, notice: t('results.deleted', name: t('activerecord.models.<%= name %>.one')) }
131
+ format.json { head :no_content }
132
+ end
133
+ end
134
+
135
+ # GET /<%= table_name %>/log_out
136
+ def log_out
137
+ logout
138
+ redirect_to root_url, notice: t('login.goodbye')
139
+ end
140
+
141
+ private
142
+ # Use callbacks to share common setup or constraints between actions.
143
+ def set_<%= name %>
144
+ @<%= name %> = <%= class_name %>.find(params[:id])
145
+ end
146
+
147
+ # Never trust parameters from the scary internet, only allow the white list through.
148
+ def <%= name %>_params
149
+ params.require(:<%= name %>).permit(<%= whitelist %>)
150
+ end
151
+ end
@@ -5836,6 +5836,9 @@ legend {
5836
5836
  font-family: 'Lobster', cursive;
5837
5837
  color: #fff;
5838
5838
  }
5839
+ .input-group-addon {
5840
+ color: #444444;
5841
+ }
5839
5842
  .has-warning .help-block,
5840
5843
  .has-warning .control-label,
5841
5844
  .has-warning .form-control-feedback {
@@ -5845,6 +5848,9 @@ legend {
5845
5848
  .has-warning .form-control:focus {
5846
5849
  border-color: #ecd77f;
5847
5850
  }
5851
+ .has-warning .input-group-addon {
5852
+ border: none;
5853
+ }
5848
5854
  .has-error .help-block,
5849
5855
  .has-error .control-label,
5850
5856
  .has-error .form-control-feedback {
@@ -5854,6 +5860,9 @@ legend {
5854
5860
  .has-error .form-control:focus {
5855
5861
  border-color: #f0a6ac;
5856
5862
  }
5863
+ .has-error .input-group-addon {
5864
+ border: none;
5865
+ }
5857
5866
  .has-success .help-block,
5858
5867
  .has-success .control-label,
5859
5868
  .has-success .form-control-feedback {
@@ -5863,8 +5872,8 @@ legend {
5863
5872
  .has-success .form-control:focus {
5864
5873
  border-color: #93e08b;
5865
5874
  }
5866
- .input-group-addon {
5867
- color: #444444;
5875
+ .has-success .input-group-addon {
5876
+ border: none;
5868
5877
  }
5869
5878
  .pagination a:hover {
5870
5879
  color: #fff;
@@ -5838,7 +5838,8 @@ table .info a,
5838
5838
  color: #ff7518;
5839
5839
  }
5840
5840
  .has-warning .form-control,
5841
- .has-warning .form-control:focus {
5841
+ .has-warning .form-control:focus,
5842
+ .has-warning .input-group-addon {
5842
5843
  border: 1px solid #ff7518;
5843
5844
  }
5844
5845
  .has-error .help-block,
@@ -5847,7 +5848,8 @@ table .info a,
5847
5848
  color: #ff0039;
5848
5849
  }
5849
5850
  .has-error .form-control,
5850
- .has-error .form-control:focus {
5851
+ .has-error .form-control:focus,
5852
+ .has-error .input-group-addon {
5851
5853
  border: 1px solid #ff0039;
5852
5854
  }
5853
5855
  .has-success .help-block,
@@ -5856,7 +5858,8 @@ table .info a,
5856
5858
  color: #3fb618;
5857
5859
  }
5858
5860
  .has-success .form-control,
5859
- .has-success .form-control:focus {
5861
+ .has-success .form-control:focus,
5862
+ .has-success .input-group-addon {
5860
5863
  border: 1px solid #3fb618;
5861
5864
  }
5862
5865
  .nav-pills > li > a {
@@ -5825,7 +5825,8 @@ table .text-muted,
5825
5825
  color: #ff8800;
5826
5826
  }
5827
5827
  .has-warning .form-control,
5828
- .has-warning .form-control:focus {
5828
+ .has-warning .form-control:focus,
5829
+ .has-warning .input-group-addon {
5829
5830
  border-color: #ff8800;
5830
5831
  }
5831
5832
  .has-error .help-block,
@@ -5834,7 +5835,8 @@ table .text-muted,
5834
5835
  color: #cc0000;
5835
5836
  }
5836
5837
  .has-error .form-control,
5837
- .has-error .form-control:focus {
5838
+ .has-error .form-control:focus,
5839
+ .has-error .input-group-addon {
5838
5840
  border-color: #cc0000;
5839
5841
  }
5840
5842
  .has-success .help-block,
@@ -5843,7 +5845,8 @@ table .text-muted,
5843
5845
  color: #77b300;
5844
5846
  }
5845
5847
  .has-success .form-control,
5846
- .has-success .form-control:focus {
5848
+ .has-success .form-control:focus,
5849
+ .has-success .input-group-addon {
5847
5850
  border-color: #77b300;
5848
5851
  }
5849
5852
  legend {
@@ -5947,6 +5947,9 @@ label {
5947
5947
  -webkit-box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.075);
5948
5948
  box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.075);
5949
5949
  }
5950
+ .has-warning .input-group-addon {
5951
+ border: 1px solid #ff851b;
5952
+ }
5950
5953
  .has-error .help-block,
5951
5954
  .has-error .control-label,
5952
5955
  .has-error .form-control-feedback {
@@ -5958,6 +5961,9 @@ label {
5958
5961
  -webkit-box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.075);
5959
5962
  box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.075);
5960
5963
  }
5964
+ .has-error .input-group-addon {
5965
+ border: 1px solid #ff4136;
5966
+ }
5961
5967
  .has-success .help-block,
5962
5968
  .has-success .control-label,
5963
5969
  .has-success .form-control-feedback {
@@ -5969,6 +5975,9 @@ label {
5969
5975
  -webkit-box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.075);
5970
5976
  box-shadow: inset 0 2px 0 rgba(0, 0, 0, 0.075);
5971
5977
  }
5978
+ .has-success .input-group-addon {
5979
+ border: 1px solid #28b62c;
5980
+ }
5972
5981
  .nav .open > a,
5973
5982
  .nav .open > a:hover,
5974
5983
  .nav .open > a:focus {
@@ -5974,6 +5974,10 @@ textarea {
5974
5974
  .has-warning .form-control:focus {
5975
5975
  border-color: #f89406;
5976
5976
  }
5977
+ .has-warning .input-group-addon {
5978
+ background-color: #272b30;
5979
+ border: none;
5980
+ }
5977
5981
  .has-error .help-block,
5978
5982
  .has-error .control-label,
5979
5983
  .has-error .form-control-feedback {
@@ -5983,6 +5987,10 @@ textarea {
5983
5987
  .has-error .form-control:focus {
5984
5988
  border-color: #ee5f5b;
5985
5989
  }
5990
+ .has-error .input-group-addon {
5991
+ background-color: #272b30;
5992
+ border: none;
5993
+ }
5986
5994
  .has-success .help-block,
5987
5995
  .has-success .control-label,
5988
5996
  .has-success .form-control-feedback {
@@ -5992,6 +6000,10 @@ textarea {
5992
6000
  .has-success .form-control:focus {
5993
6001
  border-color: #62c462;
5994
6002
  }
6003
+ .has-success .input-group-addon {
6004
+ background-color: #272b30;
6005
+ border: none;
6006
+ }
5995
6007
  legend {
5996
6008
  color: #fff;
5997
6009
  }
@@ -5887,16 +5887,25 @@ label,
5887
5887
  .has-warning .form-control-feedback {
5888
5888
  color: #f0ad4e;
5889
5889
  }
5890
+ .has-warning .input-group-addon {
5891
+ border: none;
5892
+ }
5890
5893
  .has-error .help-block,
5891
5894
  .has-error .control-label,
5892
5895
  .has-error .form-control-feedback {
5893
5896
  color: #d9534f;
5894
5897
  }
5898
+ .has-error .input-group-addon {
5899
+ border: none;
5900
+ }
5895
5901
  .has-success .help-block,
5896
5902
  .has-success .control-label,
5897
5903
  .has-success .form-control-feedback {
5898
5904
  color: #5cb85c;
5899
5905
  }
5906
+ .has-success .input-group-addon {
5907
+ border: none;
5908
+ }
5900
5909
  .form-control:focus {
5901
5910
  -webkit-box-shadow: none;
5902
5911
  box-shadow: none;
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bootswatch_rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.1.1.9
4
+ version: 3.1.1.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Volker Wiegand
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-09 00:00:00.000000000 Z
11
+ date: 2014-06-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: railties
@@ -105,6 +105,22 @@ files:
105
105
  - lib/generators/bootswatch_rails/install/templates/lib/templates/erb/scaffold/index.html.erb
106
106
  - lib/generators/bootswatch_rails/install/templates/lib/templates/erb/scaffold/new.html.erb
107
107
  - lib/generators/bootswatch_rails/install/templates/lib/templates/erb/scaffold/show.html.erb
108
+ - lib/generators/bootswatch_rails/sorcery/sorcery_generator.rb
109
+ - lib/generators/bootswatch_rails/sorcery/templates/_form.html.erb
110
+ - lib/generators/bootswatch_rails/sorcery/templates/change.html.erb
111
+ - lib/generators/bootswatch_rails/sorcery/templates/edit.html.erb
112
+ - lib/generators/bootswatch_rails/sorcery/templates/index.html.erb
113
+ - lib/generators/bootswatch_rails/sorcery/templates/initializer.rb
114
+ - lib/generators/bootswatch_rails/sorcery/templates/log_in.html.erb
115
+ - lib/generators/bootswatch_rails/sorcery/templates/new.html.erb
116
+ - lib/generators/bootswatch_rails/sorcery/templates/password.html.erb
117
+ - lib/generators/bootswatch_rails/sorcery/templates/reset_password_email.html.erb
118
+ - lib/generators/bootswatch_rails/sorcery/templates/show.html.erb
119
+ - lib/generators/bootswatch_rails/sorcery/templates/sorcery.de.yml
120
+ - lib/generators/bootswatch_rails/sorcery/templates/user_mailer.rb
121
+ - lib/generators/bootswatch_rails/sorcery/templates/user_migration.rb
122
+ - lib/generators/bootswatch_rails/sorcery/templates/user_model.rb
123
+ - lib/generators/bootswatch_rails/sorcery/templates/users_controller.rb
108
124
  - vendor/assets/fonts/glyphicons-halflings-regular.eot
109
125
  - vendor/assets/fonts/glyphicons-halflings-regular.svg
110
126
  - vendor/assets/fonts/glyphicons-halflings-regular.ttf
@@ -145,7 +161,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
145
161
  version: '0'
146
162
  requirements: []
147
163
  rubyforge_project:
148
- rubygems_version: 2.2.2
164
+ rubygems_version: 2.3.0
149
165
  signing_key:
150
166
  specification_version: 4
151
167
  summary: Add bootswatch.com themes to the Rails asset pipeline