mirror of
https://github.com/danielbrendel/hortusfox-web.git
synced 2026-01-06 04:40:13 -06:00
Resolves #406
This commit is contained in:
@@ -145,6 +145,7 @@ return [
|
||||
array('/admin/media/overlay/alpha', 'POST', 'admin@save_overlay_alpha'),
|
||||
array('/admin/media/sound/message', 'POST', 'admin@upload_media_sound_message'),
|
||||
array('/admin/mail/save', 'POST', 'admin@save_mail_settings'),
|
||||
array('/admin/mail/test', 'ANY', 'admin@send_test_email'),
|
||||
array('/admin/themes/import', 'POST', 'admin@import_theme'),
|
||||
array('/admin/themes/remove', 'POST', 'admin@remove_theme'),
|
||||
array('/admin/backup/cronjob/save', 'POST', 'admin@save_backup_cronjob_settings'),
|
||||
|
||||
@@ -782,6 +782,35 @@ class AdminController extends BaseController {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles URL: /admin/mail/test
|
||||
*
|
||||
* @param Asatru\Controller\ControllerArg $request
|
||||
* @return Asatru\View\JsonHandler
|
||||
*/
|
||||
public function send_test_email($request)
|
||||
{
|
||||
try {
|
||||
$user = UserModel::getAuthUser();
|
||||
|
||||
$mailobj = new Asatru\SMTPMailer\SMTPMailer();
|
||||
$mailobj->setRecipient($user->get('email'));
|
||||
$mailobj->setSubject('[' . env('APP_NAME') . '] Test E-Mail');
|
||||
$mailobj->setView('mail/mail_layout', [['mail_content', 'mail/mail_admintest']], ['user' => $user]);
|
||||
$mailobj->setProperties(mail_properties());
|
||||
$mailobj->send();
|
||||
|
||||
return json([
|
||||
'code' => 200
|
||||
]);
|
||||
} catch (\Exception $e) {
|
||||
return json([
|
||||
'code' => 500,
|
||||
'msg' => $e->getMessage()
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Handles URL: /admin/cronjob/token
|
||||
*
|
||||
|
||||
@@ -484,5 +484,7 @@ return [
|
||||
'confirm_set_gallery_photo_as_main' => 'Do you want to replace the main photo with this one?',
|
||||
'enable_quick_add' => 'Enable Quick-Add widget',
|
||||
'clear_cache' => 'Clear cache',
|
||||
'schema_attribute_already_exists' => 'There is already an attribute with the given label'
|
||||
'schema_attribute_already_exists' => 'There is already an attribute with the given label',
|
||||
'send_test_mail' => 'Send test mail',
|
||||
'confirm_test_mail' => 'Do you want to send a test e-mail to {mail}?'
|
||||
];
|
||||
@@ -96,6 +96,7 @@ window.vue = new Vue({
|
||||
loadMore: 'Load more',
|
||||
operationSucceeded: 'Operation succeeded',
|
||||
copiedToClipboard: 'Content has been copied to clipboard.',
|
||||
origTestMailButtonContent: '',
|
||||
chatTypingEnable: false,
|
||||
chatTypingTimer: null,
|
||||
chatTypingHide: null,
|
||||
@@ -1937,6 +1938,22 @@ window.vue = new Vue({
|
||||
});
|
||||
},
|
||||
|
||||
sendTestMail: function(button) {
|
||||
if (window.vue.origTestMailButtonContent === '') {
|
||||
window.vue.origTestMailButtonContent = button.innerHTML;
|
||||
}
|
||||
|
||||
button.innerHTML = '<i class="fas fa-spinner fa-spin"></i> ' + window.vue.origTestMailButtonContent;
|
||||
|
||||
window.vue.ajaxRequest('post', window.location.origin + '/admin/mail/test', {}, function(response) {
|
||||
if (response.code == 200) {
|
||||
button.innerHTML = '<i class="fas fa-check"></i> ' + window.vue.origTestMailButtonContent;
|
||||
} else {
|
||||
alert(response.msg);
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
scrollTo: function(target) {
|
||||
let elem = document.querySelector(target);
|
||||
if (elem) {
|
||||
|
||||
@@ -695,7 +695,10 @@
|
||||
|
||||
<div class="field">
|
||||
<div class="control">
|
||||
<input type="submit" class="button is-success" value="{{ __('app.save') }}"/>
|
||||
<span>
|
||||
<input type="submit" class="button is-success" value="{{ __('app.save') }}"/>
|
||||
<a class="button is-warning" href="javascript:void(0);" onclick="if (confirm('{{ __('app.confirm_test_mail', ['mail' => $user->get('email')]) }}')) { window.vue.sendTestMail(this); } return false;">{{ __('app.send_test_mail') }}</a>
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
9
app/views/mail/mail_admintest.php
Normal file
9
app/views/mail/mail_admintest.php
Normal file
@@ -0,0 +1,9 @@
|
||||
<h1>{{ app('workspace') }}</h1>
|
||||
|
||||
<p>
|
||||
{{ __('app.hortusfox_version', ['version' => config('version')]) }}<br/>
|
||||
{{ __('app.php_version', ['version' => phpversion()]) }}<br/>
|
||||
{{ __('app.mysql_version', ['version' => VersionModel::getSqlVersion()]) }}<br/>
|
||||
{{ __('app.server_system_info', ['osn' => php_uname('s'), 'osv' => php_uname('v'), 'mt' => php_uname('m')]) }}<br/>
|
||||
{{ __('app.server_timezone', ['time' => date('Y-m-d H:i') . ' (' . date_default_timezone_get() . ')']) }}<br/>
|
||||
</p>
|
||||
2
public/js/app.js
vendored
2
public/js/app.js
vendored
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user