lesli_shield 1.1.7 → 1.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (102) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/stylesheets/lesli_shield/application.css +1036 -32
  3. data/app/assets/stylesheets/lesli_shield/confirmations.css +89 -557
  4. data/app/assets/stylesheets/lesli_shield/invitations.css +544 -0
  5. data/app/assets/stylesheets/lesli_shield/passwords.css +76 -542
  6. data/app/assets/stylesheets/lesli_shield/registrations.css +66 -539
  7. data/app/assets/stylesheets/lesli_shield/sessions.css +98 -564
  8. data/app/controllers/lesli_shield/invites_controller.rb +100 -49
  9. data/app/controllers/lesli_shield/profiles_controller.rb +9 -3
  10. data/app/controllers/lesli_shield/role/actions_controller.rb +134 -38
  11. data/app/controllers/lesli_shield/roles_controller.rb +114 -141
  12. data/app/controllers/lesli_shield/users_controller.rb +11 -4
  13. data/app/controllers/users/confirmations_controller.rb +2 -2
  14. data/app/controllers/users/invitations_controller.rb +101 -0
  15. data/app/controllers/users/passwords_controller.rb +1 -1
  16. data/app/controllers/users/registrations_controller.rb +2 -2
  17. data/app/controllers/users/sessions_controller.rb +3 -1
  18. data/app/jobs/lesli_shield/invitation_delivery_job.rb +123 -0
  19. data/app/mailers/lesli_shield/devise_mailer.rb +3 -3
  20. data/app/mailers/lesli_shield/invitation_mailer.rb +58 -0
  21. data/app/models/concerns/lesli_shield/role_management.rb +70 -0
  22. data/app/models/concerns/lesli_shield/user_security.rb +22 -19
  23. data/app/models/lesli_shield/invite.rb +183 -12
  24. data/app/services/lesli_shield/invitation_audit.rb +34 -0
  25. data/app/services/lesli_shield/invitation_email_policy.rb +64 -0
  26. data/app/services/lesli_shield/invitation_service.rb +405 -0
  27. data/app/services/lesli_shield/invite_service.rb +34 -5
  28. data/app/services/lesli_shield/profile_service.rb +1 -0
  29. data/app/services/lesli_shield/role_action_service.rb +37 -92
  30. data/app/services/lesli_shield/role_audit.rb +42 -0
  31. data/app/services/lesli_shield/role_permission_service.rb +347 -0
  32. data/app/services/lesli_shield/role_privilege_deployment_service.rb +79 -0
  33. data/app/services/lesli_shield/role_privilege_service.rb +69 -105
  34. data/app/services/lesli_shield/role_service.rb +431 -0
  35. data/app/services/lesli_shield/user_registration_service.rb +1 -1
  36. data/app/services/lesli_shield/user_validator_service.rb +9 -9
  37. data/app/views/devise/confirmations/new.html.erb +6 -6
  38. data/app/views/devise/confirmations/show.html.erb +6 -6
  39. data/app/views/devise/passwords/edit.html.erb +8 -8
  40. data/app/views/devise/passwords/new.html.erb +9 -9
  41. data/app/views/devise/registrations/new.html.erb +16 -16
  42. data/app/views/devise/sessions/new.html.erb +9 -9
  43. data/app/views/devise/shared/_application-devise-simple.erb +1 -1
  44. data/app/views/devise/shared/_application-devise.html.erb +4 -4
  45. data/app/views/devise/shared/_demo.html.erb +5 -5
  46. data/app/views/devise/shared/_error_messages.html.erb +5 -5
  47. data/app/views/devise/shared/_links.html.erb +12 -15
  48. data/app/views/lesli_shield/invites/_form.html.erb +64 -7
  49. data/app/views/lesli_shield/invites/_invite.html.erb +55 -2
  50. data/app/views/lesli_shield/invites/_invite_actions.html.erb +34 -0
  51. data/app/views/lesli_shield/invites/_status_badge.html.erb +13 -0
  52. data/app/views/lesli_shield/invites/index.html.erb +119 -63
  53. data/app/views/lesli_shield/invites/new.html.erb +11 -36
  54. data/app/views/lesli_shield/invites/show.html.erb +13 -52
  55. data/app/views/lesli_shield/profiles/_information-form.html.erb +11 -0
  56. data/app/views/lesli_shield/profiles/_password-form.html.erb +1 -1
  57. data/app/views/lesli_shield/profiles/show.html.erb +1 -4
  58. data/app/views/lesli_shield/role/actions/_custom_actions.html.erb +24 -0
  59. data/app/views/lesli_shield/role/actions/_deployment_status.html.erb +14 -0
  60. data/app/views/lesli_shield/role/actions/_matrix.html.erb +69 -0
  61. data/app/views/lesli_shield/role/actions/_permissions.html.erb +95 -0
  62. data/app/views/lesli_shield/role/actions/_toggle.html.erb +34 -0
  63. data/app/views/lesli_shield/role/actions/index.html.erb +13 -10
  64. data/app/views/lesli_shield/roles/_deployment_badge.html.erb +15 -0
  65. data/app/views/lesli_shield/roles/_empty_state.html.erb +20 -0
  66. data/app/views/lesli_shield/roles/_field_errors.html.erb +5 -0
  67. data/app/views/lesli_shield/roles/_filters.html.erb +66 -0
  68. data/app/views/lesli_shield/roles/_form.html.erb +149 -18
  69. data/app/views/lesli_shield/roles/_management_menu.html.erb +37 -0
  70. data/app/views/lesli_shield/roles/_pagination.html.erb +43 -0
  71. data/app/views/lesli_shield/roles/_role_list.html.erb +116 -0
  72. data/app/views/lesli_shield/roles/_status_badge.html.erb +11 -0
  73. data/app/views/lesli_shield/roles/_type_badge.html.erb +9 -0
  74. data/app/views/lesli_shield/roles/index.html.erb +15 -38
  75. data/app/views/lesli_shield/roles/new.html.erb +11 -0
  76. data/app/views/lesli_shield/roles/show.html.erb +79 -7
  77. data/app/views/lesli_shield/users/_information-card.html.erb +3 -3
  78. data/app/views/lesli_shield/users/_information-form.html.erb +6 -0
  79. data/app/views/lesli_shield/users/_management-privileges.html.erb +2 -2
  80. data/app/views/users/invitations/show.html.erb +142 -0
  81. data/app/views/users/invitations/unavailable.html.erb +19 -0
  82. data/config/locales/devise.en.yml +8 -0
  83. data/config/locales/devise.es.yml +8 -0
  84. data/config/locales/translations.en.yml +313 -78
  85. data/config/locales/translations.es.yml +313 -78
  86. data/config/routes.rb +10 -3
  87. data/db/migrate/v1/0801120110_create_lesli_shield_invites.rb +40 -6
  88. data/lib/lesli_shield/engine.rb +4 -0
  89. data/lib/lesli_shield/router.rb +10 -0
  90. data/lib/lesli_shield/version.rb +2 -2
  91. data/lib/tasks/lesli_shield_tasks.rake +1 -1
  92. data/readme.md +13 -1
  93. metadata +35 -11
  94. data/app/assets/stylesheets/lesli_shield/confirmations.tailwind.css +0 -918
  95. data/app/assets/stylesheets/lesli_shield/devise/oauth.css +0 -33
  96. data/app/assets/stylesheets/lesli_shield/passwords.tailwind.css +0 -873
  97. data/app/assets/stylesheets/lesli_shield/registrations.tailwind.css +0 -908
  98. data/app/assets/stylesheets/lesli_shield/sessions.tailwind.css +0 -984
  99. data/app/assets/stylesheets/lesli_shield/users.css +0 -31
  100. data/app/mailers/lesli_shield/invitation.html.erb +0 -23
  101. data/app/views/lesli_shield/invites/edit.html.erb +0 -12
  102. data/app/views/lesli_shield/role/actions/_form.html.erb +0 -75
@@ -1,7 +1,7 @@
1
1
 
2
2
  <%= render(
3
3
  "devise/shared/application-devise-simple",
4
- title: I18n.t("lesli_shield.devise/passwords.view_request_title")
4
+ title: I18n.t("lesli_shield.devise_passwords.view_request_title")
5
5
  ) do %>
6
6
 
7
7
  <%= form_for(
@@ -12,8 +12,8 @@
12
12
  builder: LesliView::Forms::Builder
13
13
  ) do |form| %>
14
14
 
15
- <p class="mb-6 text-center text-sm leading-6 text-slate-600">
16
- <%= I18n.t("lesli_shield.devise/passwords.view_request_description") %>
15
+ <p class="mb-6 text-center text-sm leading-6 text-neutral-600">
16
+ <%= I18n.t("lesli_shield.devise_passwords.view_request_description") %>
17
17
  </p>
18
18
 
19
19
  <%= render "devise/shared/error_messages", resource: resource %>
@@ -21,7 +21,7 @@
21
21
  <%= form.field_control_email(
22
22
  :email,
23
23
  icon: "mail",
24
- label: I18n.t("lesli_shield.devise/passwords.field_email"),
24
+ label: I18n.t("lesli_shield.devise_passwords.field_email"),
25
25
  required: true,
26
26
  autofocus: true,
27
27
  autocomplete: "email",
@@ -30,12 +30,12 @@
30
30
  ) %>
31
31
 
32
32
  <%= form.field_control_button(
33
- I18n.t("lesli_shield.devise/passwords.button_send_instructions"),
33
+ I18n.t("lesli_shield.devise_passwords.button_send_instructions"),
34
34
  {
35
35
  class: "is-fullwidth",
36
36
  data: {
37
37
  turbo_submits_with: I18n.t(
38
- "lesli_shield.devise/passwords.button_sending"
38
+ "lesli_shield.devise_passwords.button_sending"
39
39
  )
40
40
  }
41
41
  },
@@ -43,13 +43,13 @@
43
43
  ) %>
44
44
 
45
45
  <% if Lesli.config.security.dig(:allow_registration) %>
46
- <p class="mt-6 text-center text-sm text-slate-600">
46
+ <p class="mt-6 text-center text-sm text-neutral-600">
47
47
  <%= I18n.t(
48
- "lesli_shield.devise/sessions.view_still_not_registered"
48
+ "lesli_shield.devise_sessions.view_still_not_registered"
49
49
  ) %>
50
50
  <%= link_to(
51
51
  I18n.t(
52
- "lesli_shield.devise/registrations.button_create_account"
52
+ "lesli_shield.devise_registrations.button_create_account"
53
53
  ),
54
54
  new_user_registration_path,
55
55
  class: "font-semibold text-[var(--lesli-color-primary)] underline underline-offset-2 hover:opacity-80 focus-visible:rounded-sm focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--lesli-color-primary)]"
@@ -31,8 +31,8 @@ Building a better future, one line of code at a time.
31
31
  %>
32
32
 
33
33
  <%
34
- title = I18n.t("overrides.lesli_shield.devise/registrations.view_title",
35
- default: :"lesli_shield.devise/registrations.view_title")
34
+ title = I18n.t("overrides.lesli_shield.devise_registrations.view_title",
35
+ default: :"lesli_shield.devise_registrations.view_title")
36
36
  %>
37
37
 
38
38
  <%= render("devise/shared/application-devise", title: title) do %>
@@ -45,15 +45,15 @@ title = I18n.t("overrides.lesli_shield.devise/registrations.view_title",
45
45
  builder: LesliView::Forms::Builder
46
46
  ) do |form| %>
47
47
 
48
- <p class="mb-6 text-center text-sm leading-6 text-slate-600">
49
- <%= I18n.t("lesli_shield.devise/registrations.view_description") %>
48
+ <p class="mb-6 text-center text-sm leading-6 text-neutral-600">
49
+ <%= I18n.t("lesli_shield.devise_registrations.view_description") %>
50
50
  </p>
51
51
 
52
52
  <%= render "devise/shared/error_messages", resource: resource %>
53
53
 
54
54
  <%= form.field_control_email(
55
55
  :email,
56
- label: I18n.t("lesli_shield.devise/registrations.label_email"),
56
+ label: I18n.t("lesli_shield.devise_registrations.label_email"),
57
57
  message: resource.errors[:email].to_sentence.presence,
58
58
  category: resource.errors[:email].any? ? :danger : nil,
59
59
  icon: "person",
@@ -66,10 +66,10 @@ title = I18n.t("overrides.lesli_shield.devise/registrations.view_title",
66
66
 
67
67
  <%= form.field_control_password(
68
68
  :password,
69
- label: I18n.t("lesli_shield.devise/registrations.label_password"),
69
+ label: I18n.t("lesli_shield.devise_registrations.label_password"),
70
70
  message: resource.errors[:password].to_sentence.presence ||
71
71
  I18n.t(
72
- "lesli_shield.devise/registrations.view_password_length",
72
+ "lesli_shield.devise_registrations.view_password_length",
73
73
  minimum: @minimum_password_length,
74
74
  maximum: Devise.password_length.max
75
75
  ),
@@ -85,7 +85,7 @@ title = I18n.t("overrides.lesli_shield.devise/registrations.view_title",
85
85
  <%= form.field_control_password(
86
86
  :password_confirmation,
87
87
  label: I18n.t(
88
- "lesli_shield.devise/registrations.label_password_confirmation"
88
+ "lesli_shield.devise_registrations.label_password_confirmation"
89
89
  ),
90
90
  message: resource.errors[:password_confirmation].to_sentence.presence,
91
91
  category: resource.errors[:password_confirmation].any? ? :danger : nil,
@@ -98,31 +98,31 @@ title = I18n.t("overrides.lesli_shield.devise/registrations.view_title",
98
98
  ) %>
99
99
 
100
100
  <div class="mb-4">
101
- <p class="text-left text-xs leading-5 text-slate-500">
102
- <%= I18n.t("lesli_shield.devise/registrations.view_legal_notice") %>
101
+ <p class="text-left text-xs leading-5 text-neutral-500">
102
+ <%= I18n.t("lesli_shield.devise_registrations.view_legal_notice") %>
103
103
  </p>
104
104
  </div>
105
105
 
106
106
  <%= form.field_control_button(
107
107
  I18n.t(
108
- "overrides.lesli_shield.devise/registrations.button_create_account",
109
- default: :"lesli_shield.devise/registrations.button_create_account"
108
+ "overrides.lesli_shield.devise_registrations.button_create_account",
109
+ default: :"lesli_shield.devise_registrations.button_create_account"
110
110
  ),
111
111
  {
112
112
  class: "w-full",
113
113
  data: {
114
114
  turbo_submits_with: I18n.t(
115
- "lesli_shield.devise/registrations.button_creating_account"
115
+ "lesli_shield.devise_registrations.button_creating_account"
116
116
  )
117
117
  }
118
118
  },
119
119
  icon: "person_add"
120
120
  ) %>
121
121
 
122
- <p class="mt-1 text-center text-sm text-slate-600">
123
- <%= I18n.t("lesli_shield.devise/registrations.view_already_have_an_account") %>
122
+ <p class="mt-1 text-center text-sm text-neutral-600">
123
+ <%= I18n.t("lesli_shield.devise_registrations.view_already_have_an_account") %>
124
124
  <%= link_to(
125
- I18n.t("lesli_shield.devise/registrations.button_login"),
125
+ I18n.t("lesli_shield.devise_registrations.button_login"),
126
126
  new_user_session_path,
127
127
  class: "font-semibold text-[var(--lesli-color-primary)] underline underline-offset-2 hover:opacity-80 focus-visible:rounded-sm focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--lesli-color-primary)]"
128
128
  ) %>
@@ -31,8 +31,8 @@ Building a better future, one line of code at a time.
31
31
  %>
32
32
 
33
33
  <%
34
- title = I18n.t("overrides.lesli_shield.devise/sessions.view_title",
35
- default: :"lesli_shield.devise/sessions.view_title")
34
+ title = I18n.t("overrides.lesli_shield.devise_sessions.view_title",
35
+ default: :"lesli_shield.devise_sessions.view_title")
36
36
 
37
37
  demo_credentials = if Lesli.config.demo
38
38
  {
@@ -48,7 +48,7 @@ end
48
48
 
49
49
  <%
50
50
  email_field_options = {
51
- label: I18n.t("lesli_shield.devise/sessions.label_email", default: "Email address"),
51
+ label: I18n.t("lesli_shield.devise_sessions.label_email", default: "Email address"),
52
52
  category: authentication_error.present? ? :danger : nil,
53
53
  icon: "person",
54
54
  autofocus: true,
@@ -58,7 +58,7 @@ end
58
58
  }
59
59
 
60
60
  password_field_options = {
61
- label: I18n.t("lesli_shield.devise/sessions.label_password", default: "Password"),
61
+ label: I18n.t("lesli_shield.devise_sessions.label_password", default: "Password"),
62
62
  message: authentication_error,
63
63
  category: authentication_error.present? ? :danger : nil,
64
64
  icon: "key",
@@ -100,15 +100,15 @@ end
100
100
  <% end %>
101
101
 
102
102
  <%= form.field_control_button(
103
- I18n.t("lesli_shield.devise/sessions.button_log_in"),
103
+ I18n.t("lesli_shield.devise_sessions.button_log_in"),
104
104
  { class: "is-fullwidth" },
105
105
  icon: "login"
106
106
  ) %>
107
107
 
108
108
  <% if Lesli.config.security.dig(:allow_registration) %>
109
- <p class="mt-1 text-center text-sm text-slate-600">
110
- <%= I18n.t("lesli_shield.devise/sessions.view_still_not_registered") %>
111
- <%= link_to I18n.t("lesli_shield.devise/sessions.button_create_account"),
109
+ <p class="mt-1 text-center text-sm text-neutral-600">
110
+ <%= I18n.t("lesli_shield.devise_sessions.view_still_not_registered") %>
111
+ <%= link_to I18n.t("lesli_shield.devise_sessions.button_create_account"),
112
112
  new_user_registration_path %>
113
113
  </p>
114
114
  <% end %>
@@ -117,7 +117,7 @@ end
117
117
  <%= render("devise/shared/links",
118
118
  password_reset:true,
119
119
  #magic_link:true,
120
- login:true,
120
+ #login:true,
121
121
  #otp:true,
122
122
  ) %>
123
123
  <% end %>
@@ -51,7 +51,7 @@ Building a better future, one line of code at a time.
51
51
  </div>
52
52
  </header>
53
53
 
54
- <div class="flex flex-1 flex-col items-center border-t border-slate-200 bg-slate-50 px-4 py-8 sm:px-6 [&>form]:my-6 [&>form]:w-full [&>form]:max-w-lg [&>form]:rounded-xl [&>form]:border [&>form]:border-slate-200 [&>form]:bg-white [&>form]:p-6 [&>form]:shadow-sm sm:[&>form]:my-8 sm:[&>form]:p-10">
54
+ <div class="flex flex-1 flex-col items-center border-t border-neutral-200 bg-neutral-50 px-4 py-8 sm:px-6 [&>form]:my-6 [&>form]:w-full [&>form]:max-w-lg [&>form]:rounded-xl [&>form]:border [&>form]:border-neutral-200 [&>form]:bg-white [&>form]:p-6 [&>form]:shadow-sm sm:[&>form]:my-8 sm:[&>form]:p-10">
55
55
  <%= yield %>
56
56
  </div>
57
57
  </section>
@@ -33,12 +33,12 @@ Building a better future, one line of code at a time.
33
33
  <% title = local_assigns.fetch(:title, "") %>
34
34
  <% back_to_login = local_assigns.fetch(:back_to_login, false) %>
35
35
 
36
- <main id="lesli-application" class="min-h-screen bg-slate-50 lg:grid lg:grid-cols-3">
36
+ <main id="lesli-application" class="min-h-screen bg-neutral-50 lg:grid lg:grid-cols-3">
37
37
  <section class="flex min-h-screen flex-col bg-white">
38
38
  <% if back_to_login %>
39
39
  <div class="px-6 pt-6 sm:px-10 sm:pt-8">
40
40
  <%= link_to new_user_session_path,
41
- class: "inline-flex items-center gap-2 rounded-lg text-sm font-medium text-sky-700 transition hover:text-sky-900 focus:outline-none focus:ring-2 focus:ring-sky-500/30 focus:ring-offset-4" do %>
41
+ class: "inline-flex items-center gap-2 rounded-lg text-sm font-medium text-primary-strong transition hover:text-primary-strong focus:outline-none focus:ring-2 focus:ring-primary/30 focus:ring-offset-4" do %>
42
42
  <svg class="h-5 w-5" viewBox="0 0 20 20" fill="none" aria-hidden="true">
43
43
  <path d="m12.5 15-5-5 5-5" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"/>
44
44
  </svg>
@@ -57,7 +57,7 @@ Building a better future, one line of code at a time.
57
57
  ) %>
58
58
 
59
59
  <% if title.present? %>
60
- <h1 class="text-3xl font-semibold tracking-tight text-slate-900"><%= title %></h1>
60
+ <h1 class="text-3xl font-semibold tracking-tight text-neutral-900"><%= title %></h1>
61
61
  <% end %>
62
62
  </div>
63
63
 
@@ -67,7 +67,7 @@ Building a better future, one line of code at a time.
67
67
  </section>
68
68
 
69
69
  <aside class="lesli-auth-visual relative hidden min-h-screen overflow-hidden lg:col-span-2 lg:block" aria-hidden="true">
70
- <div class="absolute inset-0 bg-gradient-to-t from-slate-950/70 via-slate-900/10 to-transparent"></div>
70
+ <div class="absolute inset-0 bg-gradient-to-t from-neutral-900/70 via-neutral-900/10 to-transparent"></div>
71
71
  <div class="absolute inset-x-0 bottom-0 p-12 text-white">
72
72
  <p class="max-w-lg text-3xl font-semibold leading-tight">
73
73
  <%= I18n.t("lesli_shield.authentication.tagline", default: "A better way to manage your work.") %>
@@ -1,12 +1,12 @@
1
1
 
2
- <fieldset data-demo-credentials class="mb-8 rounded-xl border border-sky-200 bg-sky-50 px-4 pb-4 text-sm text-sky-950">
3
- <legend class="px-2 font-semibold text-sky-800">
4
- <%= I18n.t("lesli_shield.devise/sessions.demo_title") %>
2
+ <fieldset data-demo-credentials class="mb-8 rounded-xl border border-info-200 bg-info-50 px-4 pb-4 text-sm text-info-900">
3
+ <legend class="px-2 font-semibold text-info-800">
4
+ <%= I18n.t("lesli_shield.devise_sessions.demo_title") %>
5
5
  </legend>
6
6
  <dl class="mt-1 grid grid-cols-[auto_1fr] gap-x-3 gap-y-1">
7
- <dt class="font-medium"><%= I18n.t("lesli_shield.devise/sessions.demo_email") %>:</dt>
7
+ <dt class="font-medium"><%= I18n.t("lesli_shield.devise_sessions.demo_email") %>:</dt>
8
8
  <dd class="break-all"><%= credentials.fetch(:email) %></dd>
9
- <dt class="font-medium"><%= I18n.t("lesli_shield.devise/sessions.demo_password") %>:</dt>
9
+ <dt class="font-medium"><%= I18n.t("lesli_shield.devise_sessions.demo_password") %>:</dt>
10
10
  <dd><%= credentials.fetch(:password) %></dd>
11
11
  </dl>
12
12
  </fieldset>
@@ -1,6 +1,6 @@
1
1
  <% if flash[:notice] %>
2
2
  <div
3
- class="mb-6 rounded-lg border border-emerald-200 bg-emerald-50 px-4 py-3 text-left text-sm text-emerald-900"
3
+ class="mb-6 rounded-lg border border-success-200 bg-success-50 px-4 py-3 text-left text-sm text-success-900"
4
4
  role="status"
5
5
  aria-live="polite"
6
6
  data-turbo-cache="false"
@@ -11,7 +11,7 @@
11
11
 
12
12
  <% if flash[:success] %>
13
13
  <div
14
- class="mb-6 rounded-lg border border-emerald-200 bg-emerald-50 px-4 py-3 text-left text-sm text-emerald-900"
14
+ class="mb-6 rounded-lg border border-success-200 bg-success-50 px-4 py-3 text-left text-sm text-success-900"
15
15
  role="status"
16
16
  aria-live="polite"
17
17
  data-turbo-cache="false"
@@ -22,7 +22,7 @@
22
22
 
23
23
  <% if flash[:alert] %>
24
24
  <div
25
- class="mb-6 rounded-lg border border-rose-200 bg-rose-50 px-4 py-3 text-left text-sm text-rose-900"
25
+ class="mb-6 rounded-lg border border-danger-200 bg-danger-50 px-4 py-3 text-left text-sm text-danger-900"
26
26
  role="alert"
27
27
  data-turbo-cache="false"
28
28
  >
@@ -32,7 +32,7 @@
32
32
 
33
33
  <% if flash[:danger] %>
34
34
  <div
35
- class="mb-6 rounded-lg border border-rose-200 bg-rose-50 px-4 py-3 text-left text-sm text-rose-900"
35
+ class="mb-6 rounded-lg border border-danger-200 bg-danger-50 px-4 py-3 text-left text-sm text-danger-900"
36
36
  role="alert"
37
37
  data-turbo-cache="false"
38
38
  >
@@ -43,7 +43,7 @@
43
43
  <% if resource.errors.any? %>
44
44
  <div
45
45
  id="error_explanation"
46
- class="mb-6 rounded-lg border border-rose-200 bg-rose-50 px-4 py-3 text-left text-rose-900"
46
+ class="mb-6 rounded-lg border border-danger-200 bg-danger-50 px-4 py-3 text-left text-danger-900"
47
47
  role="alert"
48
48
  tabindex="-1"
49
49
  autofocus
@@ -1,9 +1,7 @@
1
- <%
2
- =begin
3
-
1
+ <%#
4
2
  Lesli
5
3
 
6
- Copyright (c) 2023, Lesli Technologies, S. A.
4
+ Copyright (c) 2026, Lesli Technologies, S. A.
7
5
 
8
6
  This program is free software: you can redistribute it and/or modify
9
7
  it under the terms of the GNU General Public License as published by
@@ -20,7 +18,7 @@ along with this program. If not, see http://www.gnu.org/licenses/.
20
18
 
21
19
  Lesli · Ruby on Rails SaaS Development Framework.
22
20
 
23
- Made with ♥ by https://www.lesli.tech
21
+ Made with ♥ by LesliTech
24
22
  Building a better future, one line of code at a time.
25
23
 
26
24
  @contact hello@lesli.tech
@@ -29,7 +27,6 @@ Building a better future, one line of code at a time.
29
27
 
30
28
  // · ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~ ~·~
31
29
  // ·
32
- =end
33
30
  %>
34
31
 
35
32
  <% login = defined?(login) ? login : false %>
@@ -44,7 +41,7 @@ Building a better future, one line of code at a time.
44
41
  <span class="icon mr-1">
45
42
  <span class="material-symbols-outlined" aria-hidden="true">login</span>
46
43
  </span>
47
- <span><%= I18n.t("lesli_shield.devise/shared.button_login") %></span>
44
+ <span><%= I18n.t("lesli_shield.devise_shared.button_login") %></span>
48
45
  <% end %>
49
46
  <% end %>
50
47
 
@@ -53,7 +50,7 @@ Building a better future, one line of code at a time.
53
50
  <span class="icon mr-2">
54
51
  <span class="material-symbols-outlined" aria-hidden="true">lock_reset</span>
55
52
  </span>
56
- <span><%= I18n.t("lesli_shield.devise/shared.button_reset_password") %></span>
53
+ <span><%= I18n.t("lesli_shield.devise_shared.button_reset_password") %></span>
57
54
  <% end %>
58
55
  <% end %>
59
56
 
@@ -61,14 +58,14 @@ Building a better future, one line of code at a time.
61
58
  <%# Dynamic check if instance allow users to login through magic links (passes) %>
62
59
  <%# if Rails.application.config.lesli.dig(:security, :enable_login_link) %>
63
60
  <% if magic_link %>
64
- <%= link_to("pass_path") do %>
61
+ <%= link_to(pass_path) do %>
65
62
  <span class="icon mr-1">
66
63
  <svg width="25" height="25" viewBox="0 0 25 25" fill="none" xmlns="http://www.w3.org/2000/svg">
67
- <path d="M17.5 7.25005H15.25C14.6748 7.25005 14.0996 7.34967 13.5498 7.52545C14.1748 8.00005 14.7002 8.57525 15.0996 9.25005H15.25H17.5C19.2998 9.25005 20.75 10.7003 20.75 12.5001C20.75 14.2999 19.2998 15.7501 17.5 15.7501H15.25C15.0996 15.7501 14.9248 15.7247 14.7754 15.7003H14.75C13.2002 15.4503 12 14.125 12 12.5C12 11.5 11.3496 10.6504 10.4502 10.375C10.1504 11.0254 10 11.75 10 12.5C10 15.4005 12.3496 17.75 15.25 17.75H17.5C20.4005 17.75 22.75 15.4004 22.75 12.5C22.75 9.5996 20.4004 7.25 17.5 7.25V7.25005Z" fill="#112A62"/>
68
- <path d="M9.9248 15.7502H7.5C5.7002 15.7502 4.25 14.3 4.25 12.5002C4.25 10.7004 5.7002 9.25024 7.5 9.25024H9.75C11.5498 9.25024 13 10.7004 13 12.5002C13 13.5002 13.6504 14.3498 14.5498 14.6252C14.8496 13.9748 15 13.2502 15 12.5002C15 9.59974 12.6504 7.25024 9.75 7.25024H7.5C4.5995 7.25024 2.25 9.59984 2.25 12.5002C2.25 15.4006 4.5996 17.7502 7.5 17.7502H9.75C10.3252 17.7502 10.9004 17.6506 11.4502 17.4504C10.8496 17.0002 10.3252 16.4006 9.9248 15.7502Z" fill="#112A62"/>
64
+ <path d="M17.5 7.25005H15.25C14.6748 7.25005 14.0996 7.34967 13.5498 7.52545C14.1748 8.00005 14.7002 8.57525 15.0996 9.25005H15.25H17.5C19.2998 9.25005 20.75 10.7003 20.75 12.5001C20.75 14.2999 19.2998 15.7501 17.5 15.7501H15.25C15.0996 15.7501 14.9248 15.7247 14.7754 15.7003H14.75C13.2002 15.4503 12 14.125 12 12.5C12 11.5 11.3496 10.6504 10.4502 10.375C10.1504 11.0254 10 11.75 10 12.5C10 15.4005 12.3496 17.75 15.25 17.75H17.5C20.4005 17.75 22.75 15.4004 22.75 12.5C22.75 9.5996 20.4004 7.25 17.5 7.25V7.25005Z" fill="currentColor"/>
65
+ <path d="M9.9248 15.7502H7.5C5.7002 15.7502 4.25 14.3 4.25 12.5002C4.25 10.7004 5.7002 9.25024 7.5 9.25024H9.75C11.5498 9.25024 13 10.7004 13 12.5002C13 13.5002 13.6504 14.3498 14.5498 14.6252C14.8496 13.9748 15 13.2502 15 12.5002C15 9.59974 12.6504 7.25024 9.75 7.25024H7.5C4.5995 7.25024 2.25 9.59984 2.25 12.5002C2.25 15.4006 4.5996 17.7502 7.5 17.7502H9.75C10.3252 17.7502 10.9004 17.6506 11.4502 17.4504C10.8496 17.0002 10.3252 16.4006 9.9248 15.7502Z" fill="currentColor"/>
69
66
  </svg>
70
67
  </span>
71
- <span><%= I18n.t("lesli_shield.devise/shared.button_magic_link") %></span>
68
+ <span><%= I18n.t("lesli_shield.devise_shared.button_magic_link") %></span>
72
69
  <% end %>
73
70
  <% end %>
74
71
 
@@ -79,11 +76,11 @@ Building a better future, one line of code at a time.
79
76
  <%= link_to("otp_path") do %>
80
77
  <span class="icon mr-1">
81
78
  <svg xmlns="http://www.w3.org/2000/svg" width="23" height="17" fill="none" viewBox="0 0 23.441 17.473">
82
- <path fill="#112a62" d="M6.253 2.41A6.253 6.253 0 0 0 .035 7.997a6.251 6.251 0 0 0 9.323 6.086 6.252 6.252 0 0 0 2.829-3.47h1.097v-.781h-.894a6.104 6.104 0 0 0 0-2.344h9.293l.879 1.172-.88 1.172h-.425l-1.055-1.059a.389.389 0 0 0-.554 0l-1.055 1.059h-.41l-.668-.997a.39.39 0 0 0-.649 0l-.668.997h-.57v.78h.781c.131 0 .252-.066.324-.175l.457-.684.457.684c.073.11.194.175.325.176h.78a.389.389 0 0 0 .278-.113l.895-.899.894.899a.388.388 0 0 0 .278.113h.78a.39.39 0 0 0 .313-.156l1.172-1.563a.39.39 0 0 0 0-.469L22.19 6.863a.39.39 0 0 0-.312-.156h-9.692A6.254 6.254 0 0 0 6.253 2.41Zm0 11.718c-.133 0-.261 0-.39-.02v-.76h.78v.76c-.128.02-.257.02-.39.02zM2.738 6.706h-.782v-.78h.782zm7.031-.78h.781v.78H9.77Zm-1.563 6.25h.782v.78h-.782zm-3.906.78H3.52v-.78H4.3zm6.25-1.562H9.77v-.781h.781ZM6.644 9.761v2.024h-.781V9.76a1.17 1.17 0 0 1-.711-.71H3.128v-.782h2.024a1.172 1.172 0 1 1 1.492 1.492zm-3.906 1.633h-.782v-.781h.782zm5.468-6.25v-.781h.782v.781zm-3.906 0H3.52v-.781H4.3zM1.566 8.269v.781H.804V8.27zm9.375.781V8.27h.781c0 .129.02.258.02.39 0 .133 0 .262-.02.391zM6.644 3.972h-.782v-.781h.781z"/>
83
- <path fill="#112a62" d="m.134 2.09.492.61a8.595 8.595 0 0 1 10.973.125l.508-.594a9.372 9.372 0 0 0-11.973-.14ZM.69 14.774l-.492.609a9.38 9.38 0 0 0 11.973-.14l-.508-.594a8.596 8.596 0 0 1-10.972.125zM9.767 11.786v-.781h.782v.781z"/>
79
+ <path fill="currentColor" d="M6.253 2.41A6.253 6.253 0 0 0 .035 7.997a6.251 6.251 0 0 0 9.323 6.086 6.252 6.252 0 0 0 2.829-3.47h1.097v-.781h-.894a6.104 6.104 0 0 0 0-2.344h9.293l.879 1.172-.88 1.172h-.425l-1.055-1.059a.389.389 0 0 0-.554 0l-1.055 1.059h-.41l-.668-.997a.39.39 0 0 0-.649 0l-.668.997h-.57v.78h.781c.131 0 .252-.066.324-.175l.457-.684.457.684c.073.11.194.175.325.176h.78a.389.389 0 0 0 .278-.113l.895-.899.894.899a.388.388 0 0 0 .278.113h.78a.39.39 0 0 0 .313-.156l1.172-1.563a.39.39 0 0 0 0-.469L22.19 6.863a.39.39 0 0 0-.312-.156h-9.692A6.254 6.254 0 0 0 6.253 2.41Zm0 11.718c-.133 0-.261 0-.39-.02v-.76h.78v.76c-.128.02-.257.02-.39.02zM2.738 6.706h-.782v-.78h.782zm7.031-.78h.781v.78H9.77Zm-1.563 6.25h.782v.78h-.782zm-3.906.78H3.52v-.78H4.3zm6.25-1.562H9.77v-.781h.781ZM6.644 9.761v2.024h-.781V9.76a1.17 1.17 0 0 1-.711-.71H3.128v-.782h2.024a1.172 1.172 0 1 1 1.492 1.492zm-3.906 1.633h-.782v-.781h.782zm5.468-6.25v-.781h.782v.781zm-3.906 0H3.52v-.781H4.3zM1.566 8.269v.781H.804V8.27zm9.375.781V8.27h.781c0 .129.02.258.02.39 0 .133 0 .262-.02.391zM6.644 3.972h-.782v-.781h.781z"/>
80
+ <path fill="currentColor" d="m.134 2.09.492.61a8.595 8.595 0 0 1 10.973.125l.508-.594a9.372 9.372 0 0 0-11.973-.14ZM.69 14.774l-.492.609a9.38 9.38 0 0 0 11.973-.14l-.508-.594a8.596 8.596 0 0 1-10.972.125zM9.767 11.786v-.781h.782v.781z"/>
84
81
  </svg>
85
82
  </span>
86
- <span><%= I18n.t("lesli_shield.devise/shared.button_one_time_password") %></span>
83
+ <span><%= I18n.t("lesli_shield.devise_shared.button_one_time_password") %></span>
87
84
  <% end %>
88
85
  <% end %>
89
86
  </div>
@@ -1,10 +1,67 @@
1
- <%= form_with(model: @invite, builder: LesliView::Forms::Builder) do |form| %>
1
+ <%
2
+ role_errors = (@invite.errors[:role_id] + @invite.errors[:role])
3
+ .to_sentence
4
+ .presence
5
+ %>
6
+
7
+ <%= form_with(
8
+ model: @invite,
9
+ builder: LesliView::Forms::Builder,
10
+ html: { class: "space-y-6" }
11
+ ) do |form| %>
2
12
  <%= form.fieldset do %>
3
- <%= form.field_control_email(:email) %>
4
- <%= form.field_control(:full_name) %>
5
- <%= form.field_control(:telephone) %>
6
- <%= form.field_control_textarea_rich(:notes) %>
7
- <hr/>
8
- <%= form.field_control_submit %>
13
+ <%= form.field_control_email(
14
+ :email,
15
+ label: I18n.t("lesli_shield.invites.field_email"),
16
+ message: @invite.errors[:email].to_sentence.presence,
17
+ category: @invite.errors[:email].any? ? :danger : nil,
18
+ autocomplete: "email",
19
+ required: true
20
+ ) %>
21
+
22
+ <%= form.field_control(
23
+ :full_name,
24
+ label: "#{I18n.t("lesli_shield.invites.field_name")} " \
25
+ "(#{I18n.t("lesli_shield.invites.field_optional")})",
26
+ message: @invite.errors[:full_name].to_sentence.presence ||
27
+ I18n.t("lesli_shield.invites.field_name_hint"),
28
+ category: @invite.errors[:full_name].any? ? :danger : nil,
29
+ autocomplete: "name"
30
+ ) %>
31
+
32
+ <%= form.field_control_select(
33
+ :role_id,
34
+ @assignable_roles.pluck(:name, :id),
35
+ label: I18n.t("lesli_shield.invites.field_role"),
36
+ message: role_errors,
37
+ category: role_errors.present? ? :danger : nil,
38
+ humanize: false,
39
+ options: {
40
+ prompt: I18n.t("lesli_shield.invites.role_prompt")
41
+ },
42
+ html_options: { required: true }
43
+ ) %>
44
+
45
+ <%= form.field_control_textarea(
46
+ :notes,
47
+ label: "#{I18n.t("lesli_shield.invites.field_message")} " \
48
+ "(#{I18n.t("lesli_shield.invites.field_optional")})",
49
+ message: @invite.errors[:notes].to_sentence.presence ||
50
+ I18n.t("lesli_shield.invites.field_message_hint"),
51
+ category: @invite.errors[:notes].any? ? :danger : nil,
52
+ rows: 5
53
+ ) %>
54
+
55
+ <%= form.field_control_button(
56
+ I18n.t("lesli_shield.invites.button_create_and_send"),
57
+ {
58
+ class: "w-full sm:w-auto",
59
+ data: {
60
+ turbo_submits_with: I18n.t(
61
+ "lesli_shield.invites.button_creating_and_sending"
62
+ )
63
+ }
64
+ }
65
+ ) %>
9
66
  <% end %>
10
67
  <% end %>
@@ -1,2 +1,55 @@
1
- <div id="<%= dom_id invite %>">
2
- </div>
1
+ <%
2
+ format_time = lambda do |value|
3
+ value.present? ? I18n.l(value, format: :long) : "—"
4
+ end
5
+
6
+ inviter_name = invite.invited_by.full_name.to_s.strip.presence ||
7
+ invite.invited_by.email
8
+
9
+ details = [
10
+ [I18n.t("lesli_shield.invites.detail_email"), invite.email],
11
+ [
12
+ I18n.t("lesli_shield.invites.detail_name"),
13
+ invite.full_name.presence || I18n.t("lesli_shield.invites.value_not_available")
14
+ ],
15
+ [
16
+ I18n.t("lesli_shield.invites.detail_role"),
17
+ invite.role&.name || I18n.t("lesli_shield.invites.value_not_available")
18
+ ],
19
+ [I18n.t("lesli_shield.invites.detail_invited_by"), inviter_name],
20
+ [I18n.t("lesli_shield.invites.detail_sent_at"), format_time.call(invite.sent_at)],
21
+ [I18n.t("lesli_shield.invites.detail_expires_at"), format_time.call(invite.expires_at)],
22
+ [I18n.t("lesli_shield.invites.detail_accepted_at"), format_time.call(invite.accepted_at)],
23
+ [I18n.t("lesli_shield.invites.detail_cancelled_at"), format_time.call(invite.cancelled_at)]
24
+ ]
25
+ %>
26
+
27
+ <article id="<%= dom_id invite %>" class="overflow-hidden rounded-2xl border border-neutral-200 bg-white shadow-sm">
28
+ <div class="flex flex-col gap-3 border-b border-neutral-200 bg-neutral-50 px-6 py-5 sm:flex-row sm:items-center sm:justify-between">
29
+ <div>
30
+ <p class="text-sm font-medium text-neutral-500">
31
+ <%= I18n.t("lesli_shield.invites.detail_recipient") %>
32
+ </p>
33
+ <p class="mt-1 text-lg font-semibold text-neutral-900">
34
+ <%= invite.full_name.presence || invite.email %>
35
+ </p>
36
+ </div>
37
+ <%= render "status_badge", invite: invite %>
38
+ </div>
39
+
40
+ <dl class="grid grid-cols-1 sm:grid-cols-2">
41
+ <% details.each do |label, value| %>
42
+ <div class="border-b border-neutral-100 px-6 py-5 sm:odd:border-r">
43
+ <dt class="text-sm font-medium text-neutral-500"><%= label %></dt>
44
+ <dd class="mt-1 break-words text-sm font-semibold text-neutral-900"><%= value %></dd>
45
+ </div>
46
+ <% end %>
47
+ </dl>
48
+
49
+ <div class="px-6 py-5">
50
+ <h2 class="text-sm font-medium text-neutral-500">
51
+ <%= I18n.t("lesli_shield.invites.detail_message") %>
52
+ </h2>
53
+ <p class="mt-2 whitespace-pre-wrap text-sm leading-6 text-neutral-700"><%= invite.notes.presence || "—" %></p>
54
+ </div>
55
+ </article>
@@ -0,0 +1,34 @@
1
+ <%
2
+ show_view = local_assigns.fetch(:show_view, false)
3
+ action_classes = "inline-flex h-9 items-center justify-center rounded-lg border px-3 text-xs font-semibold transition focus:outline-none focus:ring-4"
4
+ %>
5
+
6
+ <div class="flex flex-wrap items-center gap-2">
7
+ <% if show_view %>
8
+ <%= link_to I18n.t("lesli_shield.invites.action_view"),
9
+ invite_path(invite),
10
+ class: "#{action_classes} border-neutral-200 bg-white text-neutral-700 hover:bg-neutral-50 focus:ring-neutral-500/10" %>
11
+ <% end %>
12
+
13
+ <% if invite.resend_available? %>
14
+ <%= button_to I18n.t("lesli_shield.invites.action_resend"),
15
+ resend_invite_path(invite),
16
+ method: :post,
17
+ form: { class: "inline" },
18
+ class: "#{action_classes} border-primary-muted bg-primary-soft text-primary-strong hover:border-primary focus:ring-primary/20",
19
+ data: {
20
+ turbo_confirm: I18n.t("lesli_shield.invites.confirm_resend")
21
+ } %>
22
+ <% end %>
23
+
24
+ <% if invite.cancellable? %>
25
+ <%= button_to I18n.t("lesli_shield.invites.action_cancel"),
26
+ cancel_invite_path(invite),
27
+ method: :patch,
28
+ form: { class: "inline" },
29
+ class: "#{action_classes} border-danger-200 bg-danger-50 text-danger-700 hover:bg-danger-100 focus:ring-danger-500/10",
30
+ data: {
31
+ turbo_confirm: I18n.t("lesli_shield.invites.confirm_cancel")
32
+ } %>
33
+ <% end %>
34
+ </div>
@@ -0,0 +1,13 @@
1
+ <%
2
+ status = invite.lifecycle_status
3
+ status_classes = {
4
+ "pending" => "bg-warning-50 text-warning-700 ring-warning-600/20",
5
+ "accepted" => "bg-success-50 text-success-700 ring-success-600/20",
6
+ "cancelled" => "bg-neutral-100 text-neutral-600 ring-neutral-500/20",
7
+ "expired" => "bg-danger-50 text-danger-700 ring-danger-600/20"
8
+ }
9
+ %>
10
+
11
+ <span class="inline-flex items-center rounded-full px-2.5 py-1 text-xs font-semibold ring-1 ring-inset <%= status_classes.fetch(status) %>">
12
+ <%= I18n.t("lesli_shield.invites.statuses_#{status}") %>
13
+ </span>