webamm_to_rails 7.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/README.md +3 -0
- data/lib/webamm_to_rails/features/definitions.rb +19 -0
- data/lib/webamm_to_rails/features/devise_onlineable/definition.rb +44 -0
- data/lib/webamm_to_rails/features/devise_onlineable/definitions/connection/presenter.rb +29 -0
- data/lib/webamm_to_rails/features/devise_onlineable/definitions/connection/template.erb +17 -0
- data/lib/webamm_to_rails/features/devise_onlineable/templates/app/channels/online_channel.rb.erb +13 -0
- data/lib/webamm_to_rails/features/devise_onlineable/templates/app/javascript/channels/consumer.js.erb +6 -0
- data/lib/webamm_to_rails/features/devise_onlineable/templates/app/javascript/channels/index.js.erb +5 -0
- data/lib/webamm_to_rails/features/devise_onlineable/templates/app/javascript/channels/online_channel.js.erb +48 -0
- data/lib/webamm_to_rails/features/devise_onlineable/templates/app/models/concerns/devise_onlineable.rb.erb +39 -0
- data/lib/webamm_to_rails/rails_boilerplate/builder.rb +318 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/Dockerfile.erb +83 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/Procfile.dev.erb +3 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/README.md.erb +24 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/Rakefile.erb +6 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/app/assets/config/manifest.js.erb +2 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/app/assets/stylesheets/application.tailwind.css.erb +3 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/app/channels/application_cable/channel.rb.erb +4 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/app/channels/application_cable/connection.rb.erb +4 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/app/helpers/application_helper.rb.erb +2 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/app/javascript/application.js.erb +3 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/app/javascript/controllers/application.js.erb +9 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/app/javascript/controllers/hello_controller.js.erb +7 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/app/javascript/controllers/index.js.erb +8 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/app/jobs/application_job.rb.erb +7 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/app/mailers/application_mailer.rb.erb +4 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/app/models/application_record.rb.erb +3 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/app/views/layouts/application.html.erb +44 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/app/views/layouts/mailer.html.erb +13 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/app/views/layouts/mailer.text.erb +1 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/app/views/pwa/manifest.json.erb +22 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/app/views/pwa/service-worker.js.erb +26 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/bin/brakeman.erb +7 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/bin/bundle.erb +109 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/bin/dev.erb +11 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/bin/docker-entrypoint.erb +13 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/bin/rails.erb +4 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/bin/rake.erb +4 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/bin/rubocop.erb +8 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/bin/setup.erb +40 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/config/application.rb.erb +42 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/config/boot.rb.erb +4 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/config/cable.yml.erb +11 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/config/credentials.yml.enc.erb +1 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/config/database.yml.erb +85 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/config/environment.rb.erb +5 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/config/environments/development.rb.erb +84 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/config/environments/production.rb.erb +102 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/config/environments/test.rb.erb +67 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/config/initializers/assets.rb.erb +12 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/config/initializers/content_security_policy.rb.erb +25 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/config/initializers/filter_parameter_logging.rb.erb +8 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/config/initializers/inflections.rb.erb +16 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/config/initializers/permissions_policy.rb.erb +13 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/config/locales/en.yml.erb +31 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/config/master.key.erb +1 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/config/puma.rb.erb +33 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/config/storage.yml.erb +34 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/config.ru.erb +6 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/db/seeds.rb.erb +9 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/dockerignore.erb +48 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/gitattributes.erb +9 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/github/dependabot.yml.erb +0 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/github/workflows/ci.yml.erb +38 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/gitignore.erb +40 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/node-version.erb +1 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/public/404.html.erb +67 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/public/406-unsupported-browser.html.erb +66 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/public/422.html.erb +67 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/public/500.html.erb +66 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/public/icon.png.erb +0 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/public/icon.svg.erb +3 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/public/robots.txt.erb +1 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/rubocop.yml.erb +8 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/ruby-version.erb +1 -0
- data/lib/webamm_to_rails/rails_boilerplate/templates/tailwind.config.js.erb +8 -0
- data/lib/webamm_to_rails/sources/controllers/actions/create_definition/presenter.rb +50 -0
- data/lib/webamm_to_rails/sources/controllers/actions/create_definition/template.erb +9 -0
- data/lib/webamm_to_rails/sources/controllers/actions/definition.rb +66 -0
- data/lib/webamm_to_rails/sources/controllers/actions/destroy_definition/presenter.rb +52 -0
- data/lib/webamm_to_rails/sources/controllers/actions/destroy_definition/template.erb +6 -0
- data/lib/webamm_to_rails/sources/controllers/actions/edit_definition/presenter.rb +40 -0
- data/lib/webamm_to_rails/sources/controllers/actions/edit_definition/template.erb +3 -0
- data/lib/webamm_to_rails/sources/controllers/actions/index_definition/presenter.rb +40 -0
- data/lib/webamm_to_rails/sources/controllers/actions/index_definition/template.erb +3 -0
- data/lib/webamm_to_rails/sources/controllers/actions/new_definition/presenter.rb +40 -0
- data/lib/webamm_to_rails/sources/controllers/actions/new_definition/template.erb +3 -0
- data/lib/webamm_to_rails/sources/controllers/actions/show_definition/presenter.rb +40 -0
- data/lib/webamm_to_rails/sources/controllers/actions/show_definition/template.erb +3 -0
- data/lib/webamm_to_rails/sources/controllers/actions/strong_parameters_definition/presenter.rb +50 -0
- data/lib/webamm_to_rails/sources/controllers/actions/strong_parameters_definition/template.erb +3 -0
- data/lib/webamm_to_rails/sources/controllers/actions/update_definition/presenter.rb +54 -0
- data/lib/webamm_to_rails/sources/controllers/actions/update_definition/template.erb +9 -0
- data/lib/webamm_to_rails/sources/controllers/application_controller/authentication/devise_groups/presenter.rb +49 -0
- data/lib/webamm_to_rails/sources/controllers/application_controller/authentication/devise_groups_definition/presenter.rb +30 -0
- data/lib/webamm_to_rails/sources/controllers/application_controller/definition.rb +36 -0
- data/lib/webamm_to_rails/sources/controllers/application_controller/template.erb +5 -0
- data/lib/webamm_to_rails/sources/controllers/class_definition/presenter.rb +17 -0
- data/lib/webamm_to_rails/sources/controllers/definition.rb +44 -0
- data/lib/webamm_to_rails/sources/controllers/filters/definition.rb +32 -0
- data/lib/webamm_to_rails/sources/controllers/filters/devise_definition/presenter.rb +55 -0
- data/lib/webamm_to_rails/sources/controllers/template.erb +17 -0
- data/lib/webamm_to_rails/sources/gemfile/default_set.rb +27 -0
- data/lib/webamm_to_rails/sources/gemfile/definition.rb +31 -0
- data/lib/webamm_to_rails/sources/gemfile/gem.rb +8 -0
- data/lib/webamm_to_rails/sources/gemfile/gem_definition/presenter.rb +22 -0
- data/lib/webamm_to_rails/sources/gemfile/project_set.rb +21 -0
- data/lib/webamm_to_rails/sources/gemfile/sets/authentication.rb +34 -0
- data/lib/webamm_to_rails/sources/gemfile/template.erb +17 -0
- data/lib/webamm_to_rails/sources/helpers/definitions.rb +21 -0
- data/lib/webamm_to_rails/sources/helpers/devise/presenter.rb +27 -0
- data/lib/webamm_to_rails/sources/helpers/devise/qr_code_helper/presenter.rb +19 -0
- data/lib/webamm_to_rails/sources/helpers/devise/qr_code_helper/template.erb +22 -0
- data/lib/webamm_to_rails/sources/initializers/definitions.rb +26 -0
- data/lib/webamm_to_rails/sources/initializers/devise_definition/presenter.rb +27 -0
- data/lib/webamm_to_rails/sources/initializers/devise_definition/template.erb +397 -0
- data/lib/webamm_to_rails/sources/migrations/active_storage_definition/presenter.rb +29 -0
- data/lib/webamm_to_rails/sources/migrations/active_storage_definition/template.erb +57 -0
- data/lib/webamm_to_rails/sources/migrations/associations.rb +49 -0
- data/lib/webamm_to_rails/sources/migrations/class_definition/presenter.rb +17 -0
- data/lib/webamm_to_rails/sources/migrations/column_definition/presenter.rb +38 -0
- data/lib/webamm_to_rails/sources/migrations/columns.rb +33 -0
- data/lib/webamm_to_rails/sources/migrations/definition.rb +52 -0
- data/lib/webamm_to_rails/sources/migrations/devise/definition.rb +278 -0
- data/lib/webamm_to_rails/sources/migrations/files_list.rb +98 -0
- data/lib/webamm_to_rails/sources/migrations/index_definition/presenter.rb +34 -0
- data/lib/webamm_to_rails/sources/migrations/indices.rb +33 -0
- data/lib/webamm_to_rails/sources/migrations/table_definition/presenter.rb +21 -0
- data/lib/webamm_to_rails/sources/migrations/template.erb +12 -0
- data/lib/webamm_to_rails/sources/migrations/uuid_definition/presenter.rb +29 -0
- data/lib/webamm_to_rails/sources/migrations/uuid_definition/template.erb +5 -0
- data/lib/webamm_to_rails/sources/models/association_definition/presenter.rb +49 -0
- data/lib/webamm_to_rails/sources/models/associations.rb +113 -0
- data/lib/webamm_to_rails/sources/models/attachment_definition/presenter.rb +21 -0
- data/lib/webamm_to_rails/sources/models/attachments.rb +25 -0
- data/lib/webamm_to_rails/sources/models/class_definition/presenter.rb +17 -0
- data/lib/webamm_to_rails/sources/models/concerns.rb +27 -0
- data/lib/webamm_to_rails/sources/models/definition.rb +57 -0
- data/lib/webamm_to_rails/sources/models/devise_definition/presenter.rb +49 -0
- data/lib/webamm_to_rails/sources/models/enum_definition/presenter.rb +19 -0
- data/lib/webamm_to_rails/sources/models/enums.rb +25 -0
- data/lib/webamm_to_rails/sources/models/template.erb +7 -0
- data/lib/webamm_to_rails/sources/package_json/definition.rb +27 -0
- data/lib/webamm_to_rails/sources/package_json/template.erb +21 -0
- data/lib/webamm_to_rails/sources/routes/authentication_definition/presenter.rb +21 -0
- data/lib/webamm_to_rails/sources/routes/definition.rb +38 -0
- data/lib/webamm_to_rails/sources/routes/resource_definition/presenter.rb +25 -0
- data/lib/webamm_to_rails/sources/routes/template.erb +14 -0
- data/lib/webamm_to_rails/sources/views/definition.rb +28 -0
- data/lib/webamm_to_rails/sources/views/devise/invitable/presenter.rb +31 -0
- data/lib/webamm_to_rails/sources/views/devise/invitable/templates/invitations/edit.html.erb +38 -0
- data/lib/webamm_to_rails/sources/views/devise/invitable/templates/invitations/new.html.erb +31 -0
- data/lib/webamm_to_rails/sources/views/devise/invitable/templates/mailer/invitation_instructions.html.erb +23 -0
- data/lib/webamm_to_rails/sources/views/devise/otp/presenter.rb +32 -0
- data/lib/webamm_to_rails/sources/views/devise/otp/templates/otp_credentials/refresh.html.erb +19 -0
- data/lib/webamm_to_rails/sources/views/devise/otp/templates/otp_credentials/show.html.erb +70 -0
- data/lib/webamm_to_rails/sources/views/devise/otp/templates/otp_tokens/_token_secret.html.erb +21 -0
- data/lib/webamm_to_rails/sources/views/devise/otp/templates/otp_tokens/_trusted_devices.html.erb +12 -0
- data/lib/webamm_to_rails/sources/views/devise/otp/templates/otp_tokens/edit.html.erb +48 -0
- data/lib/webamm_to_rails/sources/views/devise/otp/templates/otp_tokens/recovery.html.erb +21 -0
- data/lib/webamm_to_rails/sources/views/devise/otp/templates/otp_tokens/recovery_codes.html.erb +3 -0
- data/lib/webamm_to_rails/sources/views/devise/otp/templates/otp_tokens/show.html.erb +21 -0
- data/lib/webamm_to_rails/sources/views/devise/presenter.rb +37 -0
- data/lib/webamm_to_rails/sources/views/devise/standard/presenter.rb +39 -0
- data/lib/webamm_to_rails/sources/views/devise/standard/templates/confirmations/new.html.erb +31 -0
- data/lib/webamm_to_rails/sources/views/devise/standard/templates/mailer/confirmation_instructions.html.erb +17 -0
- data/lib/webamm_to_rails/sources/views/devise/standard/templates/mailer/email_changed.html.erb +7 -0
- data/lib/webamm_to_rails/sources/views/devise/standard/templates/mailer/password_change.html.erb +3 -0
- data/lib/webamm_to_rails/sources/views/devise/standard/templates/mailer/reset_password_instructions.html.erb +22 -0
- data/lib/webamm_to_rails/sources/views/devise/standard/templates/passwords/edit.html.erb +36 -0
- data/lib/webamm_to_rails/sources/views/devise/standard/templates/passwords/new.html.erb +31 -0
- data/lib/webamm_to_rails/sources/views/devise/standard/templates/registrations/edit.html.erb +43 -0
- data/lib/webamm_to_rails/sources/views/devise/standard/templates/registrations/new.html.erb +39 -0
- data/lib/webamm_to_rails/sources/views/devise/standard/templates/sessions/new.html.erb +23 -0
- data/lib/webamm_to_rails/sources/views/devise/standard/templates/shared/_links.html.erb +27 -0
- data/lib/webamm_to_rails/sources/views/resource/edit_definition/presenter.rb +41 -0
- data/lib/webamm_to_rails/sources/views/resource/edit_definition/template.erb +1 -0
- data/lib/webamm_to_rails/sources/views/resource/form_definition/presenter.rb +50 -0
- data/lib/webamm_to_rails/sources/views/resource/form_definition/template.erb +82 -0
- data/lib/webamm_to_rails/sources/views/resource/index_definition/presenter.rb +69 -0
- data/lib/webamm_to_rails/sources/views/resource/index_definition/template.erb +78 -0
- data/lib/webamm_to_rails/sources/views/resource/new_definition/presenter.rb +41 -0
- data/lib/webamm_to_rails/sources/views/resource/new_definition/template.erb +1 -0
- data/lib/webamm_to_rails/sources/views/resource/presenter.rb +41 -0
- data/lib/webamm_to_rails/sources/views/resource/show_definition/presenter.rb +61 -0
- data/lib/webamm_to_rails/sources/views/resource/show_definition/template.erb +34 -0
- data/lib/webamm_to_rails/utils/format_code.rb +11 -0
- data/lib/webamm_to_rails/utils/format_template.rb +11 -0
- data/lib/webamm_to_rails/version.rb +5 -0
- data/lib/webamm_to_rails.rb +112 -0
- data/webamm_to_rails.gemspec +28 -0
- metadata +332 -0
@@ -0,0 +1,70 @@
|
|
1
|
+
<div class="mt-7 max-w-screen-md mx-auto bg-white border border-gray-200 rounded-xl shadow-sm dark:bg-neutral-900 dark:border-neutral-700">
|
2
|
+
<div class="p-4 sm:p-7">
|
3
|
+
<div class="text-center">
|
4
|
+
<h1 class="block text-2xl font-bold text-gray-800 dark:text-white"><%= I18n.t('title', :scope => 'devise.otp.submit_token') %></h1>
|
5
|
+
<p class="mt-2 text-sm text-gray-600 dark:text-neutral-400">
|
6
|
+
<%= I18n.t('explain', :scope => 'devise.otp.submit_token') %>
|
7
|
+
</p>
|
8
|
+
</div>
|
9
|
+
|
10
|
+
<div class="mt-5">
|
11
|
+
|
12
|
+
|
13
|
+
<!-- Form -->
|
14
|
+
<%= form_for(resource, :as => resource_name, :url => [resource_name, :otp_credential], :html => { :method => :put, "data-turbo" => false }) do |f| %>
|
15
|
+
<%= hidden_field_tag :challenge, @challenge %>
|
16
|
+
<%= hidden_field_tag :recovery, @recovery %>
|
17
|
+
|
18
|
+
<div class="grid gap-y-4">
|
19
|
+
|
20
|
+
<!-- Form Group -->
|
21
|
+
<div>
|
22
|
+
<% if !@recovery && recovery_enabled? %>
|
23
|
+
<div class="flex justify-between items-center">
|
24
|
+
<label for="password" class="block text-sm mb-2 dark:text-white">2FA token</label>
|
25
|
+
<%= link_to I18n.t('recovery_link', :scope => 'devise.otp.submit_token'), otp_credential_path_for(resource_name, :challenge => @challenge, :recovery => true), class: 'inline-flex items-center gap-x-1 text-sm text-blue-600 decoration-2 hover:underline focus:outline-none focus:underline font-medium dark:text-blue-500' %>
|
26
|
+
</div>
|
27
|
+
<% else %>
|
28
|
+
<div class="flex justify-between items-center">
|
29
|
+
<label for="password" class="block text-sm mb-2 dark:text-white">2FA token</label>
|
30
|
+
</div>
|
31
|
+
<% end %>
|
32
|
+
|
33
|
+
<% if @recovery %>
|
34
|
+
<p>
|
35
|
+
<%= label_tag :token, I18n.t('recovery_prompt', :scope => 'devise.otp.submit_token') %><br />
|
36
|
+
<%= text_field_tag :otp_recovery_counter, resource.otp_recovery_counter, :autocomplete => :off, :disabled => true, :size => 4 %>
|
37
|
+
</p>
|
38
|
+
<% else %>
|
39
|
+
<p>
|
40
|
+
<%= label_tag :token, I18n.t('prompt', :scope => 'devise.otp.submit_token') %><br />
|
41
|
+
</p>
|
42
|
+
<% end %>
|
43
|
+
|
44
|
+
<div class="relative">
|
45
|
+
<%= text_field_tag :token, nil, :autocomplete => :off, :autofocus => true, :size => 6, class: 'py-3 px-4 block w-full border-gray-200 rounded-lg text-sm focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-900 dark:border-neutral-700 dark:text-neutral-400 dark:placeholder-neutral-500 dark:focus:ring-neutral-600' %>
|
46
|
+
</div>
|
47
|
+
|
48
|
+
|
49
|
+
|
50
|
+
</div>
|
51
|
+
<!-- End Form Group -->
|
52
|
+
|
53
|
+
<!-- Checkbox -->
|
54
|
+
<div class="flex items-center">
|
55
|
+
<div class="flex">
|
56
|
+
<%= check_box_tag :enable_persistence, true, false, class: 'shrink-0 mt-0.5 border-gray-200 rounded text-blue-600 focus:ring-blue-500 dark:bg-neutral-800 dark:border-neutral-700 dark:checked:bg-blue-500 dark:checked:border-blue-500 dark:focus:ring-offset-gray-800' %>
|
57
|
+
</div>
|
58
|
+
<div class="ms-3">
|
59
|
+
<label for="remember-me" class="text-sm dark:text-white">Remember me</label>
|
60
|
+
</div>
|
61
|
+
</div>
|
62
|
+
<!-- End Checkbox -->
|
63
|
+
|
64
|
+
<%= f.submit I18n.t('submit', :scope => 'devise.otp.submit_token'), class: 'w-full py-3 px-4 inline-flex justify-center items-center gap-x-2 text-sm font-medium rounded-lg border border-transparent bg-blue-600 text-white hover:bg-blue-700 focus:outline-none focus:bg-blue-700 disabled:opacity-50 disabled:pointer-events-none' %>
|
65
|
+
</div>
|
66
|
+
<% end %>
|
67
|
+
<!-- End Form -->
|
68
|
+
</div>
|
69
|
+
</div>
|
70
|
+
</div>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<h2 class="text-3xl dark:text-white mb-10 mt-10"><%= I18n.t('title', :scope => 'devise.otp.token_secret') %></h2>
|
2
|
+
<%= image_tag(qr_code_for_devise(resource), class: 'mx-auto') %>
|
3
|
+
|
4
|
+
<p>
|
5
|
+
<strong><%= I18n.t('manual_provisioning', :scope => 'devise.otp.token_secret') %>:</strong>
|
6
|
+
<code><%= resource.otp_auth_secret %></code>
|
7
|
+
</p>
|
8
|
+
|
9
|
+
<p><%= button_to I18n.t('reset_link', :scope => 'devise.otp.otp_tokens'), reset_otp_token_path_for(resource), :method => :post , :data => { "turbo-method": "POST" }, class: 'py-3 px-4 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 focus:outline-none focus:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-white dark:hover:bg-neutral-700 dark:focus:bg-neutral-700 mt-4 mb-4' %></p>
|
10
|
+
|
11
|
+
<p>
|
12
|
+
<%= I18n.t('reset_explain', :scope => 'devise.otp.otp_tokens') %>
|
13
|
+
<strong><%= I18n.t('reset_explain_warn', :scope => 'devise.otp.otp_tokens') %></strong>
|
14
|
+
</p>
|
15
|
+
|
16
|
+
<%- if recovery_enabled? %>
|
17
|
+
<h3><%= I18n.t('title', :scope => 'devise.otp.otp_tokens.recovery') %></h3>
|
18
|
+
<p><%= I18n.t('explain', :scope => 'devise.otp.otp_tokens.recovery') %></p>
|
19
|
+
<p><%= link_to I18n.t('codes_list', :scope => 'devise.otp.otp_tokens.recovery'), recovery_otp_token_for(resource_name), class: 'py-3 px-4 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 focus:outline-none focus:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-white dark:hover:bg-neutral-700 dark:focus:bg-neutral-700 mb-4 mt-4' %></p>
|
20
|
+
<p><%= link_to I18n.t('download_codes', :scope => 'devise.otp.otp_tokens.recovery'), recovery_otp_token_for(resource_name, format: :text), class: 'py-3 px-4 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 focus:outline-none focus:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-white dark:hover:bg-neutral-700 dark:focus:bg-neutral-700 mb-4 mt-4' %></p>
|
21
|
+
<% end %>
|
data/lib/webamm_to_rails/sources/views/devise/otp/templates/otp_tokens/_trusted_devices.html.erb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
<h2 class="text-3xl dark:text-white mb-10 mt-10"><%= I18n.t('title', :scope => 'devise.otp.trusted_browsers') %></h2>
|
2
|
+
<p><%= I18n.t('explain', :scope => 'devise.otp.trusted_browsers') %></p>
|
3
|
+
|
4
|
+
<%- if is_otp_trusted_browser_for? resource %>
|
5
|
+
<p><em><%= I18n.t('browser_trusted', :scope => 'devise.otp.trusted_browsers') %></em></p>
|
6
|
+
<p><%= link_to I18n.t('trust_remove', :scope => 'devise.otp.trusted_browsers'), persistence_otp_token_path_for(resource_name), :method => :post, :data => { "turbo-method": "POST" } %></p>
|
7
|
+
<% else %>
|
8
|
+
<p><%= I18n.t('browser_not_trusted', :scope => 'devise.otp.trusted_browsers') %></p>
|
9
|
+
<p><%= link_to I18n.t('trust_add', :scope => 'devise.otp.trusted_browsers'), persistence_otp_token_path_for(resource_name), class: 'py-3 px-4 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 focus:outline-none focus:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-white dark:hover:bg-neutral-700 dark:focus:bg-neutral-700 mb-4 mt-4' %></p>
|
10
|
+
<% end %>
|
11
|
+
|
12
|
+
<p><%= button_to I18n.t('trust_clear', :scope => 'devise.otp.trusted_browsers'), persistence_otp_token_path_for(resource_name), :method => :delete, :data => { "turbo-method": "DELETE" }, class: 'py-3 px-4 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 focus:outline-none focus:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-white dark:hover:bg-neutral-700 dark:focus:bg-neutral-700 mt-4' %></p>
|
@@ -0,0 +1,48 @@
|
|
1
|
+
<div class="max-w-screen-md mx-auto mt-7 bg-white border border-gray-200 rounded-xl shadow-sm dark:bg-neutral-900 dark:border-neutral-700">
|
2
|
+
<div class="p-4 sm:p-7">
|
3
|
+
<div class="text-center">
|
4
|
+
<h1 class="block text-2xl font-bold text-gray-800 dark:text-white"><%= I18n.t('title', :scope => 'devise.otp.edit_otp_token') %></h1>
|
5
|
+
<p class="mt-2 text-sm text-gray-600 dark:text-neutral-400">
|
6
|
+
<%= I18n.t('explain', :scope => 'devise.otp.edit_otp_token') %>
|
7
|
+
</p>
|
8
|
+
<p class="mt-2 text-sm text-gray-600 dark:text-neutral-400">
|
9
|
+
<%= I18n.t('step_1', :scope => 'devise.otp.edit_otp_token') %>
|
10
|
+
</p>
|
11
|
+
<%= image_tag(qr_code_for_devise(resource), class: 'mx-auto') %>
|
12
|
+
|
13
|
+
</div>
|
14
|
+
|
15
|
+
<div class="mt-5">
|
16
|
+
|
17
|
+
<div class="py-3 flex items-center text-xs text-gray-400 uppercase before:flex-1 before:border-t before:border-gray-200 before:me-6 after:flex-1 after:border-t after:border-gray-200 after:ms-6 dark:text-neutral-500 dark:before:border-neutral-600 dark:after:border-neutral-600">Or</div>
|
18
|
+
|
19
|
+
<div class="text-center">
|
20
|
+
<p class="mt-2 text-sm text-gray-600 dark:text-neutral-400">
|
21
|
+
<strong><%= I18n.t('manual_provisioning', :scope => 'devise.otp.token_secret') %>:</strong>
|
22
|
+
<code><%= resource.otp_auth_secret %></code>
|
23
|
+
</p>
|
24
|
+
<p class="mt-2 text-sm text-gray-600 dark:text-neutral-400">
|
25
|
+
<%= I18n.t('step_2', :scope => 'devise.otp.edit_otp_token') %>
|
26
|
+
</p>
|
27
|
+
</div>
|
28
|
+
|
29
|
+
<!-- Form -->
|
30
|
+
<%= form_with(:url => [resource_name, :otp_token], :method => :put) do |f| %>
|
31
|
+
<div class="grid gap-y-4">
|
32
|
+
<!-- Form Group -->
|
33
|
+
<div>
|
34
|
+
<%= f.label :confirmation_code, I18n.t('confirmation_code', :scope => 'devise.otp.edit_otp_token'), class: 'block text-sm mb-2 dark:text-white' %>
|
35
|
+
<div class="relative">
|
36
|
+
<%= f.text_field :confirmation_code, class: 'py-3 px-4 block w-full border-gray-200 rounded-lg text-sm focus:border-blue-500 focus:ring-blue-500 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-900 dark:border-neutral-700 dark:text-neutral-400 dark:placeholder-neutral-500 dark:focus:ring-neutral-600" required aria-describedby="email-error' %>
|
37
|
+
</div>
|
38
|
+
<p class="hidden text-xs text-red-600 mt-2" id="email-error">Please include a valid email address so we can get back to you</p>
|
39
|
+
</div>
|
40
|
+
<!-- End Form Group -->
|
41
|
+
|
42
|
+
<%= f.submit I18n.t('submit', :scope => 'devise.otp.edit_otp_token'), class: 'w-full py-3 px-4 inline-flex justify-center items-center gap-x-2 text-sm font-medium rounded-lg border border-transparent bg-blue-600 text-white hover:bg-blue-700 focus:outline-none focus:bg-blue-700 disabled:opacity-50 disabled:pointer-events-none' %>
|
43
|
+
</div>
|
44
|
+
<% end %>
|
45
|
+
<!-- End Form -->
|
46
|
+
</div>
|
47
|
+
</div>
|
48
|
+
</div>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<h2><%= I18n.t('title', :scope => 'devise.otp.otp_tokens.recovery') %></h2>
|
2
|
+
<p><%= I18n.t('explain', :scope => 'devise.otp.otp_tokens.recovery') %></p>
|
3
|
+
|
4
|
+
<table>
|
5
|
+
<caption>
|
6
|
+
<thead>
|
7
|
+
<tr>
|
8
|
+
<th><%= I18n.t('sequence', :scope => 'devise.otp.otp_tokens.recovery') %></th>
|
9
|
+
<th><%= I18n.t('code', :scope => 'devise.otp.otp_tokens.recovery') %></th>
|
10
|
+
</tr>
|
11
|
+
</thead>
|
12
|
+
<tbody>
|
13
|
+
<%- resource.next_otp_recovery_tokens.each do |seq, code| %>
|
14
|
+
<tr>
|
15
|
+
<td><%= seq %></td>
|
16
|
+
<td><%= code %></td>
|
17
|
+
</tr>
|
18
|
+
<% end %>
|
19
|
+
</tbody>
|
20
|
+
</caption>
|
21
|
+
</table>
|
@@ -0,0 +1,21 @@
|
|
1
|
+
<h1 class="text-4xl dark:text-white mb-4"><%= I18n.t('title', :scope => 'devise.otp.otp_tokens') %></h1>
|
2
|
+
|
3
|
+
<ul class="mt-3 flex flex-col">
|
4
|
+
<li class="inline-flex items-center gap-x-2 py-3 px-4 text-sm border text-gray-800 -mt-px first:rounded-t-lg first:mt-0 last:rounded-b-lg dark:border-neutral-700 dark:text-neutral-200">
|
5
|
+
<div class="flex items-center justify-between w-full">
|
6
|
+
<span><strong>Status:</strong></span>
|
7
|
+
<span><%= resource.otp_enabled? ? "Enabled" : "Disabled" %></span>
|
8
|
+
</div>
|
9
|
+
</li>
|
10
|
+
</ul>
|
11
|
+
|
12
|
+
<%- if resource.otp_enabled? %>
|
13
|
+
<%= render :partial => 'token_secret' if resource.otp_enabled? %>
|
14
|
+
<%= render :partial => 'trusted_devices' if trusted_devices_enabled? %>
|
15
|
+
|
16
|
+
<% unless otp_mandatory_on?(resource) %>
|
17
|
+
<%= button_to I18n.t('disable_link', :scope => 'devise.otp.otp_tokens'), @resource, :method => :delete, :data => { "turbo-method": "DELETE" }, class: 'py-3 px-4 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 focus:outline-none focus:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-white dark:hover:bg-neutral-700 dark:focus:bg-neutral-700 mt-4' %>
|
18
|
+
<% end %>
|
19
|
+
<% else %>
|
20
|
+
<%= link_to I18n.t('enable_link', :scope => 'devise.otp.otp_tokens'), edit_otp_token_path_for(resource), class: 'py-3 px-4 inline-flex items-center gap-x-2 text-sm font-medium rounded-lg border border-gray-200 bg-white text-gray-800 shadow-sm hover:bg-gray-50 focus:outline-none focus:bg-gray-50 disabled:opacity-50 disabled:pointer-events-none dark:bg-neutral-800 dark:border-neutral-700 dark:text-white dark:hover:bg-neutral-700 dark:focus:bg-neutral-700 mt-4' %>
|
21
|
+
<% end %>
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require_relative 'otp/presenter'
|
2
|
+
require_relative 'invitable/presenter'
|
3
|
+
require_relative 'standard/presenter'
|
4
|
+
|
5
|
+
module WebammToRails
|
6
|
+
module Sources
|
7
|
+
module Views
|
8
|
+
module Devise
|
9
|
+
class Presenter
|
10
|
+
def initialize(waml_definition:)
|
11
|
+
@waml_definition = waml_definition
|
12
|
+
end
|
13
|
+
|
14
|
+
def collection
|
15
|
+
return [] if @waml_definition.authentication.blank?
|
16
|
+
|
17
|
+
views_collection = []
|
18
|
+
|
19
|
+
@waml_definition.authentication.each do |authentication|
|
20
|
+
views_collection |= ::WebammToRails::Sources::Views::Devise::Standard::Presenter.new(table_name: authentication.table).collection
|
21
|
+
|
22
|
+
if authentication.features.include?('invitations')
|
23
|
+
views_collection |= ::WebammToRails::Sources::Views::Devise::Invitable::Presenter.new(table_name: authentication.table).collection
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
if @waml_definition.authentication.any? { |authentication| authentication.features.include?('two_factor_authentication') }
|
28
|
+
views_collection |= ::WebammToRails::Sources::Views::Devise::Otp::Presenter.new.collection
|
29
|
+
end
|
30
|
+
|
31
|
+
views_collection
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
module WebammToRails
|
2
|
+
module Sources
|
3
|
+
module Views
|
4
|
+
module Devise
|
5
|
+
module Standard
|
6
|
+
class Presenter
|
7
|
+
def initialize(table_name:)
|
8
|
+
@table_name = table_name
|
9
|
+
end
|
10
|
+
|
11
|
+
def collection
|
12
|
+
base_path = "app/views/#{@table_name}/"
|
13
|
+
templates = [
|
14
|
+
'confirmations/new.html.erb',
|
15
|
+
'mailer/confirmation_instructions.html.erb',
|
16
|
+
'mailer/reset_password_instructions.html.erb',
|
17
|
+
'mailer/email_changed.html.erb',
|
18
|
+
'mailer/password_change.html.erb',
|
19
|
+
'passwords/edit.html.erb',
|
20
|
+
'passwords/new.html.erb',
|
21
|
+
'registrations/edit.html.erb',
|
22
|
+
'registrations/new.html.erb',
|
23
|
+
'sessions/new.html.erb',
|
24
|
+
'shared/_links.html.erb'
|
25
|
+
]
|
26
|
+
|
27
|
+
templates.map do |template|
|
28
|
+
{
|
29
|
+
path: base_path + template,
|
30
|
+
content: File.read(File.expand_path("templates/#{template}", __dir__))
|
31
|
+
}
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
<%= form_for(resource, as: resource_name, url: confirmation_path(resource_name), html: { method: :post, class: "max-w-4xl mx-auto" }) do |form| %>
|
2
|
+
<% if resource.errors.any? %>
|
3
|
+
<div class="rounded-md bg-red-50 p-4 mb-4">
|
4
|
+
<div class="flex">
|
5
|
+
<div class="flex-shrink-0">
|
6
|
+
<svg class="h-5 w-5 text-red-400" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
|
7
|
+
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.28 7.22a.75.75 0 00-1.06 1.06L8.94 10l-1.72 1.72a.75.75 0 101.06 1.06L10 11.06l1.72 1.72a.75.75 0 101.06-1.06L11.06 10l1.72-1.72a.75.75 0 00-1.06-1.06L10 8.94 8.28 7.22z" clip-rule="evenodd" />
|
8
|
+
</svg>
|
9
|
+
</div>
|
10
|
+
<div class="ml-3">
|
11
|
+
<h3 class="text-sm font-medium text-red-800"><%= pluralize(resource.errors.count, "error") %> prohibited this record from being saved:</h3>
|
12
|
+
<div class="mt-2 text-sm text-red-700">
|
13
|
+
<ul role="list" class="list-disc space-y-1 pl-5">
|
14
|
+
<% resource.errors.each do |error| %>
|
15
|
+
<li><%= error.full_message %></li>
|
16
|
+
<% end %>
|
17
|
+
</ul>
|
18
|
+
</div>
|
19
|
+
</div>
|
20
|
+
</div>
|
21
|
+
</div>
|
22
|
+
<% end %>
|
23
|
+
<div class="my-5">
|
24
|
+
<label class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">E-mail address:</label>
|
25
|
+
<%= form.email_field :email, class: 'shadow-sm bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500 dark:shadow-sm-light' %>
|
26
|
+
</div>
|
27
|
+
|
28
|
+
<%= form.submit "Resend confirmation instructions", class: 'text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800' %>
|
29
|
+
<% end %>
|
30
|
+
|
31
|
+
<%= render "#{resource.class.name.underscore.pluralize}/shared/links" %>
|
@@ -0,0 +1,17 @@
|
|
1
|
+
<p>Welcome <%= @email %>!</p>
|
2
|
+
<p>You can confirm your account email through the link below:</p>
|
3
|
+
<table role="presentation" border="0" cellpadding="0" cellspacing="0" class="btn btn-primary">
|
4
|
+
<tbody>
|
5
|
+
<tr>
|
6
|
+
<td align="left">
|
7
|
+
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
8
|
+
<tbody>
|
9
|
+
<tr>
|
10
|
+
<td> <%= link_to 'Confirm my account', confirmation_url(@resource, confirmation_token: @token) %></td>
|
11
|
+
</tr>
|
12
|
+
</tbody>
|
13
|
+
</table>
|
14
|
+
</td>
|
15
|
+
</tr>
|
16
|
+
</tbody>
|
17
|
+
</table>
|
data/lib/webamm_to_rails/sources/views/devise/standard/templates/mailer/email_changed.html.erb
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
<p>Hello <%= @email %>!</p>
|
2
|
+
|
3
|
+
<% if @resource.try(:unconfirmed_email?) %>
|
4
|
+
<p>We're contacting you to notify you that your email is being changed to <%= @resource.unconfirmed_email %>.</p>
|
5
|
+
<% else %>
|
6
|
+
<p>We're contacting you to notify you that your email has been changed to <%= @resource.email %>.</p>
|
7
|
+
<% end %>
|
@@ -0,0 +1,22 @@
|
|
1
|
+
<p>Hello <%= @resource.email %>!</p>
|
2
|
+
|
3
|
+
<p>Someone has requested a link to change your password. You can do this through the link below.</p>
|
4
|
+
|
5
|
+
<table role="presentation" border="0" cellpadding="0" cellspacing="0" class="btn btn-primary">
|
6
|
+
<tbody>
|
7
|
+
<tr>
|
8
|
+
<td align="left">
|
9
|
+
<table role="presentation" border="0" cellpadding="0" cellspacing="0">
|
10
|
+
<tbody>
|
11
|
+
<tr>
|
12
|
+
<td> <%= link_to 'Change my password', edit_password_url(@resource, reset_password_token: @token) %></td>
|
13
|
+
</tr>
|
14
|
+
</tbody>
|
15
|
+
</table>
|
16
|
+
</td>
|
17
|
+
</tr>
|
18
|
+
</tbody>
|
19
|
+
</table>
|
20
|
+
|
21
|
+
<p>If you didn't request this, please ignore this email.</p>
|
22
|
+
<p>Your password won't change until you access the link above and create a new one.</p>
|
@@ -0,0 +1,36 @@
|
|
1
|
+
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :put, class: "max-w-4xl mx-auto" }) do |form| %>
|
2
|
+
<%= form.hidden_field :reset_password_token %>
|
3
|
+
<% if resource.errors.any? %>
|
4
|
+
<div class="rounded-md bg-red-50 p-4 mb-4">
|
5
|
+
<div class="flex">
|
6
|
+
<div class="flex-shrink-0">
|
7
|
+
<svg class="h-5 w-5 text-red-400" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
|
8
|
+
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.28 7.22a.75.75 0 00-1.06 1.06L8.94 10l-1.72 1.72a.75.75 0 101.06 1.06L10 11.06l1.72 1.72a.75.75 0 101.06-1.06L11.06 10l1.72-1.72a.75.75 0 00-1.06-1.06L10 8.94 8.28 7.22z" clip-rule="evenodd" />
|
9
|
+
</svg>
|
10
|
+
</div>
|
11
|
+
<div class="ml-3">
|
12
|
+
<h3 class="text-sm font-medium text-red-800"><%= pluralize(resource.errors.count, "error") %> prohibited this record from being saved:</h3>
|
13
|
+
<div class="mt-2 text-sm text-red-700">
|
14
|
+
<ul role="list" class="list-disc space-y-1 pl-5">
|
15
|
+
<% resource.errors.each do |error| %>
|
16
|
+
<li><%= error.full_message %></li>
|
17
|
+
<% end %>
|
18
|
+
</ul>
|
19
|
+
</div>
|
20
|
+
</div>
|
21
|
+
</div>
|
22
|
+
</div>
|
23
|
+
<% end %>
|
24
|
+
<div class="my-5">
|
25
|
+
<label class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">New password:</label>
|
26
|
+
<%= form.password_field :password, class: 'shadow-sm bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500 dark:shadow-sm-light' %>
|
27
|
+
</div>
|
28
|
+
<div class="my-5">
|
29
|
+
<label class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Confirm new password:</label>
|
30
|
+
<%= form.password_field :password_confirmation, class: 'shadow-sm bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500 dark:shadow-sm-light' %>
|
31
|
+
</div>
|
32
|
+
|
33
|
+
<%= form.submit "Change my password", class: 'text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800' %>
|
34
|
+
<% end %>
|
35
|
+
|
36
|
+
<%= render "#{resource.class.name.underscore.pluralize}/shared/links" %>
|
@@ -0,0 +1,31 @@
|
|
1
|
+
<%= form_for(resource, as: resource_name, url: password_path(resource_name), html: { method: :post, class: "max-w-4xl mx-auto" }) do |form| %>
|
2
|
+
<% if resource.errors.any? %>
|
3
|
+
<div class="rounded-md bg-red-50 p-4 mb-4">
|
4
|
+
<div class="flex">
|
5
|
+
<div class="flex-shrink-0">
|
6
|
+
<svg class="h-5 w-5 text-red-400" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
|
7
|
+
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.28 7.22a.75.75 0 00-1.06 1.06L8.94 10l-1.72 1.72a.75.75 0 101.06 1.06L10 11.06l1.72 1.72a.75.75 0 101.06-1.06L11.06 10l1.72-1.72a.75.75 0 00-1.06-1.06L10 8.94 8.28 7.22z" clip-rule="evenodd" />
|
8
|
+
</svg>
|
9
|
+
</div>
|
10
|
+
<div class="ml-3">
|
11
|
+
<h3 class="text-sm font-medium text-red-800"><%= pluralize(resource.errors.count, "error") %> prohibited this record from being saved:</h3>
|
12
|
+
<div class="mt-2 text-sm text-red-700">
|
13
|
+
<ul role="list" class="list-disc space-y-1 pl-5">
|
14
|
+
<% resource.errors.each do |error| %>
|
15
|
+
<li><%= error.full_message %></li>
|
16
|
+
<% end %>
|
17
|
+
</ul>
|
18
|
+
</div>
|
19
|
+
</div>
|
20
|
+
</div>
|
21
|
+
</div>
|
22
|
+
<% end %>
|
23
|
+
<div class="my-5">
|
24
|
+
<label class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">E-mail address:</label>
|
25
|
+
<%= form.email_field :email, class: 'shadow-sm bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500 dark:shadow-sm-light' %>
|
26
|
+
</div>
|
27
|
+
|
28
|
+
<%= form.submit "Send me reset password instructions", class: 'text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800' %>
|
29
|
+
<% end %>
|
30
|
+
|
31
|
+
<%= render "#{resource.class.name.underscore.pluralize}/shared/links" %>
|
@@ -0,0 +1,43 @@
|
|
1
|
+
<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put, class: "max-w-4xl mx-auto" }) do |form| %>
|
2
|
+
<% if resource.errors.any? %>
|
3
|
+
<div class="rounded-md bg-red-50 p-4 mb-4">
|
4
|
+
<div class="flex">
|
5
|
+
<div class="flex-shrink-0">
|
6
|
+
<svg class="h-5 w-5 text-red-400" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
|
7
|
+
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.28 7.22a.75.75 0 00-1.06 1.06L8.94 10l-1.72 1.72a.75.75 0 101.06 1.06L10 11.06l1.72 1.72a.75.75 0 101.06-1.06L11.06 10l1.72-1.72a.75.75 0 00-1.06-1.06L10 8.94 8.28 7.22z" clip-rule="evenodd" />
|
8
|
+
</svg>
|
9
|
+
</div>
|
10
|
+
<div class="ml-3">
|
11
|
+
<h3 class="text-sm font-medium text-red-800"><%= pluralize(resource.errors.count, "error") %> prohibited this record from being saved:</h3>
|
12
|
+
<div class="mt-2 text-sm text-red-700">
|
13
|
+
<ul role="list" class="list-disc space-y-1 pl-5">
|
14
|
+
<% resource.errors.each do |error| %>
|
15
|
+
<li><%= error.full_message %></li>
|
16
|
+
<% end %>
|
17
|
+
</ul>
|
18
|
+
</div>
|
19
|
+
</div>
|
20
|
+
</div>
|
21
|
+
</div>
|
22
|
+
<% end %>
|
23
|
+
<div class="my-5">
|
24
|
+
<label class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">E-mail address:</label>
|
25
|
+
<%= form.email_field :email, class: 'shadow-sm bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500 dark:shadow-sm-light' %>
|
26
|
+
</div>
|
27
|
+
<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
|
28
|
+
<div class="text-sm font-medium text-gray-900">Currently waiting confirmation for: <%= resource.unconfirmed_email %></div>
|
29
|
+
<% end %>
|
30
|
+
<div class="my-5">
|
31
|
+
<label class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Password (leave blank if you don't want to change it):</label>
|
32
|
+
<%= form.password_field :password, class: 'shadow-sm bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500 dark:shadow-sm-light' %>
|
33
|
+
</div>
|
34
|
+
<div class="my-5">
|
35
|
+
<label class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Password confirmation:</label>
|
36
|
+
<%= form.password_field :password_confirmation, autocomplete: "new-password", class: 'shadow-sm bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500 dark:shadow-sm-light' %>
|
37
|
+
</div>
|
38
|
+
<div class="my-5">
|
39
|
+
<label class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Current password (we need your current password to confirm your changes):</label>
|
40
|
+
<%= form.password_field :current_password, autocomplete: "current-password", class: 'shadow-sm bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500 dark:shadow-sm-light' %>
|
41
|
+
</div>
|
42
|
+
<%= form.submit "Update", class: 'text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800' %>
|
43
|
+
<% end %>
|
@@ -0,0 +1,39 @@
|
|
1
|
+
<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { class: "max-w-4xl mx-auto" }) do |form| %>
|
2
|
+
<% if resource.errors.any? %>
|
3
|
+
<div class="rounded-md bg-red-50 p-4 mb-4">
|
4
|
+
<div class="flex">
|
5
|
+
<div class="flex-shrink-0">
|
6
|
+
<svg class="h-5 w-5 text-red-400" viewBox="0 0 20 20" fill="currentColor" aria-hidden="true">
|
7
|
+
<path fill-rule="evenodd" d="M10 18a8 8 0 100-16 8 8 0 000 16zM8.28 7.22a.75.75 0 00-1.06 1.06L8.94 10l-1.72 1.72a.75.75 0 101.06 1.06L10 11.06l1.72 1.72a.75.75 0 101.06-1.06L11.06 10l1.72-1.72a.75.75 0 00-1.06-1.06L10 8.94 8.28 7.22z" clip-rule="evenodd" />
|
8
|
+
</svg>
|
9
|
+
</div>
|
10
|
+
<div class="ml-3">
|
11
|
+
<h3 class="text-sm font-medium text-red-800"><%= pluralize(resource.errors.count, "error") %> prohibited this record from being saved:</h3>
|
12
|
+
<div class="mt-2 text-sm text-red-700">
|
13
|
+
<ul role="list" class="list-disc space-y-1 pl-5">
|
14
|
+
<% resource.errors.each do |error| %>
|
15
|
+
<li><%= error.full_message %></li>
|
16
|
+
<% end %>
|
17
|
+
</ul>
|
18
|
+
</div>
|
19
|
+
</div>
|
20
|
+
</div>
|
21
|
+
</div>
|
22
|
+
<% end %>
|
23
|
+
<div class="my-5">
|
24
|
+
<label class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">E-mail address:</label>
|
25
|
+
<%= form.email_field :email, class: 'shadow-sm bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500 dark:shadow-sm-light' %>
|
26
|
+
</div>
|
27
|
+
<div class="my-5">
|
28
|
+
<label class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Password:</label>
|
29
|
+
<%= form.password_field :password, class: 'shadow-sm bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500 dark:shadow-sm-light' %>
|
30
|
+
</div>
|
31
|
+
<div class="my-5">
|
32
|
+
<label class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Password confirmation:</label>
|
33
|
+
<%= form.password_field :password_confirmation, class: 'shadow-sm bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500 dark:shadow-sm-light' %>
|
34
|
+
</div>
|
35
|
+
|
36
|
+
<%= form.submit "Sign up", class: 'text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800' %>
|
37
|
+
<% end %>
|
38
|
+
|
39
|
+
<%= render "#{resource.class.name.underscore.pluralize}/shared/links" %>
|
@@ -0,0 +1,23 @@
|
|
1
|
+
<%= form_for(resource, as: resource_name, url: session_path(resource_name), html: { class: "max-w-4xl mx-auto", data: { turbo: false } }) do |form| %>
|
2
|
+
<div class="my-5">
|
3
|
+
<label class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">E-mail address:</label>
|
4
|
+
<%= form.email_field :email, class: 'shadow-sm bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500 dark:shadow-sm-light' %>
|
5
|
+
</div>
|
6
|
+
<div class="my-5">
|
7
|
+
<label class="block mb-2 text-sm font-medium text-gray-900 dark:text-white">Password:</label>
|
8
|
+
<%= form.password_field :password, class: 'shadow-sm bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500 dark:shadow-sm-light' %>
|
9
|
+
</div>
|
10
|
+
|
11
|
+
<% if devise_mapping.rememberable? %>
|
12
|
+
<div class="flex items-start mb-5">
|
13
|
+
<div class="flex items-center h-5">
|
14
|
+
<%= form.check_box :remember_me, class: 'w-4 h-4 border border-gray-300 rounded bg-gray-50 focus:ring-3 focus:ring-blue-300 dark:bg-gray-700 dark:border-gray-600 dark:focus:ring-blue-600 dark:ring-offset-gray-800 dark:focus:ring-offset-gray-800' %>
|
15
|
+
</div>
|
16
|
+
<label for="remember" class="ms-2 text-sm font-medium text-gray-900 dark:text-gray-300">Remember me</label>
|
17
|
+
</div>
|
18
|
+
<% end %>
|
19
|
+
|
20
|
+
<%= form.submit "Log in", class: 'text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800' %>
|
21
|
+
<% end %>
|
22
|
+
|
23
|
+
<%= render "#{resource.class.name.underscore.pluralize}/shared/links" %>
|
@@ -0,0 +1,27 @@
|
|
1
|
+
<div class="max-w-4xl mx-auto mt-10">
|
2
|
+
<%- if controller_name != 'sessions' %>
|
3
|
+
<%= link_to "Log in", new_session_path(resource_name) %><br />
|
4
|
+
<% end %>
|
5
|
+
|
6
|
+
<%- if devise_mapping.registerable? && controller_name != 'registrations' %>
|
7
|
+
<%= link_to "Sign up", new_registration_path(resource_name) %><br />
|
8
|
+
<% end %>
|
9
|
+
|
10
|
+
<%- if devise_mapping.recoverable? && controller_name != 'passwords' && controller_name != 'registrations' %>
|
11
|
+
<%= link_to "Forgot your password?", new_password_path(resource_name) %><br />
|
12
|
+
<% end %>
|
13
|
+
|
14
|
+
<%- if devise_mapping.confirmable? && controller_name != 'confirmations' %>
|
15
|
+
<%= link_to "Didn't receive confirmation instructions?", new_confirmation_path(resource_name) %><br />
|
16
|
+
<% end %>
|
17
|
+
|
18
|
+
<%- if devise_mapping.lockable? && resource_class.unlock_strategy_enabled?(:email) && controller_name != 'unlocks' %>
|
19
|
+
<%= link_to "Didn't receive unlock instructions?", new_unlock_path(resource_name) %><br />
|
20
|
+
<% end %>
|
21
|
+
|
22
|
+
<%- if devise_mapping.omniauthable? %>
|
23
|
+
<%- resource_class.omniauth_providers.each do |provider| %>
|
24
|
+
<%= button_to "Sign in with #{OmniAuth::Utils.camelize(provider)}", omniauth_authorize_path(resource_name, provider), data: { turbo: false } %><br />
|
25
|
+
<% end %>
|
26
|
+
<% end %>
|
27
|
+
</div>
|
@@ -0,0 +1,41 @@
|
|
1
|
+
module WebammToRails
|
2
|
+
module Sources
|
3
|
+
module Views
|
4
|
+
module Resource
|
5
|
+
module EditDefinition
|
6
|
+
class Presenter
|
7
|
+
def initialize(crud_definition:)
|
8
|
+
@crud_definition = crud_definition
|
9
|
+
end
|
10
|
+
|
11
|
+
def render?
|
12
|
+
@crud_definition.actions.find { |action| action.name == 'update' }.present?
|
13
|
+
end
|
14
|
+
|
15
|
+
def render
|
16
|
+
template_path = File.expand_path('template.erb', __dir__)
|
17
|
+
template_content = File.read(template_path)
|
18
|
+
raw_content = ERB.new(template_content, trim_mode: '-').result(instance_eval { binding })
|
19
|
+
|
20
|
+
::WebammToRails::Utils::FormatTemplate.call(raw_content)
|
21
|
+
end
|
22
|
+
|
23
|
+
def path_name
|
24
|
+
"app/views/#{resource_name}/edit.html.erb"
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
def resource_name
|
30
|
+
@crud_definition.table
|
31
|
+
end
|
32
|
+
|
33
|
+
def single_record_name
|
34
|
+
@crud_definition.table.singularize
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|