summaryrefslogtreecommitdiffstats
path: root/settings/js
diff options
context:
space:
mode:
authorJoas Schilling <coding@schilljs.com>2017-04-18 15:44:20 +0200
committerJoas Schilling <coding@schilljs.com>2017-04-18 15:44:20 +0200
commita5b4308a517a66b320ba69be8604144ce74f417e (patch)
treeef952ee37dd149322cbacea72ce1e099c32bcc2f /settings/js
parentb072d2c49d6f61c2b55abf12e04bdf2166dbd4f4 (diff)
downloadnextcloud-server-a5b4308a517a66b320ba69be8604144ce74f417e.tar.gz
nextcloud-server-a5b4308a517a66b320ba69be8604144ce74f417e.zip
Don't put the SMTP password into the HTML code
Signed-off-by: Joas Schilling <coding@schilljs.com>
Diffstat (limited to 'settings/js')
-rw-r--r--settings/js/admin.js36
1 files changed, 27 insertions, 9 deletions
diff --git a/settings/js/admin.js b/settings/js/admin.js
index 985e318e34b..475fecf604e 100644
--- a/settings/js/admin.js
+++ b/settings/js/admin.js
@@ -186,11 +186,11 @@ $(document).ready(function(){
url: OC.generateUrl('/settings/admin/mailsettings'),
type: 'POST',
data: $('#mail_general_settings_form').serialize(),
- success: function(data){
- OC.msg.finishedSaving('#mail_settings_msg', data);
+ success: function(){
+ OC.msg.finishedSuccess('#mail_settings_msg', t('settings', 'Saved'));
},
- error: function(data){
- OC.msg.finishedError('#mail_settings_msg', data.responseJSON.message);
+ error: function(xhr){
+ OC.msg.finishedError('#mail_settings_msg', xhr.responseJSON);
}
});
};
@@ -206,21 +206,39 @@ $(document).ready(function(){
url: OC.generateUrl('/settings/admin/mailsettings/credentials'),
type: 'POST',
data: $('#mail_credentials_settings').serialize(),
- success: function(data){
- OC.msg.finishedSaving('#mail_settings_msg', data);
+ success: function(){
+ OC.msg.finishedSuccess('#mail_settings_msg', t('settings', 'Saved'));
},
- error: function(data){
- OC.msg.finishedError('#mail_settings_msg', data.responseJSON.message);
+ error: function(xhr){
+ OC.msg.finishedError('#mail_settings_msg', xhr.responseJSON);
}
});
};
$('#mail_general_settings_form').change(changeEmailSettings);
$('#mail_credentials_settings_submit').click(toggleEmailCredentials);
+ $('#mail_smtppassword').click(function() {
+ if (this.type === 'text' && this.value === '********') {
+ this.type = 'password';
+ this.value = '';
+ }
+ });
$('#sendtestemail').click(function(event){
event.preventDefault();
- OC.msg.startAction('#sendtestmail_msg', t('settings', 'Sending...'));
+ OC.msg.startAction('#sendtestmail_msg', t('settings', 'Sending…'));
+
+ $.ajax({
+ url: OC.generateUrl('/settings/admin/mailtest'),
+ type: 'POST',
+ data: $('#mail_credentials_settings').serialize(),
+ success: function(){
+ OC.msg.finishedSuccess('#sendtestmail_msg', t('settings', 'Email sent'));
+ },
+ error: function(xhr){
+ OC.msg.finishedError('#sendtestmail_msg', xhr.responseJSON);
+ }
+ });
$.post(OC.generateUrl('/settings/admin/mailtest'), '', function(data){
OC.msg.finishedAction('#sendtestmail_msg', data);
});