masks 0.3.2 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (71) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/builds/masks/application.css +1 -1
  3. data/app/assets/builds/masks/application.js +90 -3
  4. data/app/assets/builds/masks/application.js.map +4 -4
  5. data/app/assets/javascripts/controllers/application.js +1 -1
  6. data/app/assets/javascripts/controllers/index.js +9 -0
  7. data/app/assets/javascripts/controllers/table_controller.js +15 -0
  8. data/app/assets/stylesheets/application.css +12 -4
  9. data/app/controllers/concerns/masks/controller.rb +1 -1
  10. data/app/controllers/masks/manage/actors_controller.rb +72 -1
  11. data/app/controllers/masks/manage/base_controller.rb +10 -2
  12. data/app/controllers/masks/manage/clients_controller.rb +84 -0
  13. data/app/controllers/masks/manage/dashboard_controller.rb +15 -0
  14. data/app/controllers/masks/manage/devices_controller.rb +19 -0
  15. data/app/controllers/masks/openid/authorizations_controller.rb +45 -0
  16. data/app/controllers/masks/openid/discoveries_controller.rb +55 -0
  17. data/app/controllers/masks/openid/tokens_controller.rb +45 -0
  18. data/app/controllers/masks/openid/userinfo_controller.rb +28 -0
  19. data/app/controllers/masks/sessions_controller.rb +1 -1
  20. data/app/models/concerns/masks/access.rb +2 -2
  21. data/app/models/masks/access/actor_password.rb +2 -1
  22. data/app/models/masks/access/actor_signup.rb +1 -2
  23. data/app/models/masks/credentials/access_token.rb +60 -0
  24. data/app/models/masks/credentials/key.rb +1 -1
  25. data/app/models/masks/credentials/return_to.rb +27 -0
  26. data/app/models/masks/mask.rb +12 -1
  27. data/app/models/masks/openid/authorization.rb +116 -0
  28. data/app/models/masks/openid/token.rb +56 -0
  29. data/app/models/masks/rails/actor.rb +23 -1
  30. data/app/models/masks/rails/openid/access_token.rb +55 -0
  31. data/app/models/masks/rails/openid/authorization.rb +45 -0
  32. data/app/models/masks/rails/openid/client.rb +186 -0
  33. data/app/models/masks/rails/openid/id_token.rb +43 -0
  34. data/app/models/masks/sessions/access.rb +2 -1
  35. data/app/resources/masks/session_resource.rb +1 -1
  36. data/app/views/layouts/masks/manage.html.erb +22 -5
  37. data/app/views/masks/actor_mailer/recover_credentials.html.erb +2 -3
  38. data/app/views/masks/actor_mailer/verify_email.html.erb +2 -3
  39. data/app/views/masks/actors/current.html.erb +7 -14
  40. data/app/views/masks/application/_header.html.erb +3 -4
  41. data/app/views/masks/backup_codes/new.html.erb +34 -20
  42. data/app/views/masks/emails/new.html.erb +14 -8
  43. data/app/views/masks/keys/new.html.erb +7 -7
  44. data/app/views/masks/manage/actors/index.html.erb +101 -37
  45. data/app/views/masks/manage/{actor → actors}/show.html.erb +63 -17
  46. data/app/views/masks/manage/clients/index.html.erb +102 -0
  47. data/app/views/masks/manage/clients/show.html.erb +156 -0
  48. data/app/views/masks/manage/dashboard/index.html.erb +10 -0
  49. data/app/views/masks/manage/devices/index.html.erb +47 -0
  50. data/app/views/masks/one_time_code/new.html.erb +41 -24
  51. data/app/views/masks/openid/authorizations/error.html.erb +23 -0
  52. data/app/views/masks/openid/authorizations/new.html.erb +46 -0
  53. data/app/views/masks/passwords/edit.html.erb +20 -7
  54. data/app/views/masks/recoveries/new.html.erb +2 -4
  55. data/app/views/masks/recoveries/password.html.erb +2 -3
  56. data/app/views/masks/sessions/new.html.erb +22 -23
  57. data/config/initializers/inflections.rb +5 -0
  58. data/config/locales/en.yml +23 -2
  59. data/config/routes.rb +40 -3
  60. data/db/migrate/20240329182422_support_openid.rb +64 -0
  61. data/lib/generators/masks/install/templates/masks.json +4 -1
  62. data/lib/masks/configuration.rb +22 -9
  63. data/lib/masks/version.rb +1 -1
  64. data/lib/masks.rb +1 -0
  65. data/lib/tasks/masks_tasks.rake +2 -2
  66. data/masks.json +44 -6
  67. metadata +59 -11
  68. data/app/assets/builds/application.css +0 -4764
  69. data/app/assets/builds/application.js +0 -8236
  70. data/app/assets/builds/application.js.map +0 -7
  71. data/app/controllers/masks/manage/actor_controller.rb +0 -35
@@ -52,7 +52,6 @@
52
52
  </div>
53
53
  </div>
54
54
 
55
-
56
55
  <div class="divider text-xs">
57
56
  <%= t(".credentials") %>
58
57
  </div>
@@ -64,9 +63,8 @@
64
63
  <%= t(".password") %>
65
64
  </span>
66
65
  <a
67
- href="<%= password_path %>"
68
- class="btn btn-sm btn-ghost hover:btn-secondary"
69
- >
66
+ href="<%= password_path %>"
67
+ class="btn btn-sm btn-ghost hover:btn-secondary">
70
68
  <%= t(".change") %>
71
69
  </a>
72
70
  </div>
@@ -83,16 +81,14 @@
83
81
  </span>
84
82
  <a
85
83
  href="<%= one_time_codes_path %>"
86
- class="btn btn-sm btn-ghost hover:btn-secondary"
87
- >
84
+ class="btn btn-sm btn-ghost hover:btn-secondary">
88
85
  <%= @actor.totp_secret ? t(".manage") : t(".enable") %>
89
86
  </a>
90
87
  </div>
91
88
 
92
89
  <% if @actor.factor2? %>
93
90
  <div
94
- class="alert text-left flex items-center gap-4 <%= @actor.saved_backup_codes? ? 'bg-neutral' : 'bg-base-100' %>"
95
- >
91
+ class="alert text-left flex items-center gap-4 <%= @actor.saved_backup_codes? ? 'bg-neutral' : 'bg-base-100' %>">
96
92
  <% if @actor.saved_backup_codes? %>
97
93
  <%= lucide_icon("check-circle-2", class: "stroke-success") %>
98
94
  <% else %>
@@ -103,16 +99,14 @@
103
99
  </span>
104
100
  <a
105
101
  href="<%= backup_codes_path %>"
106
- class="btn btn-sm btn-ghost hover:btn-secondary"
107
- >
102
+ class="btn btn-sm btn-ghost hover:btn-secondary">
108
103
  <%= @actor.saved_backup_codes? ? t(".manage") : t(".enable") %>
109
104
  </a>
110
105
  </div>
111
106
  <% end %>
112
107
 
113
108
  <div
114
- class="alert text-left flex items-center gap-4 <%= @actor.keys.any? ? 'bg-neutral' : 'bg-base-100' %>"
115
- >
109
+ class="alert text-left flex items-center gap-4 <%= @actor.keys.any? ? 'bg-neutral' : 'bg-base-100' %>">
116
110
  <% if @actor.keys.any? %>
117
111
  <%= lucide_icon("check-circle-2", class: "stroke-success") %>
118
112
  <% else %>
@@ -123,8 +117,7 @@
123
117
  </span>
124
118
  <a
125
119
  href="<%= keys_path %>"
126
- class="btn btn-sm btn-ghost hover:btn-secondary"
127
- >
120
+ class="btn btn-sm btn-ghost hover:btn-secondary">
128
121
  <%= @actor.keys.any? ? t(".add_more_key") : t(".add_key") %>
129
122
  </a>
130
123
  </div>
@@ -2,12 +2,11 @@
2
2
  <div class="flex-1">
3
3
  <% if @config.site_url %>
4
4
  <a
5
- href="<%=@config.site_url%>"
6
- class="text-xl flex items-center gap-3 hover:underline"
7
- >
5
+ href="<%= @config.site_url %>"
6
+ class="text-xl flex items-center gap-3 hover:underline">
8
7
  <% if @config.site_logo %>
9
8
  <div class="w-7 h-7 overflow-hidden">
10
- <img src="<%=@config.site_logo%>"/>
9
+ <img src="<%= @config.site_logo %>">
11
10
  </div>
12
11
  <% else %>
13
12
  <%= lucide_icon("lock") %>
@@ -44,25 +44,32 @@
44
44
  <%= form_with url: backup_codes_path, method: :post, class: 'w-full' do |form| %>
45
45
  <div class="divider my-2"></div>
46
46
  <div class="flex items-center mb-2 gap-4">
47
- <%= lucide_icon("shield-check") %>
48
- <div class="flex items-center gap-4">
47
+ <label class="flex gap-3 items-center w-full flex-grow input input-bordered" data-controller="password-visibility">
48
+ <%= lucide_icon("shield-check") %>
49
+
49
50
  <input
50
51
  type="password"
51
- name="session[password]"
52
+ data-password-visibility-target="input"
53
+ spellcheck="false"
52
54
  placeholder="<%= t('.placeholder.password') %>"
53
- class="input w-full"
54
- />
55
+ name="session[password]"
56
+ class="w-full flex-grow">
57
+
58
+ <button data-action="password-visibility#toggle" type="button" class="btn btn-sm btn-ghost -mr-2">
59
+ <span data-password-visibility-target="icon"><%= lucide_icon('eye') %></span>
60
+ <span data-password-visibility-target="icon" class="hidden"><%= lucide_icon('eye-off') %></span>
61
+ </button>
62
+ </label>
55
63
  <%= form.submit t(".enable"),
56
64
  name: "backup_codes[enable]",
57
65
  class: "btn btn-secondary",
58
66
  data: {
59
67
  one_time_code_target: "submit",
60
68
  } %>
61
- </div>
62
69
  </div>
63
70
  <% end %>
64
71
  <% else %>
65
- <div class="alert bg-neutral my-4">
72
+ <div class="alert bg-neutral my-4 flex items-center gap-4">
66
73
  <%= lucide_icon("download", class: "stroke-success") %>
67
74
 
68
75
  <span>
@@ -74,28 +81,35 @@
74
81
 
75
82
  <div class="join join-vertical">
76
83
  <div class="join-item bg-base-100 flex gap-3 alert">
77
- <span class="text-sm">
84
+ <span class="text-sm text-left">
78
85
  <%= t(".reset_codes") %>
79
86
  </span>
80
87
  </div>
81
88
 
82
89
  <%= form_with url: backup_codes_path, method: :post, class: 'w-full' do |form| %>
83
90
  <div class="alert join-item flex items-center gap-4">
84
- <%= lucide_icon("shield-check") %>
85
- <div class="flex items-center gap-4">
91
+ <label class="flex gap-3 items-center w-full flex-grow input input-bordered" data-controller="password-visibility">
92
+ <%= lucide_icon("shield-check") %>
93
+
86
94
  <input
87
95
  type="password"
88
- name="session[password]"
96
+ data-password-visibility-target="input"
97
+ spellcheck="false"
89
98
  placeholder="<%= t('.placeholder.password') %>"
90
- class="input input-sm w-full"
91
- />
92
- <%= form.submit t(".delete"),
93
- name: "backup_codes[reset]",
94
- class: "btn btn-sm btn-outline hover:btn-error",
95
- data: {
96
- one_time_code_target: "submit",
97
- } %>
98
- </div>
99
+ name="session[password]"
100
+ class="w-full flex-grow">
101
+
102
+ <button data-action="password-visibility#toggle" type="button" class="btn btn-sm btn-ghost -mr-2">
103
+ <span data-password-visibility-target="icon"><%= lucide_icon('eye') %></span>
104
+ <span data-password-visibility-target="icon" class="hidden"><%= lucide_icon('eye-off') %></span>
105
+ </button>
106
+ </label>
107
+ <%= form.submit t(".delete"),
108
+ name: "backup_codes[reset]",
109
+ class: "btn btn-sm btn-outline hover:btn-error",
110
+ data: {
111
+ one_time_code_target: "submit",
112
+ } %>
99
113
  </div>
100
114
  <% end %>
101
115
  </div>
@@ -37,7 +37,7 @@
37
37
  <% elsif email.expired? %>
38
38
  <%= t(".expired_verification") %>
39
39
  <%= form_with url: emails_path, method: :patch do |form| %>
40
- <input type="hidden" name="email[value]" value="<%= email.email %>"/>
40
+ <input type="hidden" name="email[value]" value="<%= email.email %>">
41
41
  <button type="submit" class="underline">
42
42
  <%= t(".resend") %>
43
43
  </button>
@@ -48,7 +48,7 @@
48
48
  </span>
49
49
  </span>
50
50
  <%= form_with url: emails_path, method: :delete, class: 'flex items-center gap-4' do |form| %>
51
- <input type="hidden" name="email[value]" value="<%= email.email %>"/>
51
+ <input type="hidden" name="email[value]" value="<%= email.email %>">
52
52
  <button type="submit">
53
53
  <%= lucide_icon("x", class: "stroke-error") %>
54
54
  </button>
@@ -68,7 +68,7 @@
68
68
  <% end %>
69
69
  <div class=" <%= @emails.empty? ? 'mt-2' : '' %>">
70
70
  <%= form_with url: emails_path, method: :post, class: 'pt-2 flex flex-col gap-2', data: { emails_target: 'add' } do |form| %>
71
- <label class="flex gap-4 items-center">
71
+ <label class="flex gap-4 items-center input input-bordered">
72
72
  <%= lucide_icon("mail-plus") %>
73
73
  <input
74
74
  type="text"
@@ -76,20 +76,26 @@
76
76
  data-action="emails#updateEmail"
77
77
  placeholder="<%= t('.placeholder.email', count: @emails.length) %>"
78
78
  name="email[value]"
79
- class="input w-full"
80
- />
79
+ class="w-full">
81
80
  </label>
82
81
  <div class="flex items-center gap-2">
83
- <label class="flex gap-4 items-center">
82
+ <label class="flex gap-3 items-center w-full flex-grow input input-bordered" data-controller="password-visibility">
84
83
  <%= lucide_icon("shield-check") %>
84
+
85
85
  <input
86
86
  type="password"
87
87
  data-emails-target="password"
88
88
  data-action="emails#updatePassword"
89
+ data-password-visibility-target="input"
90
+ spellcheck="false"
89
91
  placeholder="<%= t('.placeholder.password') %>"
90
92
  name="session[password]"
91
- class="input w-full"
92
- />
93
+ class="w-full flex-grow">
94
+
95
+ <button data-action="password-visibility#toggle" type="button" class="btn btn-sm btn-ghost -mr-2">
96
+ <span data-password-visibility-target="icon"><%= lucide_icon('eye') %></span>
97
+ <span data-password-visibility-target="icon" class="hidden"><%= lucide_icon('eye-off') %></span>
98
+ </button>
93
99
  </label>
94
100
  <%= form.submit t(".submit"),
95
101
  class: "btn btn-info",
@@ -15,7 +15,7 @@
15
15
  <%= lucide_icon('check') %>
16
16
  <div>
17
17
  <h3 class="font-bold">created "<%= flash[:key]['name'] %>"</h3>
18
- <div class="text-xs">keep the secret somewhere safe:<br /><span class="font-mono"><%= flash[:key]['secret'] %></span></div>
18
+ <div class="text-xs">keep the secret somewhere safe:<br><span class="font-mono"><%= flash[:key]['secret'] %></span></div>
19
19
  </div>
20
20
  </div>
21
21
  <% elsif flash[:notice] %>
@@ -40,20 +40,20 @@
40
40
  <%= lucide_icon('key') %>
41
41
  </div>
42
42
 
43
- <input type="text" name="key[name]" placeholder="<%= t('.placeholder.name') %>" class="input input-bordered input-sm w-full" />
43
+ <input type="text" name="key[name]" placeholder="<%= t('.placeholder.name') %>" class="input input-bordered input-sm w-full">
44
44
 
45
45
  <button class="w-4 h-4 flex items-center" data-action="keys#toggleSettings">
46
46
  <%= lucide_icon('settings-2') %>
47
47
  </button>
48
48
 
49
- <%= form.submit t('.add'), class: 'btn btn-sm' %>
49
+ <%= form.submit t('.add'), class: 'btn btn-sm' %>
50
50
  </div>
51
51
 
52
52
  <div class="bg-base-200 join-item p-4 max-h-[260px] overflow-auto <%= @actor.keys.any? ? 'hidden' : '' %>" data-keys-target="settings">
53
53
  <div class="font-bold text-sm mb-2">
54
54
  secret
55
55
  </div>
56
- <input type="password" name="key[secret]" placeholder="<%= t('.placeholder.secret') %>" class="input input-bordered input-sm w-full" />
56
+ <input type="password" name="key[secret]" placeholder="<%= t('.placeholder.secret') %>" class="input input-bordered input-sm w-full">
57
57
 
58
58
  <% if @actor.scopes.any? %>
59
59
  <div class="font-bold text-sm my-4 mb-2">
@@ -63,13 +63,13 @@
63
63
  <div class="form-control w-full">
64
64
  <label class="cursor-pointer label">
65
65
  <span class="label-text font-mono"><%= scope %></span>
66
- <input type="checkbox" class="toggle toggle-success toggle-sm" name="key[scopes][]" value="<%= scope %>" />
66
+ <input type="checkbox" class="toggle toggle-success toggle-sm" name="key[scopes][]" value="<%= scope %>">
67
67
  </label>
68
68
  </div>
69
69
  <% end %>
70
70
  <% end %>
71
71
  </div>
72
- <% end%>
72
+ <% end %>
73
73
 
74
74
  <% if @actor.keys.any? %>
75
75
  <div class="">
@@ -109,7 +109,7 @@
109
109
  </td>
110
110
  <td class="whitespace-nowrap">
111
111
  <%= form_with(url: keys_path, method: :delete) do |form| %>
112
- <input type="hidden" name="id" value="<%= key.id %>" />
112
+ <input type="hidden" name="id" value="<%= key.id %>">
113
113
 
114
114
  <button class="btn btn-circle btn-ghost btn-xs" type="submit">
115
115
  <span class="flex items-center w-4 h-4">
@@ -1,40 +1,104 @@
1
- <h1 class="text-sm font-bold mb-4 mt-0 divider">
2
- actors
3
- </h1>
4
-
5
- <div class="overflow-x-auto">
6
- <table class="table bg-base-100">
7
- <!-- head -->
8
- <thead>
9
- <tr>
10
- <th>name</th>
11
- <th>last login</th>
12
- <th></th>
13
- </tr>
14
- </thead>
15
- <tbody>
16
- <% @actors.each do |actor| %>
1
+ <div data-controller="dialog" data-action="click->dialog#backdropClose">
2
+ <div class="mb-6 flex items-center gap-2">
3
+ <%= lucide_icon('user', class: 'w-5 h-5') %>
4
+
5
+ <h1 class="font-bold flex-grow">
6
+ actors
7
+ </h1>
8
+ <button class="btn btn-sm btn-ghost btn-primary" data-action="dialog#open">
9
+ <span class="">
10
+ <%= lucide_icon('plus-square', class: 'w-5 h-5') %>
11
+ </span>
12
+
13
+ new
14
+ </button>
15
+ </div>
16
+
17
+ <% if flash[:errors]&.any? %>
18
+ <div role="alert" class="alert alert-error mb-4 mt-0">
19
+ <%= lucide_icon('x-circle') %>
20
+ <div>
21
+ <h3 class="font-bold">failed to add actor...</h3>
22
+ <ul class="list-disc pl-4">
23
+ <% flash[:errors].each do |error| %>
24
+ <li><%= error %></li>
25
+ <% end %>
26
+ </ul>
27
+ </div>
28
+ </div>
29
+ <% end %>
30
+
31
+ <dialog class="modal" data-dialog-target="dialog">
32
+ <div class="modal-box">
33
+ <form method="dialog">
34
+ <button class="btn btn-sm btn-circle btn-ghost absolute right-2 top-2"><%= lucide_icon('x') %></button>
35
+ </form>
36
+
37
+ <h3 class="mb-4 ml-1 font-bold flex items-center gap-2">
38
+ <%= lucide_icon('user-plus', size: 16) %>
39
+ new actor
40
+ </h3>
41
+
42
+ <%= form_with url: manage_actors_path, method: :post do |form| %>
43
+ <label class="form-control input input-bordered flex flex-row gap-4 items-center flex-grow mb-2">
44
+ nickname
45
+
46
+ <input placeholder="enter a name for the client..." type="text" name="nickname" class="grow" />
47
+ </label>
48
+
49
+ <label class="form-control input input-bordered w-full flex flex-row items-center gap-4 mb-4" data-controller="password-visibility">
50
+ password
51
+
52
+ <input
53
+ type="password"
54
+ data-password-visibility-target="input"
55
+ spellcheck="false"
56
+ placeholder="enter a password..."
57
+ name="password"
58
+ class="flex-grow">
59
+
60
+ <button data-action="password-visibility#toggle" type="button" class="btn btn-sm btn-ghost -mr-2">
61
+ <span data-password-visibility-target="icon"><%= lucide_icon('eye') %></span>
62
+ <span data-password-visibility-target="icon" class="hidden"><%= lucide_icon('eye-off') %></span>
63
+ </button>
64
+ </label>
65
+
66
+ <div class="modal-actions">
67
+ <input type="submit" class="btn btn-sm btn-success" value="save" />
68
+ </div>
69
+ <% end %>
70
+ </div>
71
+ </dialog>
72
+
73
+ <div class="overflow-x-auto">
74
+ <table class="table bg-base-100">
75
+ <!-- head -->
76
+ <thead>
17
77
  <tr>
18
- <td>
19
- <div class="flex items-center gap-3">
20
- <div class="avatar">
21
- <div class="mask mask-squircle w-6 h-6 p-0.5 bg-neutral box-border">
22
- <%= lucide_icon('user', class: 'w-5 h-5') %>
23
- </div>
24
- </div>
25
- <div class="font-bold"><%= actor.nickname %></div>
26
- </div>
27
- </td>
28
- <td class="text-xs whitespace-nowrap">
29
- <%= time_ago_in_words(actor.last_login_at) %> ago
30
- </td>
31
- <td class="text-right">
32
- <a href="<%= actor_path(actor) %>" class="btn btn-ghost btn-xs">manage</a>
33
- </td>
78
+ <th>name</th>
79
+ <th class="text-right">last login</th>
34
80
  </tr>
35
- <% end %>
36
- </tbody>
37
- </table>
38
- </div>
81
+ </thead>
82
+ <tbody>
83
+ <% @actors.each do |actor| %>
84
+ <tr data-action="click->table#click" data-controller="table" class="cursor-pointer">
85
+ <td>
86
+ <a data-table-target="url" href="<%= manage_actor_path(actor) %>" class="font-bold"><%= actor.nickname %></a>
87
+ </td>
88
+ <td class="text-xs whitespace-nowrap text-right">
89
+ <% if actor.last_login_at %>
90
+ <%= time_ago_in_words(actor.last_login_at) %> ago
91
+ <% else %>
92
+ never logged in
93
+ <% end %>
94
+ </td>
95
+ </tr>
96
+ <% end %>
97
+ </tbody>
98
+ </table>
99
+ </div>
39
100
 
40
- <%== pagy_nav(@pagy) %>
101
+ <% if @pagy.pages > 1 %>
102
+ <%== pagy_nav(@pagy) %>
103
+ <% end%>
104
+ </div>
@@ -1,18 +1,30 @@
1
1
  <div class="flex flex-col gap-1 mb-4">
2
2
  <div class="flex items-center gap-2">
3
- <div class="avatar">
4
- <div class="mask mask-squircle w-6 h-6 p-0.5 bg-neutral box-border">
5
- <%= lucide_icon('user', class: 'w-5 h-5') %>
6
- </div>
7
- </div>
3
+ <%= lucide_icon('user', class: 'w-5 h-5') %>
8
4
 
9
5
  <div class="text-xl font-bold">
10
6
  <%= @actor.nickname %>
11
7
  </div>
12
8
  </div>
9
+ </div>
13
10
 
11
+ <% if flash[:info] %>
12
+ <div role="alert" class="alert alert-info mb-4 mt-0 flex items-center">
13
+ <%= lucide_icon('info') %>
14
+ <div>
15
+ <h3 class="font-bold"><%= flash[:info] %></h3>
16
+ </div>
17
+ </div>
18
+ <% end %>
14
19
 
15
- </div>
20
+ <% if flash[:error] %>
21
+ <div role="alert" class="alert alert-error mb-4 mt-0 flex items-center">
22
+ <%= lucide_icon('alert-triangle') %>
23
+ <div>
24
+ <h3 class="font-bold"><%= flash[:error] %></h3>
25
+ </div>
26
+ </div>
27
+ <% end %>
16
28
 
17
29
  <div class="bg-base-300 flex flex-col gap-4 p-4 rounded-xl mb-4">
18
30
  <div class="flex items-center gap-4">
@@ -21,7 +33,7 @@
21
33
  <div class="text-sm flex-grow">
22
34
  <b class="text-neutral-content">last login</b> <%= time_ago_in_words(@actor.last_login_at) %> ago
23
35
  </div>
24
- <%= form_with url: actor_path(@actor), method: :patch do |form| %>
36
+ <%= form_with url: manage_actor_path(@actor), method: :patch do |form| %>
25
37
  <input type="submit" class="btn hover:btn-error btn-xs" name="logout" value="logout">
26
38
  <% end %>
27
39
  <% else %>
@@ -31,7 +43,7 @@
31
43
  <% end %>
32
44
  </div>
33
45
 
34
- <div class="flex items-center gap-4">
46
+ <div class="flex items-center gap-4" data-controller="dialog" data-action="click->dialog#backdropClose">
35
47
  <%= lucide_icon('unlock', class: 'w-4 h-4') %>
36
48
  <div class="text-sm flex-grow">
37
49
  <% if @actor.changed_password_at %>
@@ -41,9 +53,43 @@
41
53
  <% end %>
42
54
  </div>
43
55
 
44
- <%= form_with url: actor_path(@actor), method: :patch do |form| %>
45
- <input type="submit" class="btn hover:btn-error btn-xs" name="reset_password" value="reset">
46
- <% end %>
56
+ <button data-action="dialog#open" type="button" class="btn hover:btn-error btn-xs">
57
+ change
58
+ </button>
59
+
60
+ <dialog class="modal" data-dialog-target="dialog">
61
+ <div class="modal-box">
62
+ <form method="dialog">
63
+ <button class="btn btn-sm btn-circle btn-ghost absolute right-2 top-2"><%= lucide_icon('x') %></button>
64
+ </form>
65
+
66
+ <h3 class="mb-4 font-bold flex items-center gap-2">
67
+ <%= lucide_icon('lock-keyhole', size: 16) %>
68
+ change password
69
+ </h3>
70
+
71
+ <%= form_with url: manage_actor_path(@actor), method: :patch do |form| %>
72
+ <label class="form-control input input-bordered w-full flex flex-row items-center gap-2 mb-4" data-controller="password-visibility">
73
+ <input
74
+ type="password"
75
+ data-password-visibility-target="input"
76
+ spellcheck="false"
77
+ placeholder="enter a new password..."
78
+ name="change_password"
79
+ class="flex-grow">
80
+
81
+ <button data-action="password-visibility#toggle" type="button" class="btn btn-sm btn-ghost -mr-2">
82
+ <span data-password-visibility-target="icon"><%= lucide_icon('eye') %></span>
83
+ <span data-password-visibility-target="icon" class="hidden"><%= lucide_icon('eye-off') %></span>
84
+ </button>
85
+ </label>
86
+
87
+ <div class="modal-actions">
88
+ <input type="submit" class="btn btn-sm btn-success" value="change" />
89
+ </div>
90
+ <% end %>
91
+ </div>
92
+ </dialog>
47
93
  </div>
48
94
 
49
95
  <div class="flex items-center gap-4">
@@ -53,7 +99,7 @@
53
99
 
54
100
  </div>
55
101
  <% if @actor.factor2? %>
56
- <%= form_with url: actor_path(@actor), method: :patch do |form| %>
102
+ <%= form_with url: manage_actor_path(@actor), method: :patch do |form| %>
57
103
  <input type="submit" class="btn hover:btn-error btn-xs" name="remove_factor2" value="remove">
58
104
  <% end %>
59
105
  <% end %>
@@ -81,7 +127,7 @@
81
127
  <tr>
82
128
  <td class="italic" colspan="2">no emails added...</td>
83
129
  </tr>
84
- <% end%>
130
+ <% end %>
85
131
  </tbody>
86
132
  </table>
87
133
  </div>
@@ -98,11 +144,11 @@
98
144
  <tbody>
99
145
  <tr>
100
146
  <td colspan="2">
101
- <%= form_with url: actor_path(@actor), method: :patch do |form| %>
147
+ <%= form_with url: manage_actor_path(@actor), method: :patch do |form| %>
102
148
  <div class="flex items-center gap-2">
103
149
  <%= lucide_icon('plus-square', class: 'text-base-300-content') %>
104
- <input type="text" name="add_scope" class="flex-grow input input-sm" placeholder="add a scope..." />
105
- <input type="submit" class="btn btn-sm" value="add" />
150
+ <input type="text" name="add_scope" class="flex-grow input input-sm" placeholder="add a scope...">
151
+ <input type="submit" class="btn btn-sm" value="add">
106
152
  </div>
107
153
  <% end %>
108
154
  </td>
@@ -111,7 +157,7 @@
111
157
  <tr>
112
158
  <td class="font-mono w-full"><%= scope %></td>
113
159
  <td class="">
114
- <%= form_with url: actor_path(@actor), method: :patch do |form| %>
160
+ <%= form_with url: manage_actor_path(@actor), method: :patch do |form| %>
115
161
  <input type="hidden" name="remove_scope" value="<%= scope %>">
116
162
 
117
163
  <button type="submit" class="btn btn-ghost btn-error hover:btn-outline btn-xs">