Commit f1e04955 authored by Fatih Acet's avatar Fatih Acet

Merge branch '23813-fix-username-character-validation-message' into 'master'

Properly escape username validation error

## What does this MR do?

Prevents the double-escaping of the username validation error when attempting to change one's username using an invalid character.

Go to [/profile/account](https://gitlab.com/profile/account) and attempt to add an invalid character like `@` or `#` to your username to trigger this message.

## Screenshots (if relevant)

#### Before:
![user-name-change](/uploads/8e509ca8a22e40fd51c3c1919e9c6871/user-name-change.png)

#### After:
![Screen_Shot_2016-11-23_at_5.23.52_PM](/uploads/3e868128724e6af07d1193494ec25941/Screen_Shot_2016-11-23_at_5.23.52_PM.png)

## Does this MR meet the acceptance criteria?

- [ ] ~~[Changelog entry](https://docs.gitlab.com/ce/development/changelog.html) added~~
- [ ] ~~[Documentation created/updated](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/doc/development/doc_styleguide.md)~~
- [ ] ~~API support added~~
- Tests
  - [ ] ~~Added for this feature/bug~~
  - [ ] All builds are passing
- [x] Conform by the [merge request performance guides](http://docs.gitlab.com/ce/development/merge_request_performance_guidelines.html)
- [x] Conform by the [style guides](https://gitlab.com/gitlab-org/gitlab-ce/blob/master/CONTRIBUTING.md#style-guides)
- [x] Branch has no merge conflicts with `master` (if it does - rebase it please)
- [x] [Squashed related commits together](https://git-scm.com/book/en/Git-Tools-Rewriting-History#Squashing-Commits)

## What are the relevant issue numbers?

Closes #23813

See merge request !7725
parents c4799a2b 5b9c4f48
......@@ -2,5 +2,6 @@
:plain
new Flash("Username successfully changed", "notice")
- else
- error = @user.errors.full_messages.first
:plain
new Flash("Username change failed - #{@user.errors.full_messages.first}", "alert")
new Flash("Username change failed - #{escape_javascript error.html_safe}", "alert")
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment