[%# This Source Code Form is subject to the terms of the Mozilla Public
  # License, v. 2.0. If a copy of the MPL was not distributed with this
  # file, You can obtain one at http://mozilla.org/MPL/2.0/.
  #
  # This Source Code Form is "Incompatible With Secondary Licenses", as
  # defined by the Mozilla Public License, v. 2.0.
  #%]

[%# INTERFACE:
  #
  # editform:  is this an edit form? (It's a create form otherwise)
  # editusers: is viewing user member of editusers?
  # otheruser: Bugzilla::User object of user to edit
  #%]

<script type="text/javascript">
  var disable_mail_manually_set = [% (otheruser.email_disabled ? 1 : 0) FILTER js %];
</script>

<tr>
  <th><label for="login">Login name:</label></th>
  <td>
    [% IF editusers %]
      <input size="64" maxlength="255" name="login" 
             id="login" value="[% otheruser.login FILTER html %]" />
      [% IF editform %]
        [% IF !otheruser.in_group('bz_sudo_protect') %]
          <br />
          <a href="relogin.cgi?action=prepare-sudo&amp;target_login=
          [%- otheruser.login FILTER uri %]">Impersonate this user</a>
        [% END %]
      [% END %]
    [% ELSE %]
      [% otheruser.login FILTER html %]
    [% END %]
  </td>
</tr>
[% IF default_authorizer.extern_id_used %]
  <tr>
    <th><label for="extern_id">External Login ID:</label></th>
    <td>
      [% IF editusers %]
        <input size="64" maxlength="64" name="extern_id"
               id="extern_id" value="[% otheruser.extern_id FILTER html %]">
      [% ELSE %]
        [% otheruser.extern_id FILTER html %]
      [% END %]
    </td>
  </tr>
[% END %]
<tr>
  <th><label for="name">Real name:</label></th>
  <td>
    [% IF editusers %]
      <input size="64" maxlength="255" name="name"
             autocomplete="off"
             id="name" value="[% otheruser.name FILTER html %]" />
    [% ELSE %]
      [% otheruser.name FILTER html %]
    [% END %]
  </td>
</tr>

[%# XXX This condition (can_change_password) will cause a problem
  # if we ever have a login system that can create accounts through
  # createaccount.cgi but can't change passwords.
  #%]
  
[% IF editusers %]
  [% IF user.authorizer.can_change_password %]
  <tr>
    <th><label for="password">Password:</label></th>
    <td>
      <input type="password" size="16" name="password" id="password"
             value="" autocomplete="off" />
      [% IF editform %]<br />
        (Enter new password to change.)
      [% END %]
    </td>
  </tr>
  [% END %]
  <tr>
    <th><label for="disable_mail">[% terms.Bug %]mail Disabled:</label></th>
    <td>
      <input type="checkbox" name="disable_mail" id="disable_mail" value="1" 
             [% IF otheruser.email_disabled %] checked="checked" [% END %] 
             onchange="disable_mail_manually_set=1;">
      (This affects [% terms.bug %]mail and whinemail, not password-reset or other 
      non-[% terms.bug %]-related emails)
    </td>
  </tr>
  <tr>
    <th><label for="disabledtext">Disable text:</label></th>
    <td>
      [% INCLUDE global/textarea.html.tmpl
         name           = 'disabledtext'
         id             = 'disabledtext'
         minrows        = 2
         maxrows        = 10
         defaultrows    = 10
         cols           = 60
         defaultcontent = otheruser.disabledtext
         onchange       = "userDisabledTextOnChange(this);"
       %]<br>
      (If non-empty, then it will not be possible to log in using this account,
      and this text should explain why.)
    </td>
  </tr>
[% END %]
