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.

37 lines
931 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';
2023-07-09 08:55:56 +05:30
export const initPasswordInput = () => {
document.querySelectorAll('.js-password').forEach((el) => {
if (!el) {
return null;
}
2023-06-20 00:43:36 +05:30
2023-07-09 08:55:56 +05:30
const { form } = el;
const { title, id, minimumPasswordLength, qaSelector, testid, autocomplete, name } = el.dataset;
2023-06-20 00:43:36 +05:30
2023-07-09 08:55:56 +05:30
// eslint-disable-next-line no-new
new Vue({
el,
name: 'PasswordInputRoot',
render(createElement) {
return createElement(PasswordInput, {
props: {
title,
id,
minimumPasswordLength,
qaSelector,
testid,
autocomplete,
name,
},
});
},
});
2023-06-20 00:43:36 +05:30
2023-07-09 08:55:56 +05:30
// Since we replaced password input, we need to re-initialize the field errors handler
return new GlFieldErrors(form);
2023-06-20 00:43:36 +05:30
});
};