Commit 03c30a66 authored by Jose Ivan Vargas's avatar Jose Ivan Vargas

Merge branch '241869-remove-html-delete-account-modal' into 'master'

Remove v-html from delete account modal

See merge request gitlab-org/gitlab!62773
parents 4f954836 906208bb
<script> <script>
/* eslint-disable vue/no-v-html */ import { GlModal, GlSprintf } from '@gitlab/ui';
import { GlModal } from '@gitlab/ui';
import csrf from '~/lib/utils/csrf'; import csrf from '~/lib/utils/csrf';
import { __, s__, sprintf } from '~/locale'; import { __, s__ } from '~/locale';
export default { export default {
components: { components: {
GlModal, GlModal,
GlSprintf,
}, },
props: { props: {
actionUrl: { actionUrl: {
...@@ -32,33 +32,8 @@ export default { ...@@ -32,33 +32,8 @@ export default {
csrfToken() { csrfToken() {
return csrf.token; return csrf.token;
}, },
inputLabel() { confirmationValue() {
let confirmationValue; return this.confirmWithPassword ? __('password') : __('username');
if (this.confirmWithPassword) {
confirmationValue = __('password');
} else {
confirmationValue = __('username');
}
confirmationValue = `<code>${confirmationValue}</code>`;
return sprintf(
s__('Profiles|Type your %{confirmationValue} to confirm:'),
{ confirmationValue },
false,
);
},
text() {
return sprintf(
s__(`Profiles|
You are about to permanently delete %{yourAccount}, and all of the issues, merge requests, and groups linked to your account.
Once you confirm %{deleteAccount}, it cannot be undone or recovered.`),
{
yourAccount: `<strong>${s__('Profiles|your account')}</strong>`,
deleteAccount: `<strong>${s__('Profiles|Delete account')}</strong>`,
},
false,
);
}, },
primaryProps() { primaryProps() {
return { return {
...@@ -90,6 +65,12 @@ Once you confirm %{deleteAccount}, it cannot be undone or recovered.`), ...@@ -90,6 +65,12 @@ Once you confirm %{deleteAccount}, it cannot be undone or recovered.`),
this.$refs.form.submit(); this.$refs.form.submit();
}, },
}, },
i18n: {
text: s__(`Profiles|
You are about to permanently delete %{yourAccount}, and all of the issues, merge requests, and groups linked to your account.
Once you confirm %{deleteAccount}, it cannot be undone or recovered.`),
inputLabel: s__('Profiles|Type your %{confirmationValue} to confirm:'),
},
}; };
</script> </script>
...@@ -102,13 +83,29 @@ Once you confirm %{deleteAccount}, it cannot be undone or recovered.`), ...@@ -102,13 +83,29 @@ Once you confirm %{deleteAccount}, it cannot be undone or recovered.`),
:ok-disabled="!canSubmit" :ok-disabled="!canSubmit"
@primary="onSubmit" @primary="onSubmit"
> >
<p v-html="text"></p> <p>
<gl-sprintf :message="$options.i18n.text">
<template #yourAccount>
<strong>{{ s__('Profiles|your account') }}</strong>
</template>
<template #deleteAccount>
<strong>{{ s__('Profiles|Delete account') }}</strong>
</template>
</gl-sprintf>
</p>
<form ref="form" :action="actionUrl" method="post"> <form ref="form" :action="actionUrl" method="post">
<input type="hidden" name="_method" value="delete" /> <input type="hidden" name="_method" value="delete" />
<input :value="csrfToken" type="hidden" name="authenticity_token" /> <input :value="csrfToken" type="hidden" name="authenticity_token" />
<p id="input-label" v-html="inputLabel"></p> <p id="input-label">
<gl-sprintf :message="$options.i18n.inputLabel">
<template #confirmationValue>
<code>{{ confirmationValue }}</code>
</template>
</gl-sprintf>
</p>
<input <input
v-if="confirmWithPassword" v-if="confirmWithPassword"
......
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