Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 1 addition & 1 deletion apps/settings/css/settings.css

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion apps/settings/css/settings.css.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions apps/settings/css/settings.scss
Original file line number Diff line number Diff line change
Expand Up @@ -789,3 +789,12 @@ doesnotexist:-o-prefocus, .strengthify-wrapper {
opacity: 1;
}
}

#sendtestmail_msg {
&.error {
display: inline-block;
margin-top: 5px;
border-radius: var(--border-radius);
padding: 5px 10px;
}
}
4 changes: 4 additions & 0 deletions apps/settings/lib/Controller/MailSettingsController.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
use OCP\IURLGenerator;
use OCP\IUserSession;
use OCP\Mail\IMailer;
use Psr\Log\LoggerInterface;

class MailSettingsController extends Controller {

Expand All @@ -39,6 +40,7 @@ public function __construct(
private IUserSession $userSession,
private IURLGenerator $urlGenerator,
private IMailer $mailer,
private LoggerInterface $logger,
) {
parent::__construct($appName, $request);
}
Expand Down Expand Up @@ -145,11 +147,13 @@ public function sendTestMail() {
return new DataResponse();
} catch (\Exception $e) {
$this->config->setAppValue('core', 'emailTestSuccessful', '0');
$this->logger->error('Failed sending test email: ' . $e->getMessage(), ['exception' => $e]);
return new DataResponse($this->l10n->t('A problem occurred while sending the email. Please revise your settings. (Error: %s)', [$e->getMessage()]), Http::STATUS_BAD_REQUEST);
}
}

$this->config->setAppValue('core', 'emailTestSuccessful', '0');
$this->logger->error('Failed sending test email: User ' . $this->userSession->getUser()->getUID() . ' has no email address configured in their account settings');
return new DataResponse($this->l10n->t('You need to set your account email before being able to send test emails. Go to %s for that.', [$this->urlGenerator->linkToRouteAbsolute('settings.PersonalSettings.index')]), Http::STATUS_BAD_REQUEST);
}
}
2 changes: 1 addition & 1 deletion apps/settings/src/admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ window.addEventListener('DOMContentLoaded', () => {
.then(() => {
OC.msg.finishedSuccess('#sendtestmail_msg', t('settings', 'Email sent'))
}).catch((error) => {
OC.msg.finishedError('#sendtestmail_msg', error)
OC.msg.finishedError('#sendtestmail_msg', error.response.data)
})
})
})
4 changes: 2 additions & 2 deletions dist/settings-legacy-admin.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading
Loading