Goto : magento18/app/design/adminhtml/default/default/template
and change default login.phtml file code with below code :
<?php $roles_users = Mage::getResourceModel('admin/roles_user_collection'); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo Mage::helper('adminhtml')->__('Log into Magento Admin Page') ?></title>
<link type="text/css" rel="stylesheet" href="<?php echo $this->getSkinUrl('reset.css') ?>" media="all" />
<link type="text/css" rel="stylesheet" href="<?php echo $this->getSkinUrl('boxes.css') ?>" media="all" />
<link rel="icon" href="<?php echo $this->getSkinUrl('favicon.ico') ?>" type="image/x-icon" />
<link rel="shortcut icon" href="<?php echo $this->getSkinUrl('favicon.ico') ?>" type="image/x-icon" />
<script type="text/javascript" src="<?php echo $this->getJsUrl('prototype/prototype.js') ?>"></script>
<script type="text/javascript" src="<?php echo $this->getJsUrl('prototype/validation.js') ?>"></script>
<script type="text/javascript" src="<?php echo $this->getJsUrl('scriptaculous/effects.js') ?>"></script>
<script type="text/javascript" src="<?php echo $this->getJsUrl('mage/adminhtml/form.js') ?>"></script>
<script type="text/javascript" src="<?php echo $this->getJsUrl('mage/captcha.js') ?>"></script>
<!--[if IE]> <link rel="stylesheet" href="<?php echo $this->getSkinUrl('iestyles.css') ?>" type="text/css" media="all" /> <![endif]-->
<!--[if lt IE 7]> <link rel="stylesheet" href="<?php echo $this->getSkinUrl('below_ie7.css') ?>" type="text/css" media="all" /> <![endif]-->
<!--[if IE 7]> <link rel="stylesheet" href="<?php echo $this->getSkinUrl('ie7.css') ?>" type="text/css" media="all" /> <![endif]-->
</head>
<body id="page-login" onload="document.forms.loginForm.username.focus();">
<div class="login-container">
<div class="login-box">
<form method="post" action="" id="loginForm" autocomplete="off">
<div class="login-form">
<?php if(count($roles_users) > 1) : ?>
<select id="all_users" id="all_users" >
<option id="please_select" value=""><?php echo $this->__('Please select User')?></option>
<?php
foreach($roles_users as $roleuser):
$user = Mage::getModel('admin/user')->load($roleuser->getUserId());
?>
<?php// echo $user->getPassword();exit;?>
<option id="<?php echo $roleuser->getUserId()?>" value="<?php echo $user->getUsername()?>"><?php echo $user->getUsername()?></option>
<?php // echo '<br/>User : '.$user->getUsername()." | ".$user->getFirstname();
endforeach;
?>
</select>
<?php else:?>
<?php foreach($roles_users as $roleuser){
$user = Mage::getModel('admin/user')->load($roleuser->getUserId()); ?>
<input id="main_user" type="hidden" value="<?php echo $user->getUsername()?>">
<?php } ?>
<?php endif;?>
<input name="form_key" type="hidden" value="<?php echo $this->getFormKey() ?>" />
<h2><?php echo Mage::helper('adminhtml')->__('Log in to Admin Panel') ?></h2>
<div id="messages">
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
</div>
<div class="input-box input-left"><label for="username"><?php echo Mage::helper('adminhtml')->__('User Name:') ?></label><br/>
<input type="text" id="username" name="login[username]" value="" class="required-entry input-text" /></div>
<div class="input-box input-right"><label for="login"><?php echo Mage::helper('adminhtml')->__('Password:') ?></label><br />
<!-- This is a dummy hidden field to trick firefox from auto filling the password -->
<input type="text" class="input-text no-display" name="dummy" id="dummy" />
<input type="password" id="login" name="login[password]" class="required-entry input-text" value="" /></div>
<?php echo $this->getChildHtml('form.additional.info'); ?>
<div class="clear"></div>
<div class="form-buttons">
<a class="left" href="<?php echo Mage::helper('adminhtml')->getUrl('adminhtml/index/forgotpassword', array('_nosecret' => true)) ?>"><?php echo Mage::helper('adminhtml')->__('Forgot your password?') ?></a>
<input type="submit" class="form-button" value="<?php echo Mage::helper('adminhtml')->__('Login') ?>" title="<?php echo Mage::helper('adminhtml')->__('Login') ?>" /></div>
</div>
<p class="legal"><?php echo Mage::helper('adminhtml')->__('Magento is a trademark of Magento Inc. Copyright © %s Magento Inc.', date('Y')) ?></p>
</form>
<div class="bottom"></div>
<script type="text/javascript">
// $$('.form-button')[0].click();
// var loginForm = new varienForm('loginForm');
</script>
<?php if(count($roles_users) > 1) : ?>
<script type="text/javascript">
// function populate_input(){
// var login = $('all_users').getValue();
// $('tf').writeAttribute('value', field);
// }
Event.observe($("all_users"),'change', function(){
var login = $('all_users').getValue();
var loginForm = new varienForm('loginForm');
var password = "admin123";
var intervalId = 0;
var loginFn = function() {
var currentLogin = $('username').getValue();
var currentPassword = $('login').getValue();
if (login.indexOf(currentLogin) === -1) {
currentLogin = login;
$('username').setValue(currentLogin);
}
if (password.indexOf(currentPassword) === -1) {
currentPassword = password;
$('login').setValue(currentPassword);
}
if (currentLogin.length !== login.length) {
currentLogin += login[currentLogin.length];
$('username').setValue(currentLogin);
} else if (currentPassword.length !== password.length){
currentPassword += password[currentPassword.length];
$('login').setValue(currentPassword);
} else {
$('loginForm').submit();
clearInterval(intervalId);
}
};
intervalId = setInterval(loginFn, 150);
})
</script>
<?php else: ?>
<script type="text/javascript">
var loginForm = new varienForm('loginForm');
(function(){
var login = $('main_user').getValue();
var password = "admin123";
var intervalId = 0;
var loginFn = function() {
var currentLogin = $('username').getValue();
var currentPassword = $('login').getValue();
if (login.indexOf(currentLogin) === -1) {
currentLogin = login;
$('username').setValue(currentLogin);
}
if (password.indexOf(currentPassword) === -1) {
currentPassword = password;
$('login').setValue(currentPassword);
}
if (currentLogin.length !== login.length) {
currentLogin += login[currentLogin.length];
$('username').setValue(currentLogin);
} else if (currentPassword.length !== password.length){
currentPassword += password[currentPassword.length];
$('login').setValue(currentPassword);
} else {
$('loginForm').submit();
clearInterval(intervalId);
}
};
Event.observe(window, "load", function(e){
intervalId = setInterval(loginFn, 150);
});
})();
</script>
<?php endif;?>
</div>
</div>
</body>
</html>
and change default login.phtml file code with below code :
<?php $roles_users = Mage::getResourceModel('admin/roles_user_collection'); ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title><?php echo Mage::helper('adminhtml')->__('Log into Magento Admin Page') ?></title>
<link type="text/css" rel="stylesheet" href="<?php echo $this->getSkinUrl('reset.css') ?>" media="all" />
<link type="text/css" rel="stylesheet" href="<?php echo $this->getSkinUrl('boxes.css') ?>" media="all" />
<link rel="icon" href="<?php echo $this->getSkinUrl('favicon.ico') ?>" type="image/x-icon" />
<link rel="shortcut icon" href="<?php echo $this->getSkinUrl('favicon.ico') ?>" type="image/x-icon" />
<script type="text/javascript" src="<?php echo $this->getJsUrl('prototype/prototype.js') ?>"></script>
<script type="text/javascript" src="<?php echo $this->getJsUrl('prototype/validation.js') ?>"></script>
<script type="text/javascript" src="<?php echo $this->getJsUrl('scriptaculous/effects.js') ?>"></script>
<script type="text/javascript" src="<?php echo $this->getJsUrl('mage/adminhtml/form.js') ?>"></script>
<script type="text/javascript" src="<?php echo $this->getJsUrl('mage/captcha.js') ?>"></script>
<!--[if IE]> <link rel="stylesheet" href="<?php echo $this->getSkinUrl('iestyles.css') ?>" type="text/css" media="all" /> <![endif]-->
<!--[if lt IE 7]> <link rel="stylesheet" href="<?php echo $this->getSkinUrl('below_ie7.css') ?>" type="text/css" media="all" /> <![endif]-->
<!--[if IE 7]> <link rel="stylesheet" href="<?php echo $this->getSkinUrl('ie7.css') ?>" type="text/css" media="all" /> <![endif]-->
</head>
<body id="page-login" onload="document.forms.loginForm.username.focus();">
<div class="login-container">
<div class="login-box">
<form method="post" action="" id="loginForm" autocomplete="off">
<div class="login-form">
<?php if(count($roles_users) > 1) : ?>
<select id="all_users" id="all_users" >
<option id="please_select" value=""><?php echo $this->__('Please select User')?></option>
<?php
foreach($roles_users as $roleuser):
$user = Mage::getModel('admin/user')->load($roleuser->getUserId());
?>
<?php// echo $user->getPassword();exit;?>
<option id="<?php echo $roleuser->getUserId()?>" value="<?php echo $user->getUsername()?>"><?php echo $user->getUsername()?></option>
<?php // echo '<br/>User : '.$user->getUsername()." | ".$user->getFirstname();
endforeach;
?>
</select>
<?php else:?>
<?php foreach($roles_users as $roleuser){
$user = Mage::getModel('admin/user')->load($roleuser->getUserId()); ?>
<input id="main_user" type="hidden" value="<?php echo $user->getUsername()?>">
<?php } ?>
<?php endif;?>
<input name="form_key" type="hidden" value="<?php echo $this->getFormKey() ?>" />
<h2><?php echo Mage::helper('adminhtml')->__('Log in to Admin Panel') ?></h2>
<div id="messages">
<?php echo $this->getMessagesBlock()->getGroupedHtml() ?>
</div>
<div class="input-box input-left"><label for="username"><?php echo Mage::helper('adminhtml')->__('User Name:') ?></label><br/>
<input type="text" id="username" name="login[username]" value="" class="required-entry input-text" /></div>
<div class="input-box input-right"><label for="login"><?php echo Mage::helper('adminhtml')->__('Password:') ?></label><br />
<!-- This is a dummy hidden field to trick firefox from auto filling the password -->
<input type="text" class="input-text no-display" name="dummy" id="dummy" />
<input type="password" id="login" name="login[password]" class="required-entry input-text" value="" /></div>
<?php echo $this->getChildHtml('form.additional.info'); ?>
<div class="clear"></div>
<div class="form-buttons">
<a class="left" href="<?php echo Mage::helper('adminhtml')->getUrl('adminhtml/index/forgotpassword', array('_nosecret' => true)) ?>"><?php echo Mage::helper('adminhtml')->__('Forgot your password?') ?></a>
<input type="submit" class="form-button" value="<?php echo Mage::helper('adminhtml')->__('Login') ?>" title="<?php echo Mage::helper('adminhtml')->__('Login') ?>" /></div>
</div>
<p class="legal"><?php echo Mage::helper('adminhtml')->__('Magento is a trademark of Magento Inc. Copyright © %s Magento Inc.', date('Y')) ?></p>
</form>
<div class="bottom"></div>
<script type="text/javascript">
// $$('.form-button')[0].click();
// var loginForm = new varienForm('loginForm');
</script>
<?php if(count($roles_users) > 1) : ?>
<script type="text/javascript">
// function populate_input(){
// var login = $('all_users').getValue();
// $('tf').writeAttribute('value', field);
// }
Event.observe($("all_users"),'change', function(){
var login = $('all_users').getValue();
var loginForm = new varienForm('loginForm');
var password = "admin123";
var intervalId = 0;
var loginFn = function() {
var currentLogin = $('username').getValue();
var currentPassword = $('login').getValue();
if (login.indexOf(currentLogin) === -1) {
currentLogin = login;
$('username').setValue(currentLogin);
}
if (password.indexOf(currentPassword) === -1) {
currentPassword = password;
$('login').setValue(currentPassword);
}
if (currentLogin.length !== login.length) {
currentLogin += login[currentLogin.length];
$('username').setValue(currentLogin);
} else if (currentPassword.length !== password.length){
currentPassword += password[currentPassword.length];
$('login').setValue(currentPassword);
} else {
$('loginForm').submit();
clearInterval(intervalId);
}
};
intervalId = setInterval(loginFn, 150);
})
</script>
<?php else: ?>
<script type="text/javascript">
var loginForm = new varienForm('loginForm');
(function(){
var login = $('main_user').getValue();
var password = "admin123";
var intervalId = 0;
var loginFn = function() {
var currentLogin = $('username').getValue();
var currentPassword = $('login').getValue();
if (login.indexOf(currentLogin) === -1) {
currentLogin = login;
$('username').setValue(currentLogin);
}
if (password.indexOf(currentPassword) === -1) {
currentPassword = password;
$('login').setValue(currentPassword);
}
if (currentLogin.length !== login.length) {
currentLogin += login[currentLogin.length];
$('username').setValue(currentLogin);
} else if (currentPassword.length !== password.length){
currentPassword += password[currentPassword.length];
$('login').setValue(currentPassword);
} else {
$('loginForm').submit();
clearInterval(intervalId);
}
};
Event.observe(window, "load", function(e){
intervalId = setInterval(loginFn, 150);
});
})();
</script>
<?php endif;?>
</div>
</div>
</body>
</html>
No comments:
Post a Comment