{% extends "_layouts/cp" %} {% if CraftEdition == CraftPro and currentUser.can('editUsers') %} {% set crumbs = [ { label: "Users"|t('app'), url: url('users') } ] %} {% endif %} {% import "_includes/forms" as forms %} {% do view.registerTranslations('app', [ "Are you sure you want to delete this photo?", ]) %} {% do view.registerAssetBundle("craft\\web\\assets\\fileupload\\FileUploadAsset") %} {% set requireEmailVerification = craft.app.systemSettings.getSettings('users').requireEmailVerification %} {% set hiddenInputs %} {{ csrfInput() }} {% if not isNewUser -%} {%- endif %} {% endset %} {% hook "cp.users.edit" %} {% block actionButton %} {% if not currentUser.can('registerUsers') or CraftEdition != CraftPro %}
{{ 'Save'|t('app') }}
{% else %}
{{ 'Save'|t('app') }}
{% endif %} {% endblock %} {% block content %}
{{ redirectInput(CraftEdition == CraftPro and currentUser.can('editUsers') ? 'users' : 'dashboard') }} {{ hiddenInputs }}
{% include "users/_accountfields" %} {% if not isNewUser %} {{ forms.field({ label: "Photo"|t('app'), id: 'photo' }, include('users/_photo', {user: user}, with_context = false)) }} {% endif %}
{% if isNewUser %} {{ forms.textField({ label: "Email"|t('app'), instructions: (requireEmailVerification and not currentUser.admin ? 'A verification email will be sent automatically.'|t('app')), id: 'email', name: 'email', value: user.email, required: true, errors: user.getErrors('email')|merge(user.getErrors('unverifiedEmail')) }) }} {% if requireEmailVerification and currentUser.admin %} {{ forms.checkboxField({ label: "Send an activation email now?"|t('app'), name: 'sendVerificationEmail', checked: true }) }} {% endif %} {% elseif user.getIsCurrent() or currentUser.admin or currentUser.can('changeUserEmails') %} {{ forms.textField({ label: "Email"|t('app'), instructions: (requireEmailVerification and not currentUser.admin ? 'New email addresses must be verified before taking effect.'|t('app')), id: 'email', name: 'email', value: user.email, required: true, errors: user.getErrors('email')|merge(user.getErrors('unverifiedEmail')) }) }} {% if user.getIsCurrent() %} {{ forms.textField({ label: "New Password"|t('app'), id: 'newPassword', name: 'newPassword', type: 'password', errors: user.getErrors('newPassword') }) }} {% endif %} {% if currentUser.admin %} {{ forms.checkboxField({ label: "Require a password reset on next login"|t('app'), name: 'passwordResetRequired', checked: user.passwordResetRequired }) }} {% endif %} {% endif %}
{% if CraftEdition == CraftPro %} {% for tab in user.getFieldLayout().getTabs() %} {% endfor %} {% endif %} {% if CraftEdition == CraftPro and (currentUser.can('assignUserGroups') or currentUser.can('assignUserPermissions')) %} {% endif %} {% if user.getIsCurrent() %} {% endif %} {# Give plugins a chance to add other things here #} {% hook "cp.users.edit.content" %}
{% endblock %} {% block details %} {% if not isNewUser %} {% if CraftEdition == CraftPro %}
{{ hiddenInputs }}
{{ "Status"|t('app') }}
{{ statusLabel }}
{% if actions|length %}
{% endif %}
{% if user.getStatus() == 'locked' and craft.app.config.general.cooldownDuration and user.remainingCooldownTime %}
{{ "Cooldown Time Remaining"|t('app') }}

{{ user.remainingCooldownTime|duration }}

{% endif %}
{{ "Registered at"|t('app') }}

{{ user.dateCreated|datetime('short') }}

{% if user.getStatus() != 'pending' %}
{{ "Last login"|t('app') }}

{% if user.lastLoginDate %}{{ user.lastLoginDate|datetime('short') }}{% else %}{{ "Never"|t('app') }}{% endif %}

{% if user.getStatus() == 'locked' %}
{{ "Last login fail"|t('app') }}

{% if user.lastInvalidLoginDate %}{{ user.lastInvalidLoginDate|datetime('short') }}{% endif %}

{{ "Login fail count"|t('app') }}

{{ user.invalidLoginCount }}

{% endif %} {% endif %}
{% endif %} {% endif %} {# Give plugins a chance to add other stuff here #} {% hook "cp.users.edit.details" %} {% endblock %} {% js %} {% if user.getIsCurrent() %} var changeSidebarPicture = true; {% else %} var changeSidebarPicture = false; {% endif %} new Craft.ElevatedSessionForm('#userform', [ '#email', '#newPassword', '#admin:not(:checked)', '#user-groups input[type="checkbox"]:not(:checked)', '#permissions input[type="checkbox"]:not(:checked)' ]); {% endjs %}