Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion tom_eso/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ class ESOProfileForm(forms.ModelForm):
p2_password = forms.CharField(
required=False,
label="P2 password",
help_text="Enter your Phase 2 Tool password. Leave blank to keep unchanged."
help_text="Enter your Phase 2 Tool password. Leave blank to keep unchanged.",
widget=forms.PasswordInput(render_value=True)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a way to add a revelation option to the form as well? It feels weird to be able to edit this field without seeing what you are typing...

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the standard practice would be to just not have the field pre-populated at all, or to clear it on focus.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like clearing the field on focus, as long as it doesn't save it blank.

)

def __init__(self, *args, **kwargs):
Expand Down
10 changes: 8 additions & 2 deletions tom_eso/templates/tom_eso/partials/eso_user_profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,20 @@ <h4 class="card-title">ESO Facility User Info</h4>
</div>
<div class="card-body">
<p>
ESO P2 Tool Configuraton and Credentials
ESO P2 Tool Configuration and Credentials
</p>
<hr />
<dl class="row">
{% for field_data in profile_data_list %}
{% if field_data.value %}
<dt class="col-sm-6">{{ field_data.label }}</dt>
<dd class="col-sm-6">{{ field_data.value }}</dd>
<dd class="col-sm-6">
{% if field_data.is_password %}
{% include 'tom_common/partials/revealable_password_input.html' with value=field_data.value %}
{% else %}
{{ field_data.value }}
{% endif %}
</dd>
{% endif %}
{% empty %}
<p>No ESO Profile items yet for this user.</p>
Expand Down
4 changes: 3 additions & 1 deletion tom_eso/templatetags/eso_extras.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ def eso_profile_data(user) -> dict:
if decrypted_password is None:
password_value = "[Password not available]"

profile_data_list.append({'label': password_label, 'value': password_value})
profile_data_list.append(
{"label": password_label, "value": password_value, "is_password": True}
)

return {'user': user, 'eso_profile': profile, 'profile_data_list': profile_data_list}
Loading