<% # Copyright (C) 2011 - present Instructure, Inc. # # This file is part of Canvas. # # Canvas is free software: you can redistribute it and/or modify it under # the terms of the GNU Affero General Public License as published by the Free # Software Foundation, version 3 of the License. # # Canvas is distributed in the hope that it will be useful, but WITHOUT ANY # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR # A PARTICULAR PURPOSE. See the GNU Affero General Public License for more # details. # # You should have received a copy of the GNU Affero General Public License along # with this program. If not, see . %> <% if can_do(@user, @current_user, :manage, :manage_user_details) %> <% css_bundle :user_logins %> <% js_bundle :user_logins %> <% js_env :PASSWORD_POLICY => (@domain_root_account.try(:password_policy) || {}) %>

<%= t('titles.logins', 'Login Information') %>

<% pseudonyms = @user.all_active_pseudonyms + [nil] %> <% pseudonyms.each do |pseudonym| %> > <% if !pseudonym || can_do(pseudonym, @current_user, :update) %> <% else %> <% end %> <% end %> <% new_pseudonym = @user.pseudonyms.build(account: @domain_root_account) %> <% can_add_pseudonym = can_do(new_pseudonym, @current_user, :create) %> <% can_reset_mfa = @user.otp_secret_key && can_do(@user, @current_user, :reset_mfa) %> <% if can_add_pseudonym || can_reset_mfa %> <% end %>
> <% icon_file_path = Rails.root.join("app/views/shared/svg/_svg_icon_#{pseudonym.try(:authentication_provider).try(:auth_type)}.svg") %> <% if File.exist?(icon_file_path) %> <%= render(partial: "shared/svg/svg_icon_#{pseudonym.authentication_provider.auth_type}", formats: [:svg]) %> <%= t("This login is for %{provider}", provider: pseudonym.authentication_provider.class.display_name) %> <% end %> <%= pseudonym && pseudonym.unique_id %> <% if pseudonym && ((pseudonym.sis_user_id && can_do(pseudonym.account, @current_user, :read_sis)) || can_do(pseudonym, @current_user, :manage_sis)) %>
<%= before_label('sis_id', 'SIS ID') %> <%= pseudonym.sis_user_id %>
<% end %> <% if pseudonym && ((pseudonym.integration_id && can_do(pseudonym.account, @current_user, :read_sis)) || can_do(pseudonym, @current_user, :manage_sis)) %>
<%= before_label('integration_id', 'Integration ID') %> <%= pseudonym.integration_id %>
<% end %>
<% if pseudonyms.length > 1 || !pseudonym %> <% end %>  
<% if can_add_pseudonym %> <%= t('add_login', 'Add Login') %> <% end %> <% if can_add_pseudonym && can_reset_mfa %> | <% end %> <% if can_reset_mfa %> <%= t('reset_mfa', "Reset Multi-Factor Authentication") %> <% end %>
<%= form_for :pseudonym, :url => user_pseudonyms_url(@user.id), :html => {:id => 'edit_pseudonym_form', :class => 'form-dialog form-horizontal', :style => 'display: none;'} do |f| %> <% if can_do(Account.site_admin, @current_user, :manage_user_logins) %> <% js_env :PASSWORD_POLICIES => Hash[Account.root_accounts.active.non_shadow.map{ |a| [a.id, a.password_policy]}] %> <% else %> <% end %>
<%= f.blabel :unique_id, :en => "Login" %> <%= f.text_field :unique_id %>
<%= f.blabel :password, :en => "Password" %> <%= f.password_field :password %>
<%= f.blabel :password_confirmation, :en => "Confirm Password" %> <%= f.password_field :password_confirmation %>
<%= t do %> Note: This login's account uses delegated authentication, but allows fallback Canvas password authentication. The password fields in this form update the fallback Canvas password, not the delegated authentication. <% end %>
<% end %> <% end %>