summaryrefslogtreecommitdiffstats
path: root/microbbs.c
diff options
context:
space:
mode:
authorFreeArtMan <dos21h@gmail.com>2015-01-11 17:49:03 +0900
committerFreeArtMan <dos21h@gmail.com>2015-01-11 17:49:03 +0900
commit9b3d5f87e7718b00f786531b58bf102cdadc8264 (patch)
tree51c445bbfd347353bcbc1412aaec654819739555 /microbbs.c
parent4e148546810a2902dff9444526e47c9569c79b64 (diff)
downloadmicrobbs-9b3d5f87e7718b00f786531b58bf102cdadc8264.tar.gz
microbbs-9b3d5f87e7718b00f786531b58bf102cdadc8264.zip
Added primitive authentification support
Diffstat (limited to 'microbbs.c')
-rw-r--r--microbbs.c19
1 files changed, 17 insertions, 2 deletions
diff --git a/microbbs.c b/microbbs.c
index 3d4d094..337e724 100644
--- a/microbbs.c
+++ b/microbbs.c
@@ -1,16 +1,22 @@
+#define __MICROBBS_MAIN
+
#include <stdio.h>
#include <stdlib.h>
+
#include "kconfig.h"
#include "logs.h"
#include "motd.h"
#include "sysinfo.h"
#include "articles.h"
+#include "user.h"
+
#include "libterm/term.h"
#include "libterm/term_io.h"
#include "ini.h"
+
int main( int argc, char **argv )
{
int quit_main_menu = 0;
@@ -23,6 +29,9 @@ int main( int argc, char **argv )
term_set_raw_mode( &ts );
term_clr_scr( &ts );
+ //init global variable of bbs user
+ bbs_user_init( &g_user );
+
//lunch captcha and try to detect if its random bot
#ifdef CONFIG_CAPTCHA
if ( captcha_test1( ts ) != 1)
@@ -50,6 +59,11 @@ int main( int argc, char **argv )
term_cur_set_r( &ts, 0 );
term_cur_set_c( &ts, 0 );
+ #ifdef CONFIG_LOGIN
+ if ( bbs_user_get_status( &g_user ) == BBS_USER_LOGEDIN )
+ printf("[LOGEDIN] ");
+ #endif
+
#ifdef CONFIG_MOTD
printf("(M)otd ");
#endif
@@ -71,7 +85,8 @@ int main( int argc, char **argv )
#endif
#ifdef CONFIG_LOGIN
- printf("(L)ogin ");
+ if ( bbs_user_get_status( &g_user ) != BBS_USER_LOGEDIN )
+ printf("(L)ogin ");
#endif
#ifdef CONFIG_TODO
@@ -171,7 +186,7 @@ int main( int argc, char **argv )
case 'l':
case 'L':
{
- printf("Login?\n");
+ bbs_login( &ts );
}
break;
#endif