diff --git a/core/src/components/login/LoginForm.vue b/core/src/components/login/LoginForm.vue index 9844df6239dfa..66204ad31c757 100644 --- a/core/src/components/login/LoginForm.vue +++ b/core/src/components/login/LoginForm.vue @@ -62,12 +62,15 @@ ref="user" :label="loginText" name="user" + :maxlength="255" :value.sync="user" :class="{shake: invalidPassword}" autocapitalize="none" :spellchecking="false" :autocomplete="autoCompleteAllowed ? 'username' : 'off'" required + :error="userNameInputLengthIs255" + :helper-text="userInputHelperText" data-login-form-input-user @change="updateUsername" /> @@ -117,8 +120,11 @@ import NcNoteCard from '@nextcloud/vue/dist/Components/NcNoteCard.js' import LoginButton from './LoginButton.vue' +import AuthMixin from '../../mixins/auth.js' + export default { name: 'LoginForm', + mixins: [AuthMixin], components: { LoginButton, diff --git a/core/src/components/login/ResetPassword.vue b/core/src/components/login/ResetPassword.vue index 0490bd84cf5d8..b3939a29b611d 100644 --- a/core/src/components/login/ResetPassword.vue +++ b/core/src/components/login/ResetPassword.vue @@ -25,8 +25,11 @@ @@ -60,8 +63,11 @@ import LoginButton from './LoginButton.vue' import NcTextField from '@nextcloud/vue/dist/Components/NcTextField.js' import NcNoteCard from '@nextcloud/vue/dist/Components/NcNoteCard.js' +import AuthMixin from '../../mixins/auth.js' + export default { name: 'ResetPassword', + mixins: [AuthMixin], components: { LoginButton, NcNoteCard, diff --git a/core/src/mixins/auth.js b/core/src/mixins/auth.js new file mode 100644 index 0000000000000..431e04bc2b9da --- /dev/null +++ b/core/src/mixins/auth.js @@ -0,0 +1,36 @@ +/** + * @copyright Copyright (c) 2024 Fon E. Noel NFEBE + * + * @author Fon E. Noel NFEBE + * + * @license AGPL-3.0-or-later + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ + +export default { + + computed: { + userNameInputLengthIs255() { + return this.user.length >= 255 + }, + userInputHelperText() { + if (this.emailLength === 255) { + return t('core', 'Email length is at max (255)') + } + return undefined + }, + }, +}