feat(core): Add LDAP support (#3835)

This commit is contained in:
Ricardo Espinoza
2023-01-24 20:18:39 -05:00
committed by GitHub
parent 259296c5c9
commit 0c70a40317
77 changed files with 3686 additions and 192 deletions

View File

@@ -16,6 +16,7 @@ import { IFormBoxConfig } from '@/Interface';
import { VIEWS } from '@/constants';
import { mapStores } from 'pinia';
import { useUsersStore } from '@/stores/users';
import { useSettingsStore } from '@/stores/settings';
export default mixins(showMessage).extend({
name: 'SigninView',
@@ -23,7 +24,22 @@ export default mixins(showMessage).extend({
AuthView,
},
data() {
const FORM_CONFIG: IFormBoxConfig = {
return {
FORM_CONFIG: {} as IFormBoxConfig,
loading: false,
};
},
computed: {
...mapStores(useUsersStore, useSettingsStore),
},
mounted() {
let emailLabel = this.$locale.baseText('auth.email');
const ldapLoginLabel = this.settingsStore.ldapLoginLabel;
const isLdapLoginEnabled = this.settingsStore.isLdapLoginEnabled;
if (isLdapLoginEnabled && ldapLoginLabel) {
emailLabel = ldapLoginLabel;
}
this.FORM_CONFIG = {
title: this.$locale.baseText('auth.signin'),
buttonText: this.$locale.baseText('auth.signin'),
redirectText: this.$locale.baseText('forgotPassword'),
@@ -32,10 +48,10 @@ export default mixins(showMessage).extend({
{
name: 'email',
properties: {
label: this.$locale.baseText('auth.email'),
label: emailLabel,
type: 'email',
required: true,
validationRules: [{ name: 'VALID_EMAIL' }],
...(!isLdapLoginEnabled && { validationRules: [{ name: 'VALID_EMAIL' }] }),
showRequiredAsterisk: false,
validateOnBlur: false,
autocomplete: 'email',
@@ -56,14 +72,6 @@ export default mixins(showMessage).extend({
},
],
};
return {
FORM_CONFIG,
loading: false,
};
},
computed: {
...mapStores(useUsersStore),
},
methods: {
async onSubmit(values: { [key: string]: string }) {