{% extends (craft.hasPackage('Users') ? "users/_edit/layout" : "_layouts/cp") %} {% if craft.hasPackage('Users') %} {% set selectedTab = 'account' %} {% else %} {% set title = "My Account"|t %} {% endif %} {% import "_includes/forms" as forms %} {% if account is not defined and craft.request.segment(1) == 'myaccount' %} {% set account = user %} {% endif %} {% if craft.hasPackage('Users') %} {% if account is not defined and userId is defined %} {% set account = craft.users.status('*').id(userId).first %} {% if not account %}{% exit 404 %}{% endif %} {% endif %} {% endif %} {% set isNewAccount = (account is not defined or not account.id) %} {% set content %}
{% if isNewAccount %} {% else %} {% endif %} {{ forms.textField({ first: true, label: "Username"|t, id: 'username', name: 'username', value: (account is defined ? account.username : null), autofocus: true, required: (isNewAccount or (user.admin or account.isCurrent) ? true : false), disabled: (isNewAccount or (user.admin or account.isCurrent) ? false : true), errors: (account is defined ? account.getErrors('username') : null) }) }} {% if (not isNewAccount and (not user.admin and not account.isCurrent)) %} {% endif %}
{{ forms.textField({ label: "First Name"|t, id: 'firstName', name: 'firstName', value: (account is defined ? account.firstName : null), errors: (account is defined ? account.getErrors('firstName') : null) }) }}
{{ forms.textField({ label: "Last Name"|t, id: 'lastName', name: 'lastName', value: (account is defined ? account.lastName : null), errors: (account is defined ? account.getErrors('lastName') : null) }) }}
{{ forms.textField({ label: "Email"|t, id: 'email', name: 'email', value: (account is defined ? account.email : null), required: (isNewAccount or (user.admin or account.isCurrent) ? true : false), disabled: (isNewAccount or (user.admin or account.isCurrent) ? false : true), errors: (account is defined ? account.getErrors('email') : null) }) }} {% if (not isNewAccount and (not user.admin and not account.isCurrent)) %} {% endif %} {% if account is defined and account.isCurrent %} {{ forms.passwordField({ label: "Password"|t, instructions: (isNewAccount ? null : "Leave blank to keep password unchanged."|t), id: 'newPassword', name: 'newPassword', errors: (account is defined ? account.getErrors('newPassword') : null) }) }} {% endif %} {% if user.admin and not isNewAccount %} {{ forms.checkboxField({ label: "Require a password reset on next login"|t, name: 'passwordResetRequired', checked: (account is defined ? account.passwordResetRequired : true) }) }} {% endif %} {% if craft.hasPackage('Localize') %} {% set localeInput %}
{% endset %} {{ forms.field({ id: 'preferredLocale', label: "Preferred Locale"|t }, localeInput) }} {% endif %}
{% endset %}