pari: branch 2.0 r4065 - /branches/2.0/config/smtp_settings.html

SVN commits to the Asterisk-GUI project asterisk-gui-commits at lists.digium.com
Tue Nov 4 20:05:05 CST 2008


Author: pari
Date: Tue Nov  4 20:05:04 2008
New Revision: 4065

URL: http://svn.digium.com/view/asterisk-gui?view=rev&rev=4065
Log:

 Add smtp authentication settings for AA50 (ssmtp)

 Thanks to 'Matt Gibson' on Asterisk-users for pointing to a ssmtp configuration tutorial




Modified:
    branches/2.0/config/smtp_settings.html

Modified: branches/2.0/config/smtp_settings.html
URL: http://svn.digium.com/view/asterisk-gui/branches/2.0/config/smtp_settings.html?view=diff&rev=4065&r1=4064&r2=4065
==============================================================================
--- branches/2.0/config/smtp_settings.html (original)
+++ branches/2.0/config/smtp_settings.html Tue Nov  4 20:05:04 2008
@@ -33,11 +33,23 @@
 
 	top.document.title = "SMTP Settings";
 
+	ASTGUI.domActions.enableDisableByCheckBox('chk_UseAuthentication', ['AuthUser','AuthPass'] ) ;
+
 	var c = config2json({filename:ASTGUI.globals.configfile , usf:1});
 	if( c['general'] ){
 		_$('smtp_server').value = (c['general']['smtp_server']) ? c['general']['smtp_server'] : '';
 		_$('smtp_port').value = (c['general']['smtp_port']) ? c['general']['smtp_port'] : '';
+
+		if(c['general']['smtp_AuthUser'] ){
+			_$('chk_UseAuthentication').checked = true ;
+			_$('AuthUser').value = c['general']['smtp_AuthUser'] ;
+			_$('AuthPass').value = (c['general']['smtp_AuthPass']) ? c['general']['AuthPass'] : '';
+		}else{
+			_$('chk_UseAuthentication').checked = false ;
+		}
+		_$('chk_UseAuthentication').updateStatus();
 	}
+
 }
 
 
@@ -45,16 +57,35 @@
 	var u = new listOfSynActions(ASTGUI.globals.configfile) ;
 	u.new_action('update', 'general', 'smtp_server', _$('smtp_server').value );
 	u.new_action('update', 'general', 'smtp_port', _$('smtp_port').value );
+	if( _$('chk_UseAuthentication').checked ){
+		u.new_action('update', 'general', 'smtp_AuthUser', _$('AuthUser').value );
+		u.new_action('update', 'general', 'smtp_AuthPass', _$('AuthPass').value );
+	}
 	u.callActions();
 
 	var smtpport = ( parseInt(_$('smtp_port').value, 10 ) ) ? _$('smtp_port').value : '25' ;
 	var cmd1 = "echo \"mailhub=" + _$('smtp_server').value + ":" + smtpport + "\" > /etc/ssmtp/ssmtp.conf ";
 	var cmd2 = "echo \"FromLineOverride=YES\" >> /etc/ssmtp/ssmtp.conf ";
+	var cmd3 = "" , cmd4 = "";
 
-	parent.ASTGUI.systemCmd( cmd1, function(){ 
+	if( _$('chk_UseAuthentication').checked ){
+		cmd3 = "echo \"AuthUser=" + _$('AuthUser').value + "\" >> /etc/ssmtp/ssmtp.conf ";
+		cmd4 = "echo \"AuthPass=" + _$('AuthPass').value + "\" >> /etc/ssmtp/ssmtp.conf ";
+	}
+
+	parent.ASTGUI.systemCmd( cmd1, function(){
 		parent.ASTGUI.systemCmd( cmd2, function(){
-			ASTGUI.feedback( { msg:'Changes Saved !! ', showfor:2 });
-			window.location.reload();
+			if(cmd3){
+				parent.ASTGUI.systemCmd( cmd3, function(){
+					parent.ASTGUI.systemCmd( cmd4, function(){
+						ASTGUI.feedback( { msg:'Changes Saved !! ', showfor:2 });
+						window.location.reload();
+					});
+				});
+			}else{
+				ASTGUI.feedback( { msg:'Changes Saved !! ', showfor:2 });
+				window.location.reload();
+			}
 		});
 	});
 }
@@ -78,6 +109,15 @@
 <tr>	<td align=right>Port <img src="images/tooltip_info.gif" tip="en,voicemail,17" class='tooltipinfo'>:</td>
 	<td>&nbsp;<input id="smtp_port"></td>
 </tr>
+<tr>	<td align=right>Use SMTP Authentication :</td>
+	<td>&nbsp;<input id="chk_UseAuthentication" type='checkbox'></td>
+</tr>
+<tr>	<td align=right>Auth User :</td>
+	<td>&nbsp;<input id="AuthUser"></td>
+</tr>
+<tr>	<td align=right>Auth Password :</td>
+	<td>&nbsp;<input id="AuthPass"></td>
+</tr>
 <tr>	<td colspan=2 align="center">
 		<div height="10"></div><BR>
 		<span class='guiButtonCancel' onclick='window.location.reload();'>Cancel</span>




More information about the asterisk-gui-commits mailing list