#138 - escape html entities in BIO text

This commit is contained in:
dave 2019-02-04 14:25:21 -05:00
parent 448317338e
commit c1883f5282

View File

@ -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(
'<!doctype html><body>' + text,
'text/html')
const decodedText = dom.body.textContent
return decodedText
}
}
}