static void loginServiceProc(Webs *wp)
{
WebsRoute *route;
assert(wp);
route = wp->route;
assert(route);
if (websLoginUser(wp, websGetVar(wp, "username", ""), websGetVar(wp, "password", ""))) {
/* If the application defines a referrer session var, redirect to that */
cchar *referrer;
if ((referrer =
(wp, "referrer", 0)) != 0) {
websRedirect(wp, referrer);
} else {
websRedirectByStatus(wp, HTTP_CODE_OK);
}
websSetSessionVar(wp, "loginStatus", "ok");
} else {
if (route->askLogin) {
(route->askLogin)(wp);
}
websSetSessionVar(wp, "loginStatus", "failed");
websRedirectByStatus(wp, HTTP_CODE_UNAUTHORIZED);
}
}
goahead中auth.c源码
最新推荐文章于 2024-11-03 15:30:58 发布