111 lines
5.3 KiB
Plaintext
111 lines
5.3 KiB
Plaintext
<!--<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>
|
|
-->
|
|
<% content_for :title, "E-Mail-Adresse ändern" %>
|
|
|
|
<div class="max-w-2xl mx-auto space-y-6">
|
|
|
|
<%= render "identity/account_tabs", active_tab: :email %>
|
|
|
|
<!-- Info-Header -->
|
|
<div class="bg-white border border-gray-200 rounded-xl shadow-sm p-6 flex flex-col sm:flex-row items-start sm:items-center gap-4">
|
|
<div class="p-3 bg-blue-50 text-blue-600 rounded-lg shrink-0">
|
|
<svg class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
|
<path stroke-linecap="round" stroke-linejoin="round" d="M21.75 6.75v10.5a2.25 2.25 0 0 1-2.25 2.25h-15a2.25 2.25 0 0 1-2.25-2.25V6.75m19.5 0A2.25 2.25 0 0 0 19.5 4.5h-15a2.25 2.25 0 0 0-2.25 2.25m19.5 0v.243a2.25 2.25 0 0 1-1.07 1.916l-7.5 4.615a2.25 2.25 0 0 1-2.36 0l-7.5-4.615a2.25 2.25 0 0 1-1.07-1.916V6.75" />
|
|
</svg>
|
|
</div>
|
|
<div>
|
|
<h2 class="text-lg font-bold text-gray-800">E-Mail-Adresse aktualisieren</h2>
|
|
<p class="text-sm text-gray-500">Ändere deine primäre Login-Adresse. Aus Sicherheitsgründen musst du diese Aktion mit deinem Passwort bestätigen.</p>
|
|
</div>
|
|
</div>
|
|
|
|
<%= form_with(url: identity_email_path, method: :patch, class: "bg-white border border-gray-200 rounded-xl shadow-sm p-6 md:p-8 space-y-6") do |form| %>
|
|
<!-- Fehleranzeige bei falschem Passwort oder ungültiger Mail -->
|
|
<% if Current.user.errors.any? %>
|
|
<div class="p-4 text-sm text-red-800 rounded-lg bg-red-50 border border-red-200" role="alert">
|
|
<h3 class="font-bold mb-1">Fehler beim Aktualisieren:</h3>
|
|
<ul class="list-disc list-inside text-xs">
|
|
<% Current.user.errors.full_messages.each do |message| %>
|
|
<li><%= message %></li>
|
|
<% end %>
|
|
</ul>
|
|
</div>
|
|
<% end %>
|
|
|
|
<!-- Feld 1: Neue E-Mail-Adresse -->
|
|
<div>
|
|
<%= form.label :email, "Neue E-Mail-Adresse", class: "block text-sm font-medium mb-1.5 text-gray-700" %>
|
|
<div class="relative rounded-md shadow-sm">
|
|
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
|
|
<svg class="h-5 w-5 text-gray-400" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
|
<path stroke-linecap="round" stroke-linejoin="round" d="M21.75 6.75v10.5a2.25 2.25 0 0 1-2.25 2.25h-15a2.25 2.25 0 0 1-2.25-2.25V6.75m19.5 0A2.25 2.25 0 0 0 19.5 4.5h-15a2.25 2.25 0 0 0-2.25 2.25m19.5 0v.243a2.25 2.25 0 0 1-1.07 1.916l-7.5 4.615a2.25 2.25 0 0 1-2.36 0l-7.5-4.615a2.25 2.25 0 0 1-1.07-1.916V6.75" />
|
|
</svg>
|
|
</div>
|
|
<%= form.email_field :email, value: Current.user.email, required: true, autofocus: true, autocomplete: "email", class: "block w-full pl-10 pr-3 py-2.5 border border-gray-300 rounded-lg text-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 bg-gray-50/50" %>
|
|
</div>
|
|
</div>
|
|
|
|
<!-- Feld 2: Passwort zur Bestätigung -->
|
|
<div>
|
|
<%= form.label :password_challenge, "Aktuelles Passwort zur Bestätigung", class: "block text-sm font-medium mb-1.5 text-gray-700" %>
|
|
<div class="relative rounded-md shadow-sm">
|
|
<div class="absolute inset-y-0 left-0 pl-3 flex items-center pointer-events-none">
|
|
<svg class="h-5 w-5 text-gray-400" fill="none" viewBox="0 0 24 24" stroke-width="1.5" stroke="currentColor">
|
|
<path stroke-linecap="round" stroke-linejoin="round" d="M16.5 10.5V6.75a4.5 4.5 0 1 0-9 0v3.75m-.75 11.25h10.5a2.25 2.25 0 0 0 2.25-2.25v-6.75a2.25 2.25 0 0 0-2.25-2.25H6.75a2.25 2.25 0 0 0-2.25 2.25v6.75a2.25 2.25 0 0 0 2.25 2.25z" />
|
|
</svg>
|
|
</div>
|
|
<%= form.password_field :password_challenge, required: true, autocomplete: "current-password", class: "block w-full pl-10 pr-3 py-2.5 border border-gray-300 rounded-lg text-sm focus:outline-none focus:ring-blue-500 focus:border-blue-500 bg-gray-50/50" %>
|
|
</div>
|
|
</div>
|
|
|
|
<hr class="border-gray-200">
|
|
|
|
<!-- Abschicken-Button -->
|
|
<div class="flex justify-end">
|
|
<%= form.submit "E-Mail-Adresse speichern", class: "py-2.5 px-5 text-sm font-semibold rounded-lg bg-blue-600 text-white hover:bg-blue-700 shadow-sm transition cursor-pointer" %>
|
|
</div>
|
|
<% end %>
|
|
</div>
|