debian-mirror-gitlab/app/assets/javascripts/authentication/password/index.js

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

33 lines
788 B
JavaScript
Raw Normal View History

2023-06-20 00:43:36 +05:30
import Vue from 'vue';
import GlFieldErrors from '~/gl_field_errors';
import PasswordInput from './components/password_input.vue';
export const initTogglePasswordVisibility = () => {
const el = document.querySelector('.js-password');
if (!el) {
return null;
}
const { form } = el;
const { resourceName, minimumPasswordLength, qaSelector } = el.dataset;
// eslint-disable-next-line no-new
new Vue({
el,
name: 'PasswordInputRoot',
render(createElement) {
return createElement(PasswordInput, {
props: {
resourceName,
minimumPasswordLength,
qaSelector,
},
});
},
});
// Since we replaced password input, we need to re-initialize the field errors handler
return new GlFieldErrors(form);
};