邮件服务器-邮件系统-邮件技术论坛(BBS)
标题:
是否可以在kerio的webmail上加个验证码
[打印本页]
作者:
dosimple
时间:
2009-11-27 12:35
标题:
是否可以在kerio的webmail上加个验证码
是否有懂php的在webmail上加个验证码,因为开启了输入密码几次后锁定账户,所以想通过这种方式减少别人恶意尝试。
我一点php都不懂,自己上网找了些资料,但总不成功。
作者:
dosimple
时间:
2009-12-2 10:45
标题:
自己研究了下,加了个不怎么实用的
login.php内容:
<?php
header("Cache-Control: no-store, no-cache, must-revalidate, post-check=0, pre-check=0");
header("Expires: Thu, 19 Nov 1981 08:52:00 GMT");
header("
ragma: no-cache");
$x_1ds = kerio('kerio::web:
hpSession');
if (!is_null($x_1ds)) {
$x_4em = ($x_1ds->getVariable(&$x_1ol, 'mnu') ? '/mini/index.php' : '/webmail/index.php');
header('Location: ' . $x_4em);
exit;
}
require_once(dirname(__FILE__) . '/../lib/kmslibs/browserDetector.inc');
require_once(dirname(__FILE__) . '/../lib/webmail/htmlHeader.inc');
require_once(dirname(__FILE__) . '/../integration/dashboardFactory.inc');
$x_17e = new x_17f();
$x_1ck = x_1bs::x_1bt($x_17e->x_1a8());
$x_1ux = $x_17e->x_17g();
$x_1ag = $x_1ux[0];
if ($x_1ag == '') {
$x_1ag = x_17f::x_1ah;
}
header("Content-Type: text/html; charset=utf-8");
header("Content-Language: $x_1ag");
header("X-Kerio-Filter: translate=$x_1ag");
$x_41x = new x_1im('', array('login.css'));
$x_41x->x_1j2(SERVER_SOFTWARE . ' WebMail');
$x_41x->x_1ja(array(DOCTYPE, TITLE, FAVICON, CSSFILES));
$x_69r = false;
$x_69s = $x_17e->x_1cr() . $x_17e->x_1cs();
$x_69t = $x_17e->x_1a5();
switch ($x_69s) {
case 'msie7':
case 'msie8':
$x_69r = $x_69s;
$x_1ec = 336;
break;
case 'firefox20':
case 'firefox30':
$x_69r = $x_69s;
$x_1ec = 234;
break;
}
?>
<meta name="viewport" content="width = 320" />
<script type="text/javascript">
<!--
function x_4e() {
document.x_69u.kerio_username.focus();
<?php if ($x_69t): ?>
if (document.getElementById && document.createElement && encodeURIComponent) {
if (top.location.href != document.location.href) top.location = document.location;
document.getElementById('modeSelection').innerHTML = ''
+ '<table>'
+ '<tr><td colspan="2" class="small"><kerio:text id='login-mode'/></td></tr>'
+ '<tr>'
+ '<td valign="top"><input name="kerio_mode" id="m0" type="radio" value="full" checked></td>'
+ '<td><label for="m0"><kerio:text id='login-mode-full'/></label></td>'
+ '</tr>'
+ '<tr>'
+ '<td valign="top"><input name="kerio_mode" id="m1" type="radio" value="mini"></td>'
+ '<td><label for="m1"><kerio:text id='login-mode-express'/></label></td>'
+ '</tr>'
+ '</table>';
document.getElementById('logoText').innerHTML = 'WebMail';
<?php if ($_GET['mode'] == 'mini' || $_GET['mode'] == 'pda'): ?>
document.forms[0].kerio_mode[1].checked = true;
<?php endif ?>
<?php if ($x_69r !== false): ?>
document.getElementById('hint').innerHTML += ''
+ ' | <a href="hints.php?showHint=<?php print $x_69s ?>〈=<?php print $x_1ag ?>" target="hints" '
+ 'onclick="window.open(\'hints.php?showHint=<?php print $x_69s ?>〈=<?php print $x_1ag ?>\', \'hints\', '
+ '\'width=380,height=<?php print $x_1ec ?>,top=50,left=50,resizable=yes,scrollbars=yes\');'
+ 'return false;"><kerio:text id='hint-recommended-settings'/></a>';
<?php endif ?>
}
<?php endif ?>
}
-->
</script>
</head>
<body>
<div id='upSpacer'></div>
<div class='contentDiv'>
<script language="javascript">
function validateLogin()
{
if($("validCode").value != $("showValidCode").innerText)
{
window.alert("验证码错误");
return false;
}
return true;
}
function $(id)
{
return document.getElementById(id);
}
</script>
<form name="x_69u" action="dologin.php" method="post"
onsubmit="return validateLogin()"
style="margin:0">
<input name="x_2la" type="hidden" value="internal">
<table class="mainTable" align="center">
<tr><td colspan="2">
<div class='logoDiv'></div>
<div id="logoText" class="caption">WebMail Mini</div><br></td></tr>
<?php
if (!is_null($_GET['reason'])) {
switch ($_GET['reason']) {
case "failure":
$x_22q = "<kerio:text id='login-err-failure'/>";
break;
case "expired":
$x_22q = "<kerio:text id='login-err-expired'/>";
break;
case "logout":
$x_22q = "<kerio:text id='login-err-logout'/>";
break;
default:
$x_22q = "";
break;
}
}
if (strlen($x_22q) > 0) {
echo "<tr><td colspan=\"2\"><span class=\"error\">" . $x_22q . "<br><br></span></td></tr>";
}
?>
<tr><td colspan="2">
<kerio:text id='login-enter'/><br>
</td></tr>
<tr><td nowrap><span class="caption"><kerio:text id='login-username'/></span></td><td>
<input name="kerio_username" class="input_text" type="text" size="15">
<?php if ($_GET['mode'] == "pda"):?>
<input name="x_1ue" type="hidden" value="yes">
<?php endif;?>
</td></tr>
<tr><td nowrap><span class="caption"><kerio:text id='login-password'/></span></td><td>
<input name="kerio_password" type="password" size="15" class="input_text"></td></tr>
<tr>
<?php
$validCode = rand(1000,9999);
?>
<td>验证码</td>
<td><input name="validCode" type="text" class="input" id="validCode" /><span id="showValidCode"><?=$validCode?></span></td>
</tr>
<td colspan="2"><div id="modeSelection"></div></td>
</tr>
<tr>
<td> </td><td><input type="submit" class="input_button" value="<kerio:text id='login-submit'/>"></td>
</tr>
</table>
</form>
</div>
<div id="hint"><a href="<?php echo $x_1ck->x_1bq()?>"><kerio:text id='<?php echo $x_1ck->x_1bp()?>'/></a></div>
</body>
</html>
上面红色字体的是需要添加到login.php中的,在IE,chrome中正常,在firefox里面好像输入正确验证码仍提示验证码错误。
[
本帖最后由 dosimple 于 2009-12-6 22:19 编辑
]
作者:
dosimple
时间:
2009-12-6 21:44
本想考虑使用图片验证码,但死活搞不上去,我在测试机器上能正常显示图片,但kerio自己有个php.ini的配置文件,我修改包含gd.so,重启下kerio又变成不包含了,所以没法显示图片。不知道有没懂php的人给点建议。
现在,还有个问题就是在webmail上加个密码复杂验证的,作为企业邮箱,没有这个功能实在是不应该。好些人开通邮箱后,密码就不修改。当然,如果还有控制密码过期时间的更好,其实这些可以通过AD集成来搞,问题很多企业并不用AD吧。
这个邮件系统其实更适合小企业用用,部署太方便了。
欢迎光临 邮件服务器-邮件系统-邮件技术论坛(BBS) (http://bbs.5dmail.cn/)
Powered by Discuz! X3.2