summaryrefslogtreecommitdiff
path: root/src/user.cpp
blob: cc2af656d7a57617b71100eddcdbb47ce3c482f8 (plain)
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
46
47
48
49
#include "content.hpp"
#include "user.hpp"
#include "strusCms.hpp"

#include <cppcms/url_dispatcher.h>  
#include <cppcms/url_mapper.h>   

namespace apps {

user::user( strusCms &cms )
	: master( cms )
{
	cms.dispatcher( ).assign( "/login", &user::login, this );
	cms.mapper( ).assign( "login" );
}

void user::login( )
{
	content::user c;
	c.title = "strusCms";
	if( request( ).request_method( ) == "POST" ) {
		c.login.load( context( ) ); 
		if( c.login.validate( ) ) {
		}
	}
	render( "login", c );
}

}

namespace content {
	
login_form::login_form( ) : cppcms::form( )
{
	username.message( "Your login" );
	username.error_message( "The login name can't be empty" );
	password.message( "Your password" );
	password.error_message( "Your password is illegal" );
	submit.value( "Log in" );
	
	add( username );
	add( password );
	add( submit );
	
	username.non_empty( );
	password.non_empty( );
}
	
}