File tree Expand file tree Collapse file tree 5 files changed +65
-2
lines changed
Expand file tree Collapse file tree 5 files changed +65
-2
lines changed Original file line number Diff line number Diff line change @@ -336,9 +336,20 @@ public function tryLogin(Chain $loginChain,
336336 );
337337 }
338338
339+ $user = trim($user);
340+
341+ if (strlen($user) > 255) {
342+ return $this->createLoginFailedResponse(
343+ $user,
344+ $user,
345+ $redirect_url,
346+ $this->l10n->t('Unsupported email length (>255)')
347+ );
348+ }
349+
339350 $data = new LoginData(
340351 $this->request,
341- trim( $user) ,
352+ $user,
342353 $password,
343354 $redirect_url,
344355 $timezone,
Original file line number Diff line number Diff line change @@ -182,6 +182,10 @@ public function email(string $user): JSONResponse {
182182
183183 $user = trim($user);
184184
185+ if (strlen($user) > 255) {
186+ return new JSONResponse($this->error($this->l10n->t('Unsupported email length (>255)')));
187+ }
188+
185189 \OCP\Util::emitHook(
186190 '\OCA\Files_Sharing\API\Server2Server',
187191 'preLoginNameUsedAsUserName',
Original file line number Diff line number Diff line change 6262 ref="user"
6363 :label="loginText"
6464 name="user"
65+ :maxlength="255"
6566 :value.sync="user"
6667 :class="{shake: invalidPassword}"
6768 autocapitalize="none"
6869 :spellchecking="false"
6970 :autocomplete="autoCompleteAllowed ? 'username' : 'off'"
7071 required
72+ :error="userNameInputLengthIs255"
73+ :helper-text="userInputHelperText"
7174 data-login-form-input-user
7275 @change="updateUsername" />
7376
@@ -117,6 +120,8 @@ import NcNoteCard from '@nextcloud/vue/dist/Components/NcNoteCard.js'
117120
118121import LoginButton from './LoginButton.vue'
119122
123+ import AuthMixin from '../../mixins/auth.js'
124+
120125export default {
121126 name: 'LoginForm',
122127
@@ -126,6 +131,7 @@ export default {
126131 NcTextField,
127132 NcNoteCard,
128133 },
134+ mixins: [AuthMixin],
129135
130136 props: {
131137 username: {
@@ -160,7 +166,7 @@ export default {
160166 type: Array,
161167 default() {
162168 return []
163- }
169+ },
164170 },
165171 },
166172
Original file line number Diff line number Diff line change 2525 <NcTextField id="user"
2626 :value.sync="user"
2727 name="user"
28+ :maxlength="255"
2829 autocapitalize="off"
2930 :label="t('core', 'Login or email')"
31+ :error="userNameInputLengthIs255"
32+ :helper-text="userInputHelperText"
3033 required
3134 @change="updateUsername" />
3235 <LoginButton :value="t('core', 'Reset password')" />
@@ -60,13 +63,16 @@ import LoginButton from './LoginButton.vue'
6063import NcTextField from '@nextcloud/vue/dist/Components/NcTextField.js'
6164import NcNoteCard from '@nextcloud/vue/dist/Components/NcNoteCard.js'
6265
66+ import AuthMixin from '../../mixins/auth.js'
67+
6368export default {
6469 name: 'ResetPassword',
6570 components: {
6671 LoginButton,
6772 NcNoteCard,
6873 NcTextField,
6974 },
75+ mixins: [AuthMixin],
7076 props: {
7177 username: {
7278 type: String,
Original file line number Diff line number Diff line change 1+ /**
2+ * @copyright Copyright (c) 2024 Fon E. Noel NFEBE <opensource@nfebe.com>
3+ *
4+ * @author Fon E. Noel NFEBE <opensource@nfebe.com>
5+ *
6+ * @license AGPL-3.0-or-later
7+ *
8+ * This program is free software: you can redistribute it and/or modify
9+ * it under the terms of the GNU Affero General Public License as
10+ * published by the Free Software Foundation, either version 3 of the
11+ * License, or (at your option) any later version.
12+ *
13+ * This program is distributed in the hope that it will be useful,
14+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
15+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16+ * GNU Affero General Public License for more details.
17+ *
18+ * You should have received a copy of the GNU Affero General Public License
19+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
20+ *
21+ */
22+
23+ export default {
24+
25+ computed: {
26+ userNameInputLengthIs255() {
27+ return this.user.length >= 255
28+ },
29+ userInputHelperText() {
30+ if (this.userNameInputLengthIs255) {
31+ return t('core', 'Email length is at max (255)')
32+ }
33+ return undefined
34+ },
35+ },
36+ }
You can’t perform that action at this time.
0 commit comments