forked from inderpreetsingh/LBE
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathauth.C
executable file
·48 lines (32 loc) · 1.18 KB
/
auth.C
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/************************************************************************
FileName: auth.C
Description: Holds the definition of class for Authentication widget
Details:
auth.C files contains a definition of class named AuthForm that is inherited
from WContainer widget, this class is then used in main WApplication for creating
an auth form.
Author: Gauravjeet Singh, Shaina Sabarwal, Inderpreet Singh
License: GNU GPL V3
**************************************************************************/
#include "auth.h"
#include "global.h"
AuthForm::AuthForm(WContainerWidget *parent)
:WContainerWidget(parent)
{
session_.login().changed().connect(this,&AuthForm::authEvent);
Wt::Auth::AuthWidget *authWidget
= new Wt::Auth::AuthWidget(Session::auth(), session_.users(),
session_.login());
authWidget->model()->addPasswordAuth(&Session::passwordAuth());
authWidget->setRegistrationEnabled(true);
authWidget->processEnvironment();
this->addWidget(authWidget);
}
void AuthForm::authEvent() {
if(session_.login().loggedIn()){
Wt::log("notice") << "User" << session_.login().user().id()
<<"logged in.";
}
else
Wt::log("notice") << "User logged out.";
}