ditty 0.8.0 → 0.9.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +2 -0
- data/.pryrc +2 -0
- data/.rubocop.yml +1 -1
- data/.travis.yml +5 -4
- data/CNAME +1 -0
- data/Dockerfile +18 -0
- data/Gemfile.ci +0 -2
- data/Rakefile +2 -2
- data/_config.yml +1 -0
- data/config.ru +4 -4
- data/ditty.gemspec +9 -3
- data/docs/CNAME +1 -0
- data/docs/_config.yml +1 -0
- data/docs/index.md +34 -0
- data/exe/ditty +2 -0
- data/lib/ditty.rb +4 -2
- data/lib/ditty/cli.rb +28 -4
- data/lib/ditty/components/{app.rb → ditty.rb} +19 -14
- data/lib/ditty/controllers/{application.rb → application_controller.rb} +58 -29
- data/lib/ditty/controllers/{audit_logs.rb → audit_logs_controller.rb} +2 -2
- data/lib/ditty/controllers/{auth.rb → auth_controller.rb} +17 -16
- data/lib/ditty/controllers/{component.rb → component_controller.rb} +19 -18
- data/lib/ditty/controllers/{main.rb → main_controller.rb} +6 -2
- data/lib/ditty/controllers/roles_controller.rb +23 -0
- data/lib/ditty/controllers/{user_login_traits.rb → user_login_traits_controller.rb} +4 -3
- data/lib/ditty/controllers/{users.rb → users_controller.rb} +11 -10
- data/lib/ditty/db.rb +4 -3
- data/lib/ditty/emails/base.rb +5 -2
- data/lib/ditty/generators/crud_generator.rb +104 -0
- data/lib/ditty/generators/migration_generator.rb +26 -0
- data/lib/ditty/generators/project_generator.rb +51 -0
- data/lib/ditty/helpers/component.rb +2 -1
- data/lib/ditty/helpers/pundit.rb +20 -4
- data/lib/ditty/helpers/response.rb +20 -13
- data/lib/ditty/helpers/views.rb +7 -3
- data/lib/ditty/listener.rb +5 -3
- data/lib/ditty/memcached.rb +8 -0
- data/lib/ditty/middleware/accept_extension.rb +2 -2
- data/lib/ditty/middleware/error_catchall.rb +2 -2
- data/lib/ditty/models/base.rb +4 -0
- data/lib/ditty/models/role.rb +1 -0
- data/lib/ditty/models/user.rb +14 -1
- data/lib/ditty/policies/role_policy.rb +1 -1
- data/lib/ditty/policies/user_login_trait_policy.rb +1 -1
- data/lib/ditty/services/authentication.rb +11 -10
- data/lib/ditty/services/email.rb +8 -4
- data/lib/ditty/services/logger.rb +1 -1
- data/lib/ditty/tasks/ditty.rake +17 -0
- data/lib/ditty/tasks/omniauth-ldap.rake +2 -2
- data/lib/ditty/templates/.gitignore +5 -0
- data/lib/ditty/templates/.rspec +2 -0
- data/lib/ditty/templates/.rubocop.yml +7 -0
- data/lib/ditty/templates/Rakefile +12 -0
- data/lib/ditty/templates/application.rb +12 -0
- data/lib/ditty/templates/config.ru +37 -0
- data/lib/ditty/templates/controller.rb.erb +58 -0
- data/lib/ditty/templates/env.example +4 -0
- data/lib/ditty/templates/lib/project.rb.erb +5 -0
- data/lib/ditty/templates/migration.rb.erb +7 -0
- data/lib/ditty/templates/model.rb.erb +26 -0
- data/lib/ditty/templates/pids/.empty_directory +0 -0
- data/lib/ditty/templates/policy.rb.erb +48 -0
- data/lib/ditty/templates/public/css/sb-admin-2.min.css +10 -0
- data/lib/ditty/templates/public/js/sb-admin-2.min.js +7 -0
- data/lib/ditty/templates/settings.yml.erb +18 -0
- data/lib/ditty/templates/sidekiq.rb +18 -0
- data/lib/ditty/templates/sidekiq.yml +9 -0
- data/lib/ditty/templates/spec_helper.rb +43 -0
- data/lib/ditty/templates/type.rb.erb +21 -0
- data/lib/ditty/templates/views/display.haml.tt +20 -0
- data/lib/ditty/templates/views/edit.haml.tt +10 -0
- data/lib/ditty/templates/views/form.haml.tt +11 -0
- data/lib/ditty/templates/views/index.haml.tt +29 -0
- data/lib/ditty/templates/views/new.haml.tt +10 -0
- data/lib/ditty/version.rb +1 -1
- data/lib/rubocop/cop/ditty/call_services_directly.rb +2 -2
- data/migrate/20181209_add_user_login_traits.rb +4 -4
- data/migrate/20190220_add_parent_id_to_roles.rb +9 -0
- data/public/css/styles.css +13 -0
- data/public/js/scripts.js +1 -0
- data/views/404.haml +2 -4
- data/views/audit_logs/index.haml +32 -34
- data/views/auth/forgot_password.haml +27 -16
- data/views/auth/identity.haml +14 -13
- data/views/auth/ldap.haml +2 -2
- data/views/auth/login.haml +22 -17
- data/views/auth/register.haml +19 -18
- data/views/auth/register_identity.haml +27 -12
- data/views/auth/reset_password.haml +2 -2
- data/views/blank.haml +42 -0
- data/views/index.haml +1 -1
- data/views/layout.haml +37 -30
- data/views/partials/content_tag.haml +0 -0
- data/views/partials/delete_form.haml +1 -1
- data/views/partials/filter_control.haml +1 -1
- data/views/partials/footer.haml +5 -5
- data/views/partials/form_control.haml +19 -12
- data/views/partials/navitems.haml +44 -0
- data/views/partials/notifications.haml +12 -8
- data/views/partials/pager.haml +17 -17
- data/views/partials/search.haml +6 -7
- data/views/partials/sidebar.haml +15 -37
- data/views/partials/topbar.haml +68 -0
- data/views/roles/display.haml +27 -6
- data/views/roles/edit.haml +3 -3
- data/views/roles/form.haml +1 -0
- data/views/roles/index.haml +23 -16
- data/views/roles/new.haml +2 -2
- data/views/user_login_traits/display.haml +4 -4
- data/views/user_login_traits/edit.haml +3 -3
- data/views/user_login_traits/index.haml +4 -4
- data/views/user_login_traits/new.haml +2 -2
- data/views/users/display.haml +11 -12
- data/views/users/edit.haml +3 -3
- data/views/users/form.haml +0 -0
- data/views/users/index.haml +31 -24
- data/views/users/login_traits.haml +6 -8
- data/views/users/new.haml +2 -2
- data/views/users/profile.haml +13 -13
- metadata +143 -15
- data/lib/ditty/controllers/roles.rb +0 -13
- data/views/partials/navbar.haml +0 -22
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require '<%= folder %>/types/base_object'
|
4
|
+
|
5
|
+
module <%= namespace %>
|
6
|
+
module Types
|
7
|
+
class <%= model_name %>Type < BaseObject
|
8
|
+
description 'A <%= model_name %>.'
|
9
|
+
<%- if columns.include? :guid -%>
|
10
|
+
field :id, ID, 'The unique GUID', null: false, resolver_method: :guid
|
11
|
+
<%- end -%>
|
12
|
+
<%- many_to_ones.each do |rel| -%>
|
13
|
+
field :<%= rel[:table].to_s.singularize %>, '<%= namespace %>::Types::<%= rel[:table].to_s.classify %>Type', null: <%= schema[rel[:columns].first][:allow_null] %>
|
14
|
+
<%- end -%>
|
15
|
+
<%- schema.each do |name, info| -%>
|
16
|
+
<%- next if %i[id guid].include?(name) || (name.to_s =~ /_id/ && info[:type] == :integer) -%>
|
17
|
+
field :<%= name %>, <%= graphql_types[info[:type]] %>, null: <%= info[:allow_null] %>
|
18
|
+
<%- end -%>
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
.row
|
2
|
+
.col-md-2
|
3
|
+
.col-md-8
|
4
|
+
.card
|
5
|
+
.card-body
|
6
|
+
<%- columns.each do |col| -%>
|
7
|
+
%p.description
|
8
|
+
%label <%= col.to_s.titleize %>:
|
9
|
+
= entity.<%= col %>
|
10
|
+
<%- end %>
|
11
|
+
|
12
|
+
.row
|
13
|
+
.col-md-6
|
14
|
+
- if policy(entity).update?
|
15
|
+
%a.btn.btn-secondary{ href: "#{base_path}/#{entity.display_id}/edit" } Edit
|
16
|
+
.col-md-6.text-right
|
17
|
+
- if policy(entity).delete?
|
18
|
+
= delete_form_tag("#{base_path}/#{entity.display_id}") do
|
19
|
+
%button.btn.btn-warning{ type: 'submit' } Delete
|
20
|
+
.col-md-2
|
@@ -0,0 +1,10 @@
|
|
1
|
+
.row
|
2
|
+
.col-md-2
|
3
|
+
.col-md-8
|
4
|
+
.card
|
5
|
+
.card-body
|
6
|
+
= edit_form_tag "#{base_path}/#{entity.display_id}" do
|
7
|
+
= haml :'<%= model_name.pluralize.underscore %>/form', locals: { entity: entity }
|
8
|
+
%button.btn.btn-primary{ type: 'submit' }
|
9
|
+
Update <%= model_name %>
|
10
|
+
.col-md-2
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<%- if columns.include? :user_id -%>
|
2
|
+
= form_control(:user_id, entity, type: 'select', options: policy_scope(Ditty::User).order(:email).as_hash(:id, :email))
|
3
|
+
<%- end -%>
|
4
|
+
<%- many_to_ones.each do |rel| -%>
|
5
|
+
<%- next if %i[users].include?(rel[:tablename]) -%>
|
6
|
+
= form_control(:<%= rel[:columns].first %>, entity, type: 'select', options: policy_scope(<%= namespace %>::<%= rel[:table].to_s.classify %>).order(:<%= name_column(rel[:table]) %>).as_hash(:id, :<%= name_column(rel[:table]) %>))
|
7
|
+
<%- end -%>
|
8
|
+
<%- (columns - meta_columns).each do |col| -%>
|
9
|
+
<%- next if %i[id guid].include?(name) || (name.to_s =~ /_id/ && info[:type] == :integer) -%>
|
10
|
+
= form_control(:<%= col %>, entity, type: '<%= input_types[schema[col][:type]] %>')
|
11
|
+
<%- end -%>
|
@@ -0,0 +1,29 @@
|
|
1
|
+
.row
|
2
|
+
.col-md-12
|
3
|
+
= haml :'partials/search'
|
4
|
+
%table.table.table-striped.table-bordered.table-hover
|
5
|
+
%thead.thead-dark
|
6
|
+
%tr
|
7
|
+
<%- columns.each do |col| -%>
|
8
|
+
%th <%= col.to_s.titleize %>
|
9
|
+
<%- end %>
|
10
|
+
%th
|
11
|
+
%tbody
|
12
|
+
- if list.count > 0
|
13
|
+
- list.all.each do |entity|
|
14
|
+
%tr
|
15
|
+
<%- columns.each do |col| -%>
|
16
|
+
%td= entity.<%= col %>
|
17
|
+
<%- end %>
|
18
|
+
%td
|
19
|
+
%a{ href: "#{base_path}/#{entity.display_id}", title: 'Show' }
|
20
|
+
%i.fa.fa-search
|
21
|
+
- if policy(entity).update?
|
22
|
+
%a{ href: "#{base_path}/#{entity.display_id}/edit", title: 'Edit' }
|
23
|
+
%i.fa.fa-edit
|
24
|
+
- else
|
25
|
+
%tr
|
26
|
+
%td.text-center{ colspan: <%= columns.count + 1 %> } No <%= model_name.pluralize %>
|
27
|
+
|
28
|
+
- if list.count > 0
|
29
|
+
=pagination(list, base_path)
|
data/lib/ditty/version.rb
CHANGED
@@ -13,10 +13,10 @@ module RuboCop
|
|
13
13
|
#
|
14
14
|
# @example
|
15
15
|
# # bad
|
16
|
-
# Ditty::Services::Logger.instance.info 'This is a log message'
|
16
|
+
# ::Ditty::Services::Logger.instance.info 'This is a log message'
|
17
17
|
#
|
18
18
|
# # good
|
19
|
-
# Ditty::Services::Logger.info 'This is a log message'
|
19
|
+
# ::Ditty::Services::Logger.info 'This is a log message'
|
20
20
|
class CallServicesDirectly < RuboCop::Cop::Cop
|
21
21
|
MSG = 'Do not use `.instance` on services. Call the method directly instead'
|
22
22
|
|
@@ -5,10 +5,10 @@ Sequel.migration do
|
|
5
5
|
create_table :user_login_traits do
|
6
6
|
primary_key :id
|
7
7
|
foreign_key :user_id, :users
|
8
|
-
String :ip_address,
|
9
|
-
String :platform,
|
10
|
-
String :device,
|
11
|
-
String :browser,
|
8
|
+
String :ip_address, null: true
|
9
|
+
String :platform, null: true
|
10
|
+
String :device, null: true
|
11
|
+
String :browser, null: true
|
12
12
|
DateTime :created_at
|
13
13
|
DateTime :updated_at
|
14
14
|
end
|
@@ -0,0 +1,13 @@
|
|
1
|
+
/* Add your application specific styles here */
|
2
|
+
|
3
|
+
.bg-login-image {
|
4
|
+
background-image: url('https://source.unsplash.com/4rDCa5hBlCs/600x800');
|
5
|
+
}
|
6
|
+
|
7
|
+
.bg-password-image {
|
8
|
+
background-image: url('https://source.unsplash.com/4rDCa5hBlCs/600x800');
|
9
|
+
}
|
10
|
+
|
11
|
+
.bg-register-image {
|
12
|
+
background-image: url('https://source.unsplash.com/4rDCa5hBlCs/600x800');
|
13
|
+
}
|
@@ -0,0 +1 @@
|
|
1
|
+
// Add your application specific scripts here
|
data/views/404.haml
CHANGED
@@ -1,7 +1,5 @@
|
|
1
|
-
%
|
2
|
-
|
3
|
-
%p.lead
|
1
|
+
%p.lead.text-center
|
4
2
|
We could not find the page you were looking for...
|
5
3
|
|
6
4
|
.text-center
|
7
|
-
%iframe{ width: 560, height: 315, src: 'https://www.youtube.com/embed/e3-5YC_oHjE', frameborder: 0, allowfullscreen: true }
|
5
|
+
%iframe{ width: 560, height: 315, src: 'https://www.youtube.com/embed/e3-5YC_oHjE', frameborder: 0, allowfullscreen: true }
|
data/views/audit_logs/index.haml
CHANGED
@@ -1,37 +1,35 @@
|
|
1
|
+
= haml :'partials/search'
|
1
2
|
.row
|
2
|
-
.col-
|
3
|
-
.
|
4
|
-
.
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
%
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
%tbody
|
18
|
-
- if list.count > 0
|
19
|
-
- list.all.each do |entity|
|
20
|
-
%tr
|
21
|
-
%td
|
22
|
-
-if entity.user
|
23
|
-
%a{ href: "#{settings.map_path}/users/#{entity.user.id}" }= entity.user.email
|
24
|
-
-else
|
25
|
-
None
|
26
|
-
%td= entity.action
|
27
|
-
%td= entity.details
|
28
|
-
%td= entity.ip_address || 'Unknown'
|
29
|
-
%td= entity.browser || 'Unknown'
|
30
|
-
%td= entity.device || 'Unknown'
|
31
|
-
%td= entity.platform || 'Unknown'
|
32
|
-
%td= entity.created_at&.strftime('%Y-%m-%d %H:%M:%S') || 'Unknown'
|
33
|
-
- else
|
3
|
+
.col-12
|
4
|
+
%table.table.table-striped.table-bordered.table-hover
|
5
|
+
%thead.thead-dark
|
6
|
+
%tr
|
7
|
+
%th User email
|
8
|
+
%th Action
|
9
|
+
%th Details
|
10
|
+
%th IP Address
|
11
|
+
%th Browser
|
12
|
+
%th Device
|
13
|
+
%th Platform
|
14
|
+
%th Created at
|
15
|
+
%tbody
|
16
|
+
- if list.count > 0
|
17
|
+
- list.all.each do |entity|
|
34
18
|
%tr
|
35
|
-
%td
|
19
|
+
%td
|
20
|
+
-if entity.user
|
21
|
+
%a{ href: "#{settings.map_path}/users/#{entity.user.id}" }= entity.user.email
|
22
|
+
-else
|
23
|
+
None
|
24
|
+
%td= entity.action
|
25
|
+
%td= entity.details
|
26
|
+
%td= entity.ip_address || 'Unknown'
|
27
|
+
%td= entity.browser || 'Unknown'
|
28
|
+
%td= entity.device || 'Unknown'
|
29
|
+
%td= entity.platform || 'Unknown'
|
30
|
+
%td= entity.created_at&.strftime('%Y-%m-%d %H:%M:%S') || 'Unknown'
|
31
|
+
- else
|
32
|
+
%tr
|
33
|
+
%td.text-center{ colspan: 4 } No records
|
36
34
|
|
37
|
-
=pagination(list, base_path)
|
35
|
+
=pagination(list, base_path)
|
@@ -1,16 +1,27 @@
|
|
1
|
-
.
|
2
|
-
.
|
3
|
-
|
4
|
-
|
5
|
-
.
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
1
|
+
.container
|
2
|
+
.card.o-hidden.border-0.shadow-lg.my-5
|
3
|
+
.card-body.p-0
|
4
|
+
/ Nested Row within Card Body
|
5
|
+
.row
|
6
|
+
.col-lg-6.d-none.d-lg-block.bg-password-image
|
7
|
+
.col-lg-6
|
8
|
+
.p-5
|
9
|
+
.text-center
|
10
|
+
%h1.h4.text-gray-900.mb-2
|
11
|
+
Forgot Your Password?
|
12
|
+
%p.mb-4
|
13
|
+
We get it, stuff happens. Just enter your email address below and we'll send you a link to reset your password!
|
14
|
+
= form_tag("#{settings.map_path}/auth/forgot-password", attributes: { class: 'user' }) do
|
15
|
+
.form-group
|
16
|
+
%input.form-control.form-control-user{ type: 'email', placeholder: 'Enter Email Address...' }
|
17
|
+
%button.btn.btn-primary.btn-user.btn-block{ type: 'submit' }
|
18
|
+
Reset Password
|
19
|
+
%hr
|
20
|
+
- if policy(::Ditty::User).register?
|
21
|
+
.text-center
|
22
|
+
%a.small{ href: "#{settings.map_path}/auth/register" } Create an Account!
|
23
|
+
.text-center
|
24
|
+
%a.small{ href: "#{settings.map_path}/auth/login" } Already have an account? Login!
|
25
|
+
|
26
|
+
.row.justify-content-center
|
27
|
+
.col-xl-10.col-lg-12.col-md-9
|
data/views/auth/identity.haml
CHANGED
@@ -1,15 +1,16 @@
|
|
1
|
-
= form_tag("#{settings.map_path}/auth/identity/callback", attributes: { class: '' }) do
|
1
|
+
= form_tag("#{settings.map_path}/auth/identity/callback", attributes: { class: 'user' }) do
|
2
2
|
.form-group
|
3
|
-
%
|
4
|
-
%input.form-control.border-input{ name: 'username', tabindex: '1' }
|
3
|
+
%input.form-control.form-control-user{ name: 'username', type: 'email', 'aria-describedby': 'emailHelp', placeholder: 'Enter Email Address...' }
|
5
4
|
.form-group
|
6
|
-
%
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
%button.btn.btn-primary{ type: 'submit'
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
5
|
+
%input.form-control.form-control-user{ name: 'password', type: 'password', placeholder: 'Password' }
|
6
|
+
/ .form-group
|
7
|
+
/ .custom-control.custom-checkbox.small
|
8
|
+
/ <input type="checkbox" class="custom-control-input" id="customCheck">
|
9
|
+
/ <label class="custom-control-label" for="customCheck">Remember Me</label>
|
10
|
+
%button.btn.btn-primary.btn-user.btn-block{ type: 'submit' } Log In
|
11
|
+
%hr
|
12
|
+
.text-center
|
13
|
+
%a.small{ href: "#{settings.map_path}/auth/forgot-password" } Forgot Password?
|
14
|
+
- if policy(::Ditty::User).register?
|
15
|
+
.text-center
|
16
|
+
%a.small{ href: "#{settings.map_path}/auth/register" } Create an Account!
|
data/views/auth/ldap.haml
CHANGED
data/views/auth/login.haml
CHANGED
@@ -1,18 +1,23 @@
|
|
1
|
-
.
|
2
|
-
|
3
|
-
.
|
4
|
-
.
|
5
|
-
.
|
6
|
-
-
|
7
|
-
|
1
|
+
.container
|
2
|
+
/ Outer Row
|
3
|
+
.row.justify-content-center
|
4
|
+
.col-xl-10.col-lg-12.col-md-9
|
5
|
+
.card.o-hidden.border-0.shadow-lg.my-5
|
6
|
+
.card-body.p-0
|
7
|
+
/ Nested Row within Card Body
|
8
8
|
.row
|
9
|
-
.col-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
9
|
+
.col-lg-6.d-none.d-lg-block.bg-login-image
|
10
|
+
.col-lg-6
|
11
|
+
.p-5
|
12
|
+
.text-center
|
13
|
+
%h1.h4.text-gray-900.mb-4 Welcome Back!
|
14
|
+
- ::Ditty::Services::Authentication.providers.each do |name|
|
15
|
+
- provider = ::Ditty::Services::Authentication[name]
|
16
|
+
- next if provider[:login_prompt].nil?
|
17
|
+
%p
|
18
|
+
%a.btn.btn-block.btn-secondary{ href: "#{settings.map_path}/auth/#{name}" }
|
19
|
+
%i.fab.fw{ class: "fa-#{provider[:icon] || 'key'}"}
|
20
|
+
= provider[:login_prompt]
|
21
|
+
= haml :'partials/notifications'
|
22
|
+
- if ::Ditty::Services::Authentication.provides? 'identity'
|
23
|
+
= haml :'auth/identity'
|
data/views/auth/register.haml
CHANGED
@@ -1,19 +1,20 @@
|
|
1
|
-
|
2
|
-
.
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
- provider = Ditty::Services::Authentication[name]
|
1
|
+
.container
|
2
|
+
.card.o-hidden.border-0.shadow-lg.my-5
|
3
|
+
.card-body.p-0
|
4
|
+
/ Nested Row within Card Body
|
5
|
+
.row
|
6
|
+
.col-lg-5.d-none.d-lg-block.bg-register-image
|
7
|
+
.col-lg-7
|
8
|
+
.p-5
|
9
|
+
.text-center
|
10
|
+
%h1.h4.text-gray-900.mb-4 Create an Account!
|
11
|
+
= haml :'partials/notifications'
|
12
|
+
- ::Ditty::Services::Authentication.providers.each do |name|
|
13
|
+
- provider = ::Ditty::Services::Authentication[name]
|
15
14
|
- next if provider[:register_prompt].nil?
|
16
|
-
%
|
17
|
-
%
|
18
|
-
|
19
|
-
|
15
|
+
%p
|
16
|
+
%a.btn.btn-user.btn-block{ href: "#{settings.map_path}/auth/#{name}", class: "btn-#{provider[:icon] || 'key'}" }
|
17
|
+
%i.fab.fa-fw{ class: "fa-#{provider[:icon] || 'key'}"}
|
18
|
+
= provider[:register_prompt]
|
19
|
+
- if ::Ditty::Services::Authentication.provides? 'identity'
|
20
|
+
= haml :'auth/register_identity', locals: { identity: identity }
|
@@ -1,14 +1,29 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
- if identity.errors[:password] && identity.errors[:password].include?('is not strong enough')
|
2
|
+
.alert.alert-warning
|
3
|
+
%p Make sure your password is at least 8 characters long, and including the following
|
4
|
+
%ul
|
5
|
+
%li Upper- and lowercase letters
|
6
|
+
%li Numbers
|
7
|
+
%li Special Characters
|
5
8
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
9
|
+
= form_tag("#{settings.map_path}/auth/register/identity", attributes: { class: 'user' }) do
|
10
|
+
.form-group
|
11
|
+
%input.form-control.form-control-user{ name: 'identity[username]', type: 'email', placeholder: 'Email Address', class: identity.errors[:username] ? 'is-invalid' : 'is-valid' }
|
12
|
+
- if identity.errors[:username]
|
13
|
+
.invalid-feedback= identity.errors[:username].join(', ')
|
14
|
+
.form-group.row
|
15
|
+
.col-sm-6.mb-3.mb-sm-0
|
16
|
+
%input.form-control.form-control-user{ name: 'identity[password]', type: 'password', placeholder: 'Password', class: identity.errors[:password] ? 'is-invalid' : 'is-valid' }
|
17
|
+
- if identity.errors[:password]
|
18
|
+
.invalid-feedback= identity.errors[:password].join(', ')
|
19
|
+
.col-sm-6
|
20
|
+
%input.form-control.form-control-user{ name: 'identity[password_confirmation]', type: 'password', placeholder: 'Repeat Password', class: identity.errors[:password_confirmation] ? 'is-invalid' : 'is-valid' }
|
21
|
+
- if identity.errors[:password_confirmation]
|
22
|
+
.invalid-feedback= identity.errors[:password_confirmation].join(', ')
|
13
23
|
|
14
|
-
%button.btn.btn-primary{ type: 'submit' } Register
|
24
|
+
%button.btn.btn-primary.btn-user.btn-block{ type: 'submit' } Register
|
25
|
+
%hr
|
26
|
+
.text-center
|
27
|
+
%a.small{ href: "#{settings.map_path}/auth/forgot-password" } Forgot Password?
|
28
|
+
.text-center
|
29
|
+
%a.small{ href: "#{settings.map_path}/auth/login" } Already have an account? Login!
|