Looking good. Webauthn integration time!!

This commit is contained in:
Jez Caudle 2024-05-22 09:54:22 +01:00
parent 0edc7d0563
commit ba3392fb47
11 changed files with 75 additions and 92 deletions

View File

@ -70,6 +70,7 @@ body, html{
height: 100%; height: 100%;
scroll-behavior: smooth; scroll-behavior: smooth;
padding:1rem; padding:1rem;
font-family:sans-serif;
} }
/* /*
@ -89,12 +90,19 @@ menu > li {
flex-grow: 1; flex-grow: 1;
} }
.domain, .mfa { main, .flash {
background-color: #efefef; background-color: #efefef;
border-radius:1rem; border-radius:1rem;
padding:1rem; padding:1rem;
} }
.domain-header, .mfa-header {
.flash {
background-color: #dfcedf;
margin-bottom:1rem;
text-align: center;
}
.domain-header, .mfa-header, h2 {
background-color: #fefefe; background-color: #fefefe;
border-radius:1rem; border-radius:1rem;
padding:1rem 1rem; padding:1rem 1rem;
@ -108,7 +116,7 @@ menu > li {
scale: 75%; scale: 75%;
} }
.email-list, .domain-list, .mfa-list { .email-list, .domain-list, .mfa-list, .work-area {
border-radius:1rem; border-radius:1rem;
border:1rem black; border:1rem black;
background-color:#e7eae7; background-color:#e7eae7;
@ -116,6 +124,17 @@ menu > li {
margin:1rem 0; margin:1rem 0;
} }
.work-area input {
padding:0.5rem;
margin:0.5rem;
}
.work-area label {
padding:0.5rem;
margin:0.5rem;
}
.email-list li { .email-list li {
display: flex; display: flex;
margin:0.3rem 1rem; margin:0.3rem 1rem;
@ -130,6 +149,7 @@ footer {
background-color:#efefef; background-color:#efefef;
padding:1rem; padding:1rem;
border-radius:1rem; border-radius:1rem;
text-align:center;
} }
footer ul, footer h3 , footer li { footer ul, footer h3 , footer li {

View File

@ -1,4 +1,4 @@
<%= form_with(model: [@domain, credential]) do |form| %> <%= form_with(model: [@domain, credential], html: { class: "work-area"}) do |form| %>
<% if credential.errors.any? %> <% if credential.errors.any? %>
<div style="color: red"> <div style="color: red">
<h2><%= pluralize(credential.errors.count, "error") %> prohibited this credential from being saved:</h2> <h2><%= pluralize(credential.errors.count, "error") %> prohibited this credential from being saved:</h2>
@ -11,17 +11,12 @@
</div> </div>
<% end %> <% end %>
<div> <%= form.label :email %>:<%= form.text_field :email %>@<%=@domain.domain%>
<%= form.label :email, style: "display: inline" %> @<%=@domain.domain%> <br/>
<%= form.text_field :email %> <%= form.label :password %>:<%= form.text_field :password %>
</div> <br/>
<div>
<%= form.label :password, style: "display: block" %>
<%= form.text_field :password %>
</div>
<div> <%= form.submit "Create email" %>
<%= form.submit %>
</div>
<% end %> <% end %>

View File

@ -1,9 +1,7 @@
<h1>New credential</h1> <h2>New email for <%= @domain.domain %></h2>
<%= render "form", credential: @credential %> <%= render "form", credential: @credential %>
<br> <br>
<div> <%= link_to "Back to the domain", domain_path(@domain) %>
<%= link_to "Back to the domain", domain_path(@domain) %>
</div>

View File

@ -1,41 +1,29 @@
<h2>Edit <%= resource_name.to_s.humanize %></h2> <h2>Edit <%= resource_name.to_s.humanize %></h2>
<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put }) do |f| %> <%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: { method: :put, class: 'work-area' }) do |f| %>
<%= render "devise/shared/error_messages", resource: resource %> <%= render "devise/shared/error_messages", resource: resource %>
<div class="field"> <%= f.label :email %>:<%= f.email_field :email, autofocus: true, autocomplete: "email" %>
<%= f.label :email %><br />
<%= f.email_field :email, autofocus: true, autocomplete: "email" %>
</div>
<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %> <% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
<div>Currently waiting confirmation for: <%= resource.unconfirmed_email %></div> <div>Currently waiting confirmation for: <%= resource.unconfirmed_email %></div>
<% end %> <% end %>
<div class="field"> <br/>
<%= f.label :password %> <i>(leave blank if you don't want to change it)</i><br /> <%= f.label :password %>:<%= f.password_field :password, autocomplete: "new-password" %>
<%= f.password_field :password, autocomplete: "new-password" %> <% if @minimum_password_length %><em><%= @minimum_password_length %> characters minimum</em><% end %> <i>(leave blank if you don't want to change it)</i>
<% if @minimum_password_length %>
<br />
<em><%= @minimum_password_length %> characters minimum</em>
<% end %>
</div>
<div class="field"> <br/>
<%= f.label :password_confirmation %><br /> <%= f.label :password_confirmation %>:<%= f.password_field :password_confirmation, autocomplete: "new-password" %>
<%= f.password_field :password_confirmation, autocomplete: "new-password" %>
</div>
<div class="field"> <br/>
<%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i><br /> <%= f.label :current_password %>:<%= f.password_field :current_password, autocomplete: "current-password" %>
<%= f.password_field :current_password, autocomplete: "current-password" %> <br/><i>(we need your current password to confirm your changes)</i>
</div>
<div class="actions"> <br/>
<%= f.submit "Update" %> <%= f.submit "Update" %>
</div>
<% end %> <% end %>
<hr/>
<% if current_user.otp_secret.to_s.size == 0 %> <% if current_user.otp_secret.to_s.size == 0 %>
<%= link_to "Enable MFA", new_mfa_path %> <%= link_to "Enable MFA", new_mfa_path %>

View File

@ -1,32 +1,22 @@
<h2>Log in</h2> <h2>Log in</h2>
<div class="black asap m-l3">
<%= form_for(resource, as: resource_name, url: session_path(resource_name), class: "p-10 border shadow br-b-8 md-w-50pc mx-auto") do |f| %>
<div class="flex flex-column">
<%= f.label :email, class: "my-2" %>
<%= f.email_field :email, autofocus: true, autocomplete: "email", class:"input" %>
</div>
<div class="flex flex-column mt-3"> <%= form_for(resource, as: resource_name, url: session_path(resource_name), html: { class: "work-area" } ) do |f| %>
<%= f.label :password, class: "my-2" %>
<%= f.password_field :password, autocomplete: "current-password", class: "input" %>
</div>
<div class="flex flex-column mt-3"> <%= f.label :email %>:<%= f.email_field :email, autofocus: true, autocomplete: "email", class:"input" %>
<%= f.label :otp_attempt, class: "my-2" %> <br/>
<%= f.password_field :otp_attempt, autocomplete: "OTP Code", class: "input" %> <%= f.label :password %>:<%= f.password_field :password, autocomplete: "current-password", class: "input" %>
</div> <br/>
<%= f.label :otp_attempt %>:<%= f.password_field :otp_attempt, autocomplete: "OTP Code", class: "input" %>
<br/>
<% if devise_mapping.rememberable? %> <% if devise_mapping.rememberable? %>
<div class="flex flex-items-center mt-4"> <%= f.label :remember_me %><%= f.check_box :remember_me %>
<%= f.check_box :remember_me, class: "checkbox mr-3" %>
<%= f.label :remember_me, class: "form-check-label" %>
</div>
<% end %> <% end %>
<div class="mt-4"> <br/>
<%= f.submit "Log in", class: "button" %> <%= f.submit "Log in", class: "button" %>
</div>
<% end %> <% end %>
</div>
<%= render "devise/shared/links" %> <%= render "devise/shared/links" %>

View File

@ -1,4 +1,4 @@
<%= form_with(model: domain) do |form| %> <%= form_with(model: domain, html: { class: "work-area" }) do |form| %>
<% if domain.errors.any? %> <% if domain.errors.any? %>
<div style="color: red"> <div style="color: red">
<h2><%= pluralize(domain.errors.count, "error") %> prohibited this domain from being saved:</h2> <h2><%= pluralize(domain.errors.count, "error") %> prohibited this domain from being saved:</h2>

View File

@ -1,9 +1,9 @@
<h1>New domain</h1> <h2>New domain</h2>
<%= render "form", domain: @domain %> <%= render "form", domain: @domain %>
<br> <br>
<div>
<%= link_to "Back to domains", domains_path %> <%= link_to "Back to domains", domains_path %>
</div>

View File

@ -19,11 +19,9 @@
<br/> <br/>
</div> </div>
<% if notice %><div class="flash"><%= notice %></div><% end %><% if alert %><div class="flash"><%= alert %></div><% end %>
<main> <main>
<% if notice %><div class=""><%= notice %></div><% end %>
<% if alert %><div class=""><%= alert %></div><% end %>
<%= yield %> <%= yield %>
</main> </main>
<% if Rails.env == "development" %> <% if Rails.env == "development" %>

View File

@ -1,4 +1,4 @@
<%= form_with(model: [@domain,virtual]) do |form| %> <%= form_with(model: [@domain,virtual], html: { class: "work-area"}) do |form| %>
<% if virtual.errors.any? %> <% if virtual.errors.any? %>
<div style="color: red"> <div style="color: red">
<h2><%= pluralize(virtual.errors.count, "error") %> prohibited this virtual from being saved:</h2> <h2><%= pluralize(virtual.errors.count, "error") %> prohibited this virtual from being saved:</h2>
@ -11,17 +11,12 @@
</div> </div>
<% end %> <% end %>
<div> <%= form.label :email%>:<%= form.text_field :email %>@<%=@domain.domain%>
<%= form.label :email, style: "display: block" %> <br/>
<%= form.text_field :email %>
</div>
<div> <%= form.label :destination %>:<%= form.text_field :destination %>
<%= form.label :destination, style: "display: block" %> <br/>
<%= form.text_field :destination %>
</div>
<div>
<%= form.submit %> <%= form.submit %>
</div>
<% end %> <% end %>

View File

@ -1,9 +1,8 @@
<h1>New virtual for <%= @domain.domain %></h1> <h2>New virtual for <%= @domain.domain %></h2>
<%= render "form", virtual: @virtual %> <%= render "form", virtual: @virtual %>
<br> <br>
<div> <%= link_to "Back to #{@domain.domain}", domain_path(@domain) %>
<%= link_to "Back to #{@domain.domain}", domain_path(@domain) %>
</div>

View File

@ -232,7 +232,7 @@ Devise.setup do |config|
# When set to false, does not sign a user in automatically after their password is # When set to false, does not sign a user in automatically after their password is
# reset. Defaults to true, so a user is signed in automatically after a reset. # reset. Defaults to true, so a user is signed in automatically after a reset.
# config.sign_in_after_reset_password = true config.sign_in_after_reset_password = false
# ==> Configuration for :encryptable # ==> Configuration for :encryptable
# Allow you to use another hashing or encryption algorithm besides bcrypt (default). # Allow you to use another hashing or encryption algorithm besides bcrypt (default).