92 lines
3.7 KiB
Plaintext
92 lines
3.7 KiB
Plaintext
<div class="container">
|
|
<div class="row justify-content-center">
|
|
<div class="col-md-8">
|
|
<% if alert = flash[:alert] %>
|
|
<div class="alert alert-danger alert-dismissible fade show" role="alert">
|
|
<%= alert %>
|
|
<button type="button" class="btn-close" data-bs-dismiss="alert"></button>
|
|
</div>
|
|
<% end %>
|
|
|
|
<div class="card">
|
|
<div class="card-header">
|
|
<h3 class="card-title mb-0">Account Settings</h3>
|
|
</div>
|
|
<div class="card-body">
|
|
<!-- User Info -->
|
|
<div class="mb-4">
|
|
<h5>Profile Information</h5>
|
|
<table class="table table-sm">
|
|
<tr>
|
|
<th>Email:</th>
|
|
<td><%= @user.email_address %></td>
|
|
</tr>
|
|
<tr>
|
|
<th>Role:</th>
|
|
<td><span class="badge bg-<%= @user.admin? ? 'danger' : @user.viewer? ? 'info' : 'primary' %>"><%= @user.role %></span></td>
|
|
</tr>
|
|
<tr>
|
|
<th>Authentication:</th>
|
|
<td>
|
|
<% if @user.password_digest.present? %>
|
|
<span class="badge bg-success">Local Password</span>
|
|
<% else %>
|
|
<span class="badge bg-info">OIDC</span>
|
|
<% end %>
|
|
</td>
|
|
</tr>
|
|
<tr>
|
|
<th>Active Sessions:</th>
|
|
<td><%= @user.sessions.count %></td>
|
|
</tr>
|
|
<tr>
|
|
<th>Member Since:</th>
|
|
<td><%= @user.created_at.strftime('%B %d, %Y') %></td>
|
|
</tr>
|
|
</table>
|
|
</div>
|
|
|
|
<% if @user.password_digest.present? %>
|
|
<!-- Password Change Form -->
|
|
<div class="border-top pt-4">
|
|
<h5>Change Password</h5>
|
|
<p class="text-muted">Changing your password will log you out of all other devices.</p>
|
|
|
|
<%= form_with model: @user, url: password_path, method: :patch, class: "row g-3" do |form| %>
|
|
<div class="col-md-6">
|
|
<%= form.label :current_password, "Current Password", class: "form-label" %>
|
|
<%= form.password_field :current_password, required: true, autocomplete: "current-password", class: "form-control" %>
|
|
</div>
|
|
|
|
<div class="col-md-6">
|
|
<%= form.label :password, "New Password", class: "form-label" %>
|
|
<%= form.password_field :password, required: true, autocomplete: "new-password", minlength: 8, class: "form-control" %>
|
|
<div class="form-text">Minimum 8 characters</div>
|
|
</div>
|
|
|
|
<div class="col-md-6">
|
|
<%= form.label :password_confirmation, "Confirm New Password", class: "form-label" %>
|
|
<%= form.password_field :password_confirmation, required: true, autocomplete: "new-password", minlength: 8, class: "form-control" %>
|
|
</div>
|
|
|
|
<div class="col-12">
|
|
<%= form.submit "Update Password", class: "btn btn-primary" %>
|
|
<%= link_to "Cancel", root_path, class: "btn btn-secondary ms-2" %>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
<% else %>
|
|
<!-- OIDC User Info -->
|
|
<div class="border-top pt-4">
|
|
<div class="alert alert-info">
|
|
<h6>🔐 OIDC Authentication</h6>
|
|
<p class="mb-0">Your account is managed through your OIDC provider. To change your password, please use your provider's account management tools.</p>
|
|
</div>
|
|
</div>
|
|
<% end %>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</div>
|