Mantis有个很不错的想法,提供了一套不错的验证方式;
可以设置匿名anonymous访问;也可以使用默认登陆的方式进入。不过我不打算让系统以外的用户来查看系统,所以关闭这个anonymous方式。^_^
好言归正传我们要仔细看下用户表了。
当时很奇怪他为什么提供一个cookie_string参数。原本以为用来记录登陆的cookies后来发现注册时,系统竟然提供了一个string然后,在相关页面验证:
//是否启用匿名用户查看提交。
if ( auth_is_user_authenticated() && !current_user_is_anonymous() ) {
print_header_redirect( config_get( ‘default_home_page’ ) );
}
current_user_is_anonymous()当然是考虑匿名的。不管。
# ——————–
# Return true if there is a currently logged in and authenticated user,
# false otherwise
function auth_is_user_authenticated() {
//dump(auth_get_current_user_cookie());show_vars();exit;
return ( auth_is_cookie_valid( auth_get_current_user_cookie() ) );
}
auth_is_cookie_valid($p_cookie_string)验证cookie中的MANTIS_STRING_COOKIE
是否在数据库中存在。
One Response to “更正Mantis的想法”
Leave a Reply
You must be logged in to post a comment.


10月 25th, 2007 at 2:54 下午
注销实现: