<h1><%= _('Edit profile') %></h1>
<%= raw _('<p>Please note that your email address is used as your username. If you change this, remember to use your new email address on sign in.</p>') %>
<div class="white_background">
<%= form_for(resource, as: resource_name, url: registration_path(resource_name), html: {method: :put}) do |f| %>
<%= hidden_field_tag :unlink_flag, "false", id: "unlink_flag" %>
<!-- body -->
<div class="dmp_details">
<p><%= raw _('You can edit any of the details below.') %></p>
<table class="dmp_details_table">
<tr>
<td class="first"><%= (_('Email') + " *") %></td>
<td><%= f.email_field :email, as: :email %></td>
</tr>
<tr>
<td class="first"><%= _('First name') %></td>
<td><%= f.text_field :firstname, as: :string,
id: "first_time_login_firstname",
autofocus: true,
class: "text_field has-tooltip",
"data-toggle" => "tooltip",
"data-trigger" => "focus" ,
"title" => _('Please enter your first name.') %></td>
</tr>
<tr>
<td class="first"><%= _('Last name') %></td>
<td><%= f.text_field :surname,
as: :string, id: "first_time_login_surname",
class: "text_field has-tooltip",
"data-toggle" => "tooltip",
"data-trigger" => "focus" ,
"title" => _('Please enter your surname or family name.') %></td>
</tr>
<tr>
<td class="first"><%= _('Organisation') %></td>
<td><%= collection_select(:user,
:org_id, @orgs,
:id, :name, {include_blank: _('Select Organisation')},
{ class: "typeahead org_sign_up" }) %></td>
</tr>
<tr id="other-organisation-name" style="display:none" data-orgs="<%= @other_organisations.join(",") %>">
<td class="first"><%= _('Organisation name')%></td>
<td><%= f.text_field :other_organisation,
as: :string,
class: "text_field has-tooltip reg-input", "data-toggle" => "tooltip", "data-container" => "body", "title" => _('Please enter the name of your organisation.') %></td>
</tr>
<% if MANY_LANGUAGES %>
<tr>
<td class="first"><%= _('Language') %></td>
<td class="force-left">
<!-- For some reason the rails collection_select and f.select would not 'select' the current language, so reverting to HTML -->
<% locale = current_user.get_locale(); %>
<select id="user_language_id" name="user[language_id]" class="typeahead org_sign_up">
<%= @languages.each do |l| %>
<option value="<%= l.id %>"<%= locale == l.abbreviation ? ' selected="selected"' : '' %>>
<%= l.name %>
</option>
<% end %>
</select>
</td>
</tr>
<% end %>
<% @identifier_schemes.each do |scheme| %>
<tr>
<td class="first"><%= scheme.description %></td>
<td>
<%= render partial: 'external_identifier',
locals: {scheme: scheme,
id: current_user.identifier_for(scheme)} %>
</td>
</tr>
<% end %>
<% unless @user.api_token.blank? %>
<tr>
<td class="first"><%= _('API token') %></td>
<td><%= @user.api_token %></td>
</tr>
<tr>
<td class="first"><%= _('API Information') %></td>
<td><%= link_to( _('How to use the API'), controller: "token_permission_types", action: "index")%></td>
</tr>
<% end %>
</table>
<br />
<p>
<!--
<% if Rails.application.config.shibboleth_enabled %>
<% if resource.shibboleth_id.nil? || resource.shibboleth_id.length == 0 then %>
<%= link_to _('Link your %{application_name} account to your institutional credentials (UK users only)') % { :application_name => user_shibboleth_omniauth_authorize_path }, class: "a-orange" %>
<% else %>
<%= _('Your account is linked to your institutional credentials.') %>
<a id="unlink-shibboleth-button" data-toggle="modal" href="#unlink-institutional-credentials-dialog">
<%= _('Unlink your institutional credentials')%>
</a>
<% end %>
<% end %>
-->
</p>
<br />
<div class="div_clear">
</div>
<p>
<%= _('If you would like to change your password please complete the following fields.') %>
</p>
<table class="dmp_details_table">
<% if devise_mapping.confirmable? && resource.pending_reconfirmation? %>
<div><%= t('custom_devise.waiting_for_confirmation') %><%= resource.unconfirmed_email %></div>
<% end %>
<tr>
<td class="first"><%= _('Current password') %></td>
<td>
<%= f.password_field :current_password, as: :password %>
</td>
</tr>
<tr>
<td class="first"><%= _('New password') %></td>
<td><%= f.password_field :password, as: :password, autocomplete: "off" %>
</td>
</tr>
<tr>
<td class="first"><%= _('Password confirmation') %></td>
<td><%= f.password_field :password_confirmation, as: :password, autocomplete: "off" %></td>
</tr>
</table>
<div class="move_2_right">
<%= f.submit _('Save'), class: "btn btn-primary" %>
<%= link_to _('Cancel'), :back, class: "btn btn-primary" %>
</div>
<% end %>
</div>
</div>
<!-- alert for the default template-->
<div id="unlink-institutional-credentials-dialog" data-container="body" data-backdrop="static" class="modal hide fade">
<div class="modal-header">
<h3><%= _('Unlink institutional credentials alert') %></h3>
</div>
<div class="modal-body">
<%= raw _('<p>You are about to unlink %{application_name} of your institutional credentials, would you like to continue?</p>') % { :application_name => user_shibboleth_omniauth_authorize_path } %>
</div>
<div class="modal-footer">
<a href="#" id="unlink-shibboleth-cancelled" class="btn"><%= _('Cancel') %></a>
<a href="#" id="unlink-shibboleth-confirmed" class="btn btn-primary"><%= _('Unlink account') %></a>
</div>
</div>