mirror of
https://codeberg.org/grunfink/snac2.git
synced 2024-11-09 19:50:26 +03:00
New function lastlog_write().
This commit is contained in:
parent
7c00a9918a
commit
1fe34ffb4a
13
data.c
13
data.c
@ -1366,6 +1366,19 @@ d_char *history_list(snac *snac)
|
||||
}
|
||||
|
||||
|
||||
void lastlog_write(snac *snac)
|
||||
/* writes the last time and date the user logged in */
|
||||
{
|
||||
xs *fn = xs_fmt("%s/lastlog.txt", snac->basedir);
|
||||
FILE *f;
|
||||
|
||||
if ((f = fopen(fn, "w")) != NULL) {
|
||||
fprintf(f, "%lf\n", ftime());
|
||||
fclose(f);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/** inbox collection **/
|
||||
|
||||
void inbox_add(const char *inbox)
|
||||
|
7
html.c
7
html.c
@ -13,11 +13,11 @@
|
||||
|
||||
#include "snac.h"
|
||||
|
||||
int login(snac *snac, char *headers)
|
||||
int login(snac *snac, const xs_dict *headers)
|
||||
/* tries a login */
|
||||
{
|
||||
int logged_in = 0;
|
||||
char *auth = xs_dict_get(headers, "authorization");
|
||||
const char *auth = xs_dict_get(headers, "authorization");
|
||||
|
||||
if (auth && xs_startswith(auth, "Basic ")) {
|
||||
int sz;
|
||||
@ -33,6 +33,9 @@ int login(snac *snac, char *headers)
|
||||
}
|
||||
}
|
||||
|
||||
if (logged_in)
|
||||
lastlog_write(snac);
|
||||
|
||||
return logged_in;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user