Hash :
c5b35fe0
Author :
Thomas de Grivel
Date :
2022-06-19T11:38:30
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145
<div class="container-fluid center">
<h1>Edit user <%= User.login(@user) %></h1>
<%= form_for @changeset, Routes.user_path(@conn, :update, User.login(@user)), [multipart: true], fn f -> %>
<div class="mb-3">
<%= label f, :name, class: "form-label" %>
<%= text_input f, :name, class: "form-control" %>
<%= error_tag f, :name %>
</div>
<div class="mb-3">
<%= label f, :slug_, gettext("Login"), class: "form-label" %>
<%= text_input f, :slug_, class: "form-control" %>
<%= error_tag f, :slug_ %>
</div>
<div class="mb-3">
<%= label f, :avatar, class: "form-label" %>
<%= file_input f, :avatar, class: "form-control" %>
<%= error_tag f, :avatar %>
</div>
<div class="mb-3">
<%= label f, :description, class: "form-label" %>
<%= textarea f, :description, class: "form-control" %>
<%= error_tag f, :description %>
</div>
<div class="mb-3">
<%= label f, :ssh_keys, gettext("SSH keys"), class: "form-label" %>
<%= textarea f, :ssh_keys, class: "form-control" %>
<%= error_tag f, :ssh_keys %>
</div>
<div class="mb-3 form-check">
<%= checkbox f, :deploy_only, class: "form-check-input" %>
<%= label f, :deploy_only, class: "form-check-label" %>
<%= error_tag f, :deploy_only %>
</div>
<div>
<%= error_tag f, :owned_repositories %>
</div>
<div class="mb-3">
<%= link gettext("Cancel"),
to: Routes.slug_path(@conn, :show, User.login(@user)),
class: "btn btn-secondary" %>
<%= link gettext("Delete user"),
to: Routes.user_path(@conn, :delete, User.login(@user)),
method: :delete,
class: "btn btn-danger",
data: [confirm: gettext("Are you sure you want to delete the user %{user} ?", user: User.login(@user))] %>
<%= submit gettext("Submit"), class: "btn btn-primary" %>
</div>
<% end %>
<hr/>
<h2><%= gettext "Change email" %></h2>
<.form let={f} for={@email_changeset} action={Routes.user_settings_path(@conn, :update)} id="update_email">
<%= if @email_changeset.action do %>
<div class="alert alert-danger">
<p>Oops, something went wrong! Please check the errors below.</p>
</div>
<% end %>
<%= hidden_input f, :action, name: "action", value: "update_email" %>
<div class="mb-3">
<%= label f, :email, class: "form-label" %>
<%= email_input f, :email, class: "form-control", required: true %>
<%= error_tag f, :email %>
</div>
<div class="mb-3">
<%= label f, :current_password, for: "current_password_for_email", class: "form-label" %>
<%= password_input f, :current_password, required: true, name: "current_password", id: "current_password_for_email", class: "form-control" %>
<%= error_tag f, :current_password %>
</div>
<div class="mb-3">
<%= submit gettext("Submit"), class: "btn btn-primary" %>
</div>
</.form>
<hr/>
<h2><%= gettext "Change password" %></h2>
<.form let={f} for={@password_changeset} action={Routes.user_settings_path(@conn, :update)} id="update_password">
<%= if @password_changeset.action do %>
<div class="alert alert-danger">
<p>Oops, something went wrong! Please check the errors below.</p>
</div>
<% end %>
<%= hidden_input f, :action, name: "action", value: "update_password" %>
<div class="mb-3">
<%= label f, :password, gettext("New password"), class: "form-label" %>
<%= password_input f, :password, class: "form-control", required: true %>
<%= error_tag f, :password %>
</div>
<div class="mb-3">
<%= label f, :password_confirmation, gettext("Confirm new password"), class: "form-label" %>
<%= password_input f, :password_confirmation, class: "form-control", required: true %>
<%= error_tag f, :password_confirmation %>
</div>
<div class="mb-3">
<%= label f, :current_password, for: "current_password_for_password", class: "form-label" %>
<%= password_input f, :current_password, required: true, name: "current_password", id: "current_password_for_password", class: "form-control" %>
<%= error_tag f, :current_password %>
</div>
<div class="mb-3">
<%= submit gettext("Submit"), class: "btn btn-primary" %>
</div>
</.form>
<hr/>
<h2><%= gettext "Two factor authentification (2FA)" %></h2>
<%= if @user.totp_last != 0 do %>
<p>
<%= gettext "2FA enabled (TOTP)" %>
</p>
<p>
<%= link gettext("Disable TOTP (Google Authenticator)"), to: Routes.user_path(@conn, :totp_delete, User.login(@user)), method: :delete, data: [confirm: gettext("Are you sure you want to disable TOTP (Google Authenticator) for %{site} ?", site: "kmxgit")], class: "btn btn-danger" %>
</p>
<% else %>
<p>
<%= link gettext("Enable TOTP (Google Authenticator)"), to: Routes.user_path(@conn, :totp, User.login(@user)), class: "btn btn-danger" %>
</p>
<% end %>
<br />
<hr/>
<br/>
<br/>
</div>