Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions lib/Controller/AccountsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,12 @@ public function create(string $accountName,
$this->logger->info('Creating account disabled by admin.');
return MailJsonResponse::error('Could not create account');
}
if (empty($this->accountService->findByUserIdAndAddress($this->userId, $emailAddress)) === false) {
$this->logger->info('Trying to create already existing account.');
return MailJsonResponse::fail([
'error' => 'ACCOUNT_EXISTS',
]);
}
if (!$this->hostValidator->isValid($imapHost)) {
$this->logger->debug('Prevented access to invalid IMAP host', [
'host' => $imapHost,
Expand Down
2 changes: 2 additions & 0 deletions src/components/AccountForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@
<h4>{{ t('mail', 'SMTP Settings') }}</h4>
<NcInputField
id="man-smtp-host"
ref="smtpHost"

Check warning on line 150 in src/components/AccountForm.vue

View workflow job for this annotation

GitHub Actions / NPM lint

'smtpHost' is defined as ref, but never used
v-model="manualConfig.smtpHost"
:label="t('mail', 'SMTP Host')"
type="text"
Expand Down Expand Up @@ -692,6 +692,8 @@
} else if (error.data.service === 'SMTP') {
this.feedback = t('mail', 'SMTP server is not reachable')
}
} else if (error.data?.error === 'ACCOUNT_EXISTS') {
this.feedback = t('mail', 'Account already exists')
} else if (error.data?.error === 'AUTHENTICATION_WRONG_PASSWORD') {
if (error.data.service === 'IMAP') {
this.feedback = t('mail', 'IMAP username or password is wrong')
Expand Down
Loading