Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bug 1335331 - Enable users to change their email address #793

Merged
merged 17 commits into from
Jan 16, 2018
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
7 changes: 6 additions & 1 deletion pontoon/base/forms.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,12 @@ class UserProfileForm(forms.ModelForm):
Form is responsible for saving user's name.
"""
first_name = forms.RegexField(regex='^[^<>"\'&]+$', max_length=30, strip=True)
email = forms.EmailField()
email = forms.EmailField(
help_text=(
'Changing your email address will cause a logout. '
'Make sure the new one is correct before saving!'
)
)

class Meta:
model = User
Expand Down
8 changes: 5 additions & 3 deletions pontoon/contributors/static/css/settings.css
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,12 @@
margin-top: 10px;
}

#email-warning {
display: none;
#profile-form .help {
color: #FED271;
font-style: italic;
font-weight: bold;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Now that the text is always visible, I find the styling a little too intrusive.

I'd remove bold (bold+italic at the same time is rarely a good idea) and change color to #888888. Please also add margin-top: 5px;.

}
#email-warning,

.errorlist {
color: #F36;
list-style: none;
Expand Down
15 changes: 0 additions & 15 deletions pontoon/contributors/static/js/settings.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,4 @@ $(function() {
}
});
});

// Show a warning when a user changes their email address.
var emailField = $('#id_email');
var warningContent = $('#email-warning');
var originalEmail = emailField.val();

emailField.on('keyup', function () {
var newEmail = emailField.val();
if (newEmail === originalEmail && warningContent.is(':visible')) {
warningContent.hide();
}
else if (newEmail !== originalEmail && !warningContent.is(':visible')) {
warningContent.show();
}
});
});
5 changes: 1 addition & 4 deletions pontoon/contributors/templates/contributors/settings.html
Original file line number Diff line number Diff line change
Expand Up @@ -55,10 +55,7 @@ <h3>Personal infomation</h3>
{{ profile_form.email.label_tag(label_suffix='') }}
{{ profile_form.email }}
{{ profile_form.email.errors }}
<div id="email-warning">
Caution: Changing your email address will cause a logout.<br />
Make sure the new one is correct before saving!
</div>
<p class="help">{{ profile_form.email.help_text }}</p>
</div>
</div>

Expand Down