Subversion Repositories RepoView

Rev

Rev 6 | Rev 62 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 6 Rev 7
Line 1... Line 1...
1
/* $Id: cookie.c 6 2024-08-21 00:44:17Z nishi $ */
1
/* $Id: cookie.c 7 2024-08-21 01:12:44Z nishi $ */
2
 
2
 
3
#include "rv_auth.h"
3
#include "rv_auth.h"
4
 
4
 
5
#include "rv_util.h"
5
#include "rv_util.h"
6
#include "rv_db.h"
6
#include "rv_db.h"
Line 82... Line 82...
82
		}
82
		}
83
	}
83
	}
84
	return NULL;
84
	return NULL;
85
}
85
}
86
 
86
 
-
 
87
void rv_logout(void) {
-
 
88
	int i;
-
 
89
	for(i = 0; cookie_entries[i] != NULL; i++) {
-
 
90
		if(strcmp(cookie_entries[i]->key, "token") == 0) {
-
 
91
			printf("Set-Cookie: token=; HttpOnly; Expires=0; SameSite=Strict\r\n");
-
 
92
			rv_remove_token(cookie_entries[i]->value);
-
 
93
			break;
-
 
94
		}
-
 
95
	}
-
 
96
}
-
 
97
 
87
void rv_save_login(const char* username) {
98
void rv_save_login(const char* username) {
88
	char* token = rv_new_token(username);
99
	char* token = rv_new_token(username);
89
	printf("Set-Cookie: token=%s; HttpOnly; SameSite=Strict\r\n", token);
100
	printf("Set-Cookie: token=%s; HttpOnly; SameSite=Strict\r\n", token);
90
	free(token);
101
	free(token);
91
}
102
}