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%;
scroll-behavior: smooth;
padding:1rem;
font-family:sans-serif;
}
/*
@ -89,12 +90,19 @@ menu > li {
flex-grow: 1;
}
.domain, .mfa {
main, .flash {
background-color: #efefef;
border-radius: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;
border-radius:1rem;
padding:1rem 1rem;
@ -108,7 +116,7 @@ menu > li {
scale: 75%;
}
.email-list, .domain-list, .mfa-list {
.email-list, .domain-list, .mfa-list, .work-area {
border-radius:1rem;
border:1rem black;
background-color:#e7eae7;
@ -116,6 +124,17 @@ menu > li {
margin:1rem 0;
}
.work-area input {
padding:0.5rem;
margin:0.5rem;
}
.work-area label {
padding:0.5rem;
margin:0.5rem;
}
.email-list li {
display: flex;
margin:0.3rem 1rem;
@ -130,6 +149,7 @@ footer {
background-color:#efefef;
padding:1rem;
border-radius:1rem;
text-align:center;
}
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? %>
<div style="color: red">
<h2><%= pluralize(credential.errors.count, "error") %> prohibited this credential from being saved:</h2>
@ -11,17 +11,12 @@
</div>
<% end %>
<div>
<%= form.label :email, style: "display: inline" %> @<%=@domain.domain%>
<%= form.text_field :email %>
</div>
<%= form.label :email %>:<%= form.text_field :email %>@<%=@domain.domain%>
<br/>
<%= form.label :password %>:<%= form.text_field :password %>
<br/>
<div>
<%= form.label :password, style: "display: block" %>
<%= form.text_field :password %>
</div>
<div>
<%= form.submit %>
</div>
<%= form.submit "Create email" %>
<% end %>

View File

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

View File

@ -1,41 +1,29 @@
<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 %>
<div class="field">
<%= f.label :email %><br />
<%= f.email_field :email, autofocus: true, autocomplete: "email" %>
</div>
<%= f.label :email %>:<%= f.email_field :email, autofocus: true, autocomplete: "email" %>
<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
<div>Currently waiting confirmation for: <%= resource.unconfirmed_email %></div>
<% end %>
<div class="field">
<%= f.label :password %> <i>(leave blank if you don't want to change it)</i><br />
<%= f.password_field :password, autocomplete: "new-password" %>
<% if @minimum_password_length %>
<br/>
<em><%= @minimum_password_length %> characters minimum</em>
<% end %>
</div>
<%= f.label :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>
<div class="field">
<%= f.label :password_confirmation %><br />
<%= f.password_field :password_confirmation, autocomplete: "new-password" %>
</div>
<br/>
<%= f.label :password_confirmation %>:<%= f.password_field :password_confirmation, autocomplete: "new-password" %>
<div class="field">
<%= f.label :current_password %> <i>(we need your current password to confirm your changes)</i><br />
<%= f.password_field :current_password, autocomplete: "current-password" %>
</div>
<br/>
<%= f.label :current_password %>:<%= f.password_field :current_password, autocomplete: "current-password" %>
<br/><i>(we need your current password to confirm your changes)</i>
<div class="actions">
<br/>
<%= f.submit "Update" %>
</div>
<% end %>
<hr/>
<% if current_user.otp_secret.to_s.size == 0 %>
<%= link_to "Enable MFA", new_mfa_path %>

View File

@ -1,32 +1,22 @@
<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">
<%= f.label :password, class: "my-2" %>
<%= f.password_field :password, autocomplete: "current-password", class: "input" %>
</div>
<%= form_for(resource, as: resource_name, url: session_path(resource_name), html: { class: "work-area" } ) do |f| %>
<div class="flex flex-column mt-3">
<%= f.label :otp_attempt, class: "my-2" %>
<%= f.password_field :otp_attempt, autocomplete: "OTP Code", class: "input" %>
</div>
<%= f.label :email %>:<%= f.email_field :email, autofocus: true, autocomplete: "email", class:"input" %>
<br/>
<%= f.label :password %>:<%= f.password_field :password, autocomplete: "current-password", class: "input" %>
<br/>
<%= f.label :otp_attempt %>:<%= f.password_field :otp_attempt, autocomplete: "OTP Code", class: "input" %>
<br/>
<% if devise_mapping.rememberable? %>
<div class="flex flex-items-center mt-4">
<%= f.check_box :remember_me, class: "checkbox mr-3" %>
<%= f.label :remember_me, class: "form-check-label" %>
</div>
<%= f.label :remember_me %><%= f.check_box :remember_me %>
<% end %>
<div class="mt-4">
<br/>
<%= f.submit "Log in", class: "button" %>
</div>
<% end %>
</div>
<%= 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? %>
<div style="color: red">
<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 %>
<br>
<div>
<%= link_to "Back to domains", domains_path %>
</div>

View File

@ -19,11 +19,9 @@
<br/>
</div>
<% if notice %><div class="flash"><%= notice %></div><% end %><% if alert %><div class="flash"><%= alert %></div><% end %>
<main>
<% if notice %><div class=""><%= notice %></div><% end %>
<% if alert %><div class=""><%= alert %></div><% end %>
<%= yield %>
</main>
<% 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? %>
<div style="color: red">
<h2><%= pluralize(virtual.errors.count, "error") %> prohibited this virtual from being saved:</h2>
@ -11,17 +11,12 @@
</div>
<% end %>
<div>
<%= form.label :email, style: "display: block" %>
<%= form.text_field :email %>
</div>
<%= form.label :email%>:<%= form.text_field :email %>@<%=@domain.domain%>
<br/>
<div>
<%= form.label :destination, style: "display: block" %>
<%= form.text_field :destination %>
</div>
<%= form.label :destination %>:<%= form.text_field :destination %>
<br/>
<div>
<%= form.submit %>
</div>
<% 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 %>
<br>
<div>
<%= 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
# 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
# Allow you to use another hashing or encryption algorithm besides bcrypt (default).