Installed authentication-zero
Some checks are pending
CI / scan_ruby (push) Waiting to run
CI / scan_js (push) Waiting to run
CI / lint (push) Waiting to run
CI / test (push) Waiting to run

This commit is contained in:
2024-08-17 21:18:23 +02:00
parent cbe55aee36
commit c4b96a43e4
44 changed files with 988 additions and 10 deletions

View File

@@ -0,0 +1,23 @@
<p style="color: green"><%= notice %></p>
<p>Signed as <%= Current.user.email %></p>
<h2>Login and verification</h2>
<div>
<%= link_to "Change password", edit_password_path %>
</div>
<div>
<%= link_to "Change email address", edit_identity_email_path %>
</div>
<h2>Access history</h2>
<div>
<%= link_to "Devices & Sessions", sessions_path %>
</div>
<br>
<%= button_to "Log out", Current.session, method: :delete %>

View File

@@ -0,0 +1,43 @@
<p style="color: red"><%= alert %></p>
<% if Current.user.verified? %>
<h1>Change your email</h1>
<% else %>
<h1>Verify your email</h1>
<p>We sent a verification email to the address below. Check that email and follow those instructions to confirm it's your email address.</p>
<p><%= button_to "Re-send verification email", identity_email_verification_path %></p>
<% end %>
<%= form_with(url: identity_email_path, method: :patch) do |form| %>
<% if @user.errors.any? %>
<div style="color: red">
<h2><%= pluralize(@user.errors.count, "error") %> prohibited this user from being saved:</h2>
<ul>
<% @user.errors.each do |error| %>
<li><%= error.full_message %></li>
<% end %>
</ul>
</div>
<% end %>
<div>
<%= form.label :email, "New email", style: "display: block" %>
<%= form.email_field :email, required: true, autofocus: true %>
</div>
<div>
<%= form.label :password_challenge, style: "display: block" %>
<%= form.password_field :password_challenge, required: true, autocomplete: "current-password" %>
</div>
<div>
<%= form.submit "Save changes" %>
</div>
<% end %>
<br>
<div>
<%= link_to "Back", root_path %>
</div>

View File

@@ -0,0 +1,32 @@
<h1>Reset your password</h1>
<%= form_with(url: identity_password_reset_path, method: :patch) do |form| %>
<% if @user.errors.any? %>
<div style="color: red">
<h2><%= pluralize(@user.errors.count, "error") %> prohibited this user from being saved:</h2>
<ul>
<% @user.errors.each do |error| %>
<li><%= error.full_message %></li>
<% end %>
</ul>
</div>
<% end %>
<%= form.hidden_field :sid, value: params[:sid] %>
<div>
<%= form.label :password, "New password", style: "display: block" %>
<%= form.password_field :password, required: true, autofocus: true, autocomplete: "new-password" %>
<div>12 characters minimum.</div>
</div>
<div>
<%= form.label :password_confirmation, "Confirm new password", style: "display: block" %>
<%= form.password_field :password_confirmation, required: true, autocomplete: "new-password" %>
</div>
<div>
<%= form.submit "Save changes" %>
</div>
<% end %>

View File

@@ -0,0 +1,14 @@
<p style="color: red"><%= alert %></p>
<h1>Forgot your password?</h1>
<%= form_with(url: identity_password_reset_path) do |form| %>
<div>
<%= form.label :email, style: "display: block" %>
<%= form.email_field :email, required: true, autofocus: true %>
</div>
<div>
<%= form.submit "Send password reset email" %>
</div>
<% end %>

View File

@@ -0,0 +1,43 @@
<p style="color: red"><%= alert %></p>
<h1>Change your password</h1>
<%= form_with(url: password_path, method: :patch) do |form| %>
<% if @user.errors.any? %>
<div style="color: red">
<h2><%= pluralize(@user.errors.count, "error") %> prohibited this user from being saved:</h2>
<ul>
<% @user.errors.each do |error| %>
<li><%= error.full_message %></li>
<% end %>
</ul>
</div>
<% end %>
<div>
<%= form.label :password_challenge, style: "display: block" %>
<%= form.password_field :password_challenge, required: true, autofocus: true, autocomplete: "current-password" %>
</div>
<div>
<%= form.label :password, "New password", style: "display: block" %>
<%= form.password_field :password, required: true, autocomplete: "new-password" %>
<div>12 characters minimum.</div>
</div>
<div>
<%= form.label :password_confirmation, "Confirm new password", style: "display: block" %>
<%= form.password_field :password_confirmation, required: true, autocomplete: "new-password" %>
</div>
<div>
<%= form.submit "Save changes" %>
</div>
<% end %>
<br>
<div>
<%= link_to "Back", root_path %>
</div>

View File

@@ -0,0 +1,35 @@
<h1>Sign up</h1>
<%= form_with(url: sign_up_path) do |form| %>
<% if @user.errors.any? %>
<div style="color: red">
<h2><%= pluralize(@user.errors.count, "error") %> prohibited this user from being saved:</h2>
<ul>
<% @user.errors.each do |error| %>
<li><%= error.full_message %></li>
<% end %>
</ul>
</div>
<% end %>
<div>
<%= form.label :email, style: "display: block" %>
<%= form.email_field :email, value: @user.email, required: true, autofocus: true, autocomplete: "email" %>
</div>
<div>
<%= form.label :password, style: "display: block" %>
<%= form.password_field :password, required: true, autocomplete: "new-password" %>
<div>12 characters minimum.</div>
</div>
<div>
<%= form.label :password_confirmation, style: "display: block" %>
<%= form.password_field :password_confirmation, required: true, autocomplete: "new-password" %>
</div>
<div>
<%= form.submit "Sign up" %>
</div>
<% end %>

View File

@@ -0,0 +1,34 @@
<p style="color: green"><%= notice %></p>
<h1>Devices & Sessions</h1>
<div id="sessions">
<% @sessions.each do |session| %>
<div id="<%= dom_id session %>">
<p>
<strong>User Agent:</strong>
<%= session.user_agent %>
</p>
<p>
<strong>Ip Address:</strong>
<%= session.ip_address %>
</p>
<p>
<strong>Created at:</strong>
<%= session.created_at %>
</p>
</div>
<p>
<%= button_to "Log out", session, method: :delete %>
</p>
<% end %>
</div>
<br>
<div>
<%= link_to "Back", root_path %>
</div>

View File

@@ -0,0 +1,30 @@
<p style="color: green"><%= notice %></p>
<p style="color: red"><%= alert %></p>
<h1>Sign in</h1>
<%= form_with(url: sign_in_path) do |form| %>
<div>
<%= form.label :email, style: "display: block" %>
<%= form.email_field :email, value: params[:email_hint], required: true, autofocus: true, autocomplete: "email" %>
</div>
<div>
<%= form.label :password, style: "display: block" %>
<%= form.password_field :password, required: true, autocomplete: "current-password" %>
</div>
<div>
<%= form.submit "Sign in" %>
</div>
<% end %>
<br>
<br>
<div>
<%= link_to "Sign up", sign_up_path %> |
<%= link_to "Forgot your password?", new_identity_password_reset_path %>
</div>

View File

@@ -0,0 +1,11 @@
<p>Hey there,</p>
<p>This is to confirm that <%= @user.email %> is the email you want to use on your account. If you ever lose your password, that's where we'll email a reset link.</p>
<p><strong>You must hit the link below to confirm that you received this email.</strong></p>
<p><%= link_to "Yes, use this email for my account", identity_email_verification_url(sid: @signed_id) %></p>
<hr>
<p>Have questions or need help? Just reply to this email and our support team will help you sort it out.</p>

View File

@@ -0,0 +1,11 @@
<p>Hey there,</p>
<p>Can't remember your password for <strong><%= @user.email %></strong>? That's OK, it happens. Just hit the link below to set a new one.</p>
<p><%= link_to "Reset my password", edit_identity_password_reset_url(sid: @signed_id) %></p>
<p>If you did not request a password reset you can safely ignore this email, it expires in 20 minutes. Only someone with access to this email account can reset your password.</p>
<hr>
<p>Have questions or need help? Just reply to this email and our support team will help you sort it out.</p>