From c1883f52821fd47c4a856bc36121d0df95486a48 Mon Sep 17 00:00:00 2001 From: dave Date: Mon, 4 Feb 2019 14:25:21 -0500 Subject: [PATCH] #138 - escape html entities in BIO text --- src/components/user_settings/user_settings.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/components/user_settings/user_settings.js b/src/components/user_settings/user_settings.js index 9bd8aa00..7a2400f2 100644 --- a/src/components/user_settings/user_settings.js +++ b/src/components/user_settings/user_settings.js @@ -6,7 +6,7 @@ const UserSettings = { data () { return { newName: this.$store.state.users.currentUser.name, - newBio: this.$store.state.users.currentUser.description, + newBio: this.parseEntities(this.$store.state.users.currentUser.description), newLocked: this.$store.state.users.currentUser.locked, newNoRichText: this.$store.state.users.currentUser.no_rich_text, newDefaultScope: this.$store.state.users.currentUser.default_scope, @@ -287,6 +287,14 @@ const UserSettings = { logout () { this.$store.dispatch('logout') this.$router.replace('/') + }, + parseEntities (text) { + const parser = new DOMParser + const dom = parser.parseFromString( + '' + text, + 'text/html') + const decodedText = dom.body.textContent + return decodedText } } }