Fixed broken 'protect selection page'

SVN revision: 1667
This commit is contained in:
Stefan Ritt 2006-02-23 14:35:35 +00:00
parent dd575a5409
commit b20ee70664

View File

@ -21138,44 +21138,45 @@ BOOL check_user_password(LOGBOOK * lbs, char *user, char *password, char *redir)
{ {
char str[1000], str2[256], upwd[256], full_name[256], email[256]; char str[1000], str2[256], upwd[256], full_name[256], email[256];
int status, show_forgot_link, show_self_register; int status, show_forgot_link, show_self_register;
;
if (user == NULL) if (user == NULL)
return FALSE; status = 1;
else {
status = get_user_line(lbs, user, upwd, full_name, email, NULL, NULL); status = get_user_line(lbs, user, upwd, full_name, email, NULL, NULL);
if (status == 1 && user[0]) if (status == 1 && user[0])
set_user_login_time(lbs, user); set_user_login_time(lbs, user);
/* check for logout */ /* check for logout */
if (isparam("LO")) { if (isparam("LO")) {
/* remove cookies */ /* remove cookies */
set_login_cookies(lbs, "", ""); set_login_cookies(lbs, "", "");
return FALSE; return FALSE;
} }
/* check for "forgot password" */ /* check for "forgot password" */
if (isparam("cmd") && strcmp(getparam("cmd"), loc("Forgot")) == 0) { if (isparam("cmd") && strcmp(getparam("cmd"), loc("Forgot")) == 0) {
if (getcfg(lbs->name, "forgot password link", str, sizeof(str)) && atoi(str) == 0) if (getcfg(lbs->name, "forgot password link", str, sizeof(str)) && atoi(str) == 0)
return FALSE; return FALSE;
show_forgot_pwd_page(lbs); show_forgot_pwd_page(lbs);
return FALSE; return FALSE;
} }
if (!check_login_user(lbs, user)) { if (!check_login_user(lbs, user)) {
if (isparam("fail")) { if (isparam("fail")) {
/* remove remaining cookies */ /* remove remaining cookies */
remove_all_login_cookies(lbs); remove_all_login_cookies(lbs);
return FALSE;
}
redirect(lbs, "?fail=1");
return FALSE; return FALSE;
} }
redirect(lbs, "?fail=1");
return FALSE;
} }
if (status == 1) { if (status == 1) {
if (user[0] && password && strcmp(password, upwd) == 0) { if (user != NULL && user[0] && password && strcmp(password, upwd) == 0) {
setparam("full_name", full_name); setparam("full_name", full_name);
setparam("user_email", email); setparam("user_email", email);
return TRUE; return TRUE;