rbrindley: branch 2.0 r4906 - /branches/2.0/config/home.html
SVN commits to the Asterisk-GUI project
asterisk-gui-commits at lists.digium.com
Tue Jun 23 09:42:16 CDT 2009
Author: rbrindley
Date: Tue Jun 23 09:42:13 2009
New Revision: 4906
URL: http://svn.asterisk.org/svn-view/asterisk-gui?view=rev&rev=4906
Log:
- Added the following to the Login page
- HTML 4.01 DOCTYPE
- <html>, <head>, <title>, and "Content-Type" <meta>
- moved js to the bottom
Modified:
branches/2.0/config/home.html
Modified: branches/2.0/config/home.html
URL: http://svn.asterisk.org/svn-view/asterisk-gui/branches/2.0/config/home.html?view=diff&rev=4906&r1=4905&r2=4906
==============================================================================
--- branches/2.0/config/home.html (original)
+++ branches/2.0/config/home.html Tue Jun 23 09:42:13 2009
@@ -1,3 +1,4 @@
+<!DOCTYPE html PUBLIC "-//W3C/DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--
* Asterisk-GUI - an Asterisk configuration interface
*
@@ -19,154 +20,159 @@
* at the top of the source tree.
*
-->
-<script>
+<html>
+<head>
+ <title>Login</title>
+ <meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1" />
-var setLoggedIn = function(a){
- DOM_statusbar.innerHTML = '<img src=images/tick.gif border=0> Connected';
- DOM_login_button.innerHTML = 'Logout';
- parent.ASTGUI.dialog.hide();
- DOM_username.disabled = true;
- DOM_secret.disabled = true ;
- try{ if (a.welcome_redirect == true){ window.location.href = 'welcome.html'; } }catch(err){ }
-};
+ <link href="stylesheets/schwing.css" media="all" rel="Stylesheet" type="text/css" />
+</head>
+<body topmargin=0 bgcolor="EFEFEF">
-var localajaxinit = function(){
- DOM_username = _$('username');
- DOM_secret = _$('secret');
- DOM_statusbar = _$('statusbar');
- DOM_login_button = _$('login_button');
+ <div class="iframeTitleBar">Welcome to the Asterisk™ Configuration Panel</div>
- if( parent.sessionData.isLoggedIn){
- if( ASTGUI.parseGETparam(window.location.href, 'status') == '1' ){
- setLoggedIn({ welcome_redirect : true });
+ <h2>Asterisk™ Configuration Engine</h2>
+
+ <table align="center" id='loginForm'>
+ <tr> <td colspan="2"><BR></td>
+ <tr> <td align=right>Username:</td>
+ <td><input id="username" size=12 autocomplete="off" disabled></td>
+ </tr>
+ <tr> <td align=right>Password:</td>
+ <td><input type="password" id="secret" size=12 onKeyUp="home_miscFunctions.submitOnEnter(event)" disabled></td>
+ </tr>
+ <tr> <td align='center' colspan='2'>
+ <span class='guiButton' onclick="doLogin();" id='login_button'>Login</span>
+ </td>
+ </tr>
+ </table>
+
+ <table align="center" id='changePasswordForm' style='display:none;'>
+ <tr> <td colspan="2" align='center' class='lite'><b>Change Password</b></td>
+ <tr> <td align=right>New Password:</td>
+ <td><input id="new_password" size=12 type='password' field_name='Password' validation='alphanumeric'></td>
+ </tr>
+ <tr> <td align=right>Retype New Password:</td>
+ <td><input id="new_password_retype" size=12 type='password' onKeyUp="home_miscFunctions.updateOnEnter(event)"></td>
+ </tr>
+ <tr> <td align='center' colspan='2'>
+ <span class='guiButton' onclick="updatePassword();">Update Password</span>
+ </td>
+ </tr>
+ </table>
+
+ <div width='95%' style='text-align:center; margin-top:20px;'>
+ <span id="statusbar"> </span>
+ </div>
+
+ <script src="js/astman.js"></script>
+ <script src="js/jquery.js"></script>
+ <script>
+
+ var setLoggedIn = function(a){
+ DOM_statusbar.innerHTML = '<img src=images/tick.gif border=0> Connected';
+ DOM_login_button.innerHTML = 'Logout';
+ parent.ASTGUI.dialog.hide();
+ DOM_username.disabled = true;
+ DOM_secret.disabled = true ;
+ try{ if (a.welcome_redirect == true){ window.location.href = 'welcome.html'; } }catch(err){ }
+ };
+
+ var localajaxinit = function(){
+ DOM_username = _$('username');
+ DOM_secret = _$('secret');
+ DOM_statusbar = _$('statusbar');
+ DOM_login_button = _$('login_button');
+
+ if( parent.sessionData.isLoggedIn){
+ if( ASTGUI.parseGETparam(window.location.href, 'status') == '1' ){
+ setLoggedIn({ welcome_redirect : true });
+ }else{
+ setLoggedIn({ welcome_redirect : false });
+ }
}else{
- setLoggedIn({ welcome_redirect : false });
+ DOM_username.disabled = false;
+ DOM_secret.disabled = false;
+ DOM_username.focus();
}
- }else{
- DOM_username.disabled = false;
- DOM_secret.disabled = false;
- DOM_username.focus();
}
-}
-function doLogin(){
- if( parent.sessionData.isLoggedIn == true ){
- parent.miscFunctions.logoutFunction.confirmlogout();
- return ;
+ function doLogin(){
+ if( parent.sessionData.isLoggedIn == true ){
+ parent.miscFunctions.logoutFunction.confirmlogout();
+ return ;
+ }
+ var f = makeSyncRequest({ action :'login', username: DOM_username.value, secret: DOM_secret.value });
+ f = f.toLowerCase();
+ if(f.match('authentication accepted')){
+ top.log.debug("Login Success result: " + f);
+ setLoggedIn( { welcome_redirect: false } );
+ DOM_secret.blur();
+ parent.ASTGUI.dialog.waitWhile(' <font color=#005119><b>Login Success</b></font>');
+ ASTGUI.feedback({msg:'Login Success', showfor: 4 , color: '#5D7CBA', bgcolor: '#FFFFFF'}) ;
+ top.cookies.set('username', DOM_username.value );
+
+ if( DOM_secret.value == 'password'){
+ ASTGUI.feedback({msg:'Your are using the default password.<BR> Please choose a new password', showfor: 7 , color: '#672b13'}) ;
+ parent.onLogInFunctions.makePings.start();
+ parent.ASTGUI.dialog.hide();
+ _$('loginForm').style.display = 'none';
+ _$('changePasswordForm').style.display = '';
+ _$('new_password').focus();
+
+ }else{
+ parent.onLogInFunctions.checkifLoggedIn();
+ }
+ return;
+ }else if(f.match('authentication failed') ) {
+ top.log.debug("Login failure result: " + f);
+ ASTGUI.feedback({msg:'Invalid Username or Password', showfor: 4, color:'#c42421'}) ;
+ DOM_secret.focus();
+ DOM_secret.select();
+ }
}
- var f = makeSyncRequest({ action :'login', username: DOM_username.value, secret: DOM_secret.value });
- f = f.toLowerCase();
- if(f.match('authentication accepted')){
- top.log.debug("Login Success result: " + f);
- setLoggedIn( { welcome_redirect: false } );
- DOM_secret.blur();
- parent.ASTGUI.dialog.waitWhile(' <font color=#005119><b>Login Success</b></font>');
- ASTGUI.feedback({msg:'Login Success', showfor: 4 , color: '#5D7CBA', bgcolor: '#FFFFFF'}) ;
- top.cookies.set('username', DOM_username.value );
-
- if( DOM_secret.value == 'password'){
- ASTGUI.feedback({msg:'Your are using the default password.<BR> Please choose a new password', showfor: 7 , color: '#672b13'}) ;
- parent.onLogInFunctions.makePings.start();
- parent.ASTGUI.dialog.hide();
- _$('loginForm').style.display = 'none';
- _$('changePasswordForm').style.display = '';
- _$('new_password').focus();
-
- }else{
- parent.onLogInFunctions.checkifLoggedIn();
- }
- return;
- }else if(f.match('authentication failed') ) {
- top.log.debug("Login failure result: " + f);
- ASTGUI.feedback({msg:'Invalid Username or Password', showfor: 4, color:'#c42421'}) ;
- DOM_secret.focus();
- DOM_secret.select();
- }
-}
-var home_miscFunctions = {
- submitOnEnter: function (e){
- if(e.keyCode == 13){
- doLogin();
- return false;
+ var home_miscFunctions = {
+ submitOnEnter: function (e){
+ if(e.keyCode == 13){
+ doLogin();
+ return false;
+ }
+ },
+ updateOnEnter: function (e){
+ if(e.keyCode == 13){
+ updatePassword();
+ return false;
+ }
}
- },
- updateOnEnter: function (e){
- if(e.keyCode == 13){
- updatePassword();
- return false;
- }
- }
-};
+ };
-var updatePassword = function(){
- var CURRENT_Username = top.cookies.get('username');
- var u = new listOfSynActions('manager.conf') ;
+ var updatePassword = function(){
+ var CURRENT_Username = top.cookies.get('username');
+ var u = new listOfSynActions('manager.conf') ;
- var newp = ASTGUI.getFieldValue('new_password');
- var newp_rt = ASTGUI.getFieldValue('new_password_retype');
- if ( !ASTGUI.validateFields( [ 'new_password' ] ) ){
- return ;
+ var newp = ASTGUI.getFieldValue('new_password');
+ var newp_rt = ASTGUI.getFieldValue('new_password_retype');
+ if ( !ASTGUI.validateFields( [ 'new_password' ] ) ){
+ return ;
+ }
+ if( newp.length < 4 ){
+ ASTGUI.highlightField( 'new_password' , 'Password must be atleast 4 digits');
+ return;
+ }
+ if( newp != newp_rt ){
+ ASTGUI.highlightField( 'new_password' , 'Passwords do not match');
+ return;
+ }
+ u.new_action('update', CURRENT_Username, 'secret', newp );
+ u.callActions();
+ ASTGUI.feedback( { msg:"Password Updated Successfully", showfor:3 });
+ alert("Password Updated Successfully!! \n\n You will now be redirected to the login page \n You must relogin using your new password") ;
+ var f = makeSyncRequest({ action :'logoff'});
+ parent.window.location.reload();
}
- if( newp.length < 4 ){
- ASTGUI.highlightField( 'new_password' , 'Password must be atleast 4 digits');
- return;
- }
- if( newp != newp_rt ){
- ASTGUI.highlightField( 'new_password' , 'Passwords do not match');
- return;
- }
- u.new_action('update', CURRENT_Username, 'secret', newp );
- u.callActions();
- ASTGUI.feedback( { msg:"Password Updated Successfully", showfor:3 });
- alert("Password Updated Successfully!! \n\n You will now be redirected to the login page \n You must relogin using your new password") ;
- var f = makeSyncRequest({ action :'logoff'});
- parent.window.location.reload();
-}
-
-
-</script>
-<script src="js/astman.js"></script>
-<script src="js/jquery.js"></script>
-<link href="stylesheets/schwing.css" media="all" rel="Stylesheet" type="text/css" />
-<body topmargin=0 bgcolor="EFEFEF">
-
-<div class="iframeTitleBar">Welcome to the Asterisk™ Configuration Panel</div>
-
-<h2>Asterisk™ Configuration Engine</h2>
-
-<table align="center" id='loginForm'>
- <tr> <td colspan="2"><BR></td>
- <tr> <td align=right>Username:</td>
- <td><input id="username" size=12 autocomplete="off" disabled></td>
- </tr>
- <tr> <td align=right>Password:</td>
- <td><input type="password" id="secret" size=12 onKeyUp="home_miscFunctions.submitOnEnter(event)" disabled></td>
- </tr>
- <tr> <td align='center' colspan='2'>
- <span class='guiButton' onclick="doLogin();" id='login_button'>Login</span>
- </td>
- </tr>
-</table>
-
-<table align="center" id='changePasswordForm' style='display:none;'>
- <tr> <td colspan="2" align='center' class='lite'><b>Change Password</b></td>
- <tr> <td align=right>New Password:</td>
- <td><input id="new_password" size=12 type='password' field_name='Password' validation='alphanumeric'></td>
- </tr>
- <tr> <td align=right>Retype New Password:</td>
- <td><input id="new_password_retype" size=12 type='password' onKeyUp="home_miscFunctions.updateOnEnter(event)"></td>
- </tr>
- <tr> <td align='center' colspan='2'>
- <span class='guiButton' onclick="updatePassword();">Update Password</span>
- </td>
- </tr>
-</table>
-
-<div width='95%' style='text-align:center; margin-top:20px;'>
- <span id="statusbar"> </span>
-</div>
-
+ </script>
</body>
+</html>
More information about the asterisk-gui-commits
mailing list