<%= form_with(model: @auth_user, method: :put, class: "settings-form") do |f| %>
Your info
<%= render "devise/shared/error_messages", resource: @auth_user %>
<%# Current password is only required if you have one! %>
<% if @persisted_auth_user.uses_password? %>
<% end %>
<%= f.submit "Save changes" %>
<% end %>
<% if @persisted_auth_user.uses_neopass? %>
<%= form_with url: user_neopass_connection_path(@auth_user.user),
method: :delete, class: "settings-form", data: {
turbo_confirm: "Are you sure? Without a NeoPass, you'll need to use " +
"your password or your recovery email " +
"\"#{@persisted_auth_user.email}\" to log in again.\n\nMake sure " +
"you have everything all set up first! Otherwise, you might be " +
"locked out of this account forever!"
} do |form|
%>
You can log into your Dress to Impress account with NeoPass, or with
your username and password. If you ever lose access to your NeoPass,
you can still use "Forgot your password?" to recover your Dress to
Impress account, using the Email saved in "Your info".
<% if !@persisted_auth_user.uses_password? && !@persisted_auth_user.email? %>
You can't remove this NeoPass yet, because you need to either set a
password or a recovery email first. (Ideally both!)
<% elsif !@persisted_auth_user.uses_password? %>
Be extra careful here! Your account doesn't have a password set.
<% elsif !@persisted_auth_user.email? %>
Be extra careful here! Your account doesn't have an email set.
<% end %>
<%= form.submit "Disconnect your NeoPass",
disabled: !@persisted_auth_user.uses_password? &&
!@persisted_auth_user.email? %>
<% end %>
<% else %>
<%= form_with url: auth_user_neopass_omniauth_authorize_path(intent: "connect"),
method: :post, class: "settings-form", data: {turbo: false} do |form|
%>
Your NeoPass
If you connect a NeoPass, you can use it to log into this DTI account!
When you click below, you'll be connected to
<%= link_to "https://account.neopets.com/", target: "_blank" do %>
whatever NeoPass is already logged in
<%= external_link_icon %><% end %>.
If it's your first time connecting, you'll be asked for 3 permissions:
OpenID and Email tell us who you are, and
Linkage tells us your Neopets username.
You'll still be able to use your password to log in too, and you can
disconnect this later if you'd like.
<%= form.submit "Connect your NeoPass" %>
<% end %>
<% end %>
<% content_for :stylesheets do %>
<%= page_stylesheet_link_tag "auth_users/edit" %>
<% end %>