Implemented front-office login
@@ -1,4 +1,4 @@
|
||||
{check_auth context="admin" roles="ROLE_ADMIN" login_url="login"}
|
||||
{check_auth context="admin" roles="ROLE_ADMIN" login_tpl="/admin/login"}
|
||||
{$page_title={intl l='Home'}}
|
||||
{include file='includes/header.inc.html'}
|
||||
|
||||
|
||||
@@ -14,14 +14,14 @@
|
||||
<h1>{intl l='Thelia Back Office'}</h1>
|
||||
|
||||
{form name="thelia.admin.login" success_url="home" error_url="login"}
|
||||
<form action="checklogin" method="post" class="well form-inline" {form_enctype form=$form}>
|
||||
<form action="{url path='/admin/checklogin'}" method="post" class="well form-inline" {form_enctype form=$form}>
|
||||
|
||||
{if isset($message)}<div class="alert alert-error">{$message}</div>{/if}
|
||||
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
{form_field form=$form field='success_url'}
|
||||
<input type="hidden" name="{$name}" value="{url path='admin'}" /> {* on success, redirect to /admin *}
|
||||
<input type="hidden" name="{$name}" value="{url path='/admin'}" /> {* on success, redirect to /admin *}
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='username'}
|
||||
|
||||
|
Before Width: | Height: | Size: 8.6 KiB After Width: | Height: | Size: 8.6 KiB |
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 26 KiB |
|
Before Width: | Height: | Size: 5.4 KiB After Width: | Height: | Size: 5.4 KiB |
|
Before Width: | Height: | Size: 59 KiB After Width: | Height: | Size: 59 KiB |
@@ -1,7 +1,31 @@
|
||||
{include file="includes/header.html"}
|
||||
|
||||
{form name="thelia.customer.creation"}
|
||||
<form method="post" action="index_dev.php?action=createCustomer&view=connexion" {form_enctype form=$form} >
|
||||
{* We use $index_page as form action to avoid mixing post and get data *}
|
||||
<form action="{$index_page}" method="post" {form_enctype form=$form}>
|
||||
{*
|
||||
The two fields below are not par of the Login form, they are here to defines
|
||||
the action to process, and the view to render once the form is submited
|
||||
*}
|
||||
<input type="hidden" name="action" value="createCustomer" /> {* the action triggered by this form *}
|
||||
<input type="hidden" name="view" value="connexion" /> {* the view to return to if the form cannot be validated *}
|
||||
|
||||
{*
|
||||
This field is common to all BaseForm instances (thus, this one), and defines
|
||||
the URL the customer is redirected to once the form has been successfully
|
||||
processed
|
||||
*}
|
||||
|
||||
{form_field form=$form field='success_url'}
|
||||
<input type="hidden" name="{$name}" value="{$return_to_url}" /> {* the url the user is redirected to on login success *}
|
||||
{/form_field}
|
||||
|
||||
{*
|
||||
customer_creation_error_message is defined in Customer action processor class,
|
||||
and passed the parser through the ParserContext service.
|
||||
*}
|
||||
|
||||
{if isset($customer_creation_error_message)}<div class="alert alert-error">{$customer_creation_error_message}</div>{/if}
|
||||
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
include 1 success<br />
|
||||
#INCLUDE "subinclude1.html"
|
||||
25
templates/default/includes/header.html
Executable file
@@ -0,0 +1,25 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>{$page_title|default:{intl l="Thelia II"}}</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
|
||||
{stylesheets file='../assets/css/*' filters='less,cssembed'}
|
||||
<link rel="stylesheet" href="{$asset_url}">
|
||||
{/stylesheets}
|
||||
</head>
|
||||
<body>
|
||||
<div>
|
||||
{loop type="auth" name="customer_info_block" roles="ROLE_CUSTOMER" context="front"}
|
||||
<p>Your are logged in ! <a href="{viewurl view='index' action='logoutCustomer'}">Logout</a></p>
|
||||
{/loop}
|
||||
|
||||
{loop type="auth" name="admin_info_block" roles="ROLE_ADMIN" context="admin"}
|
||||
<p>You are logged as administrator</p>
|
||||
{/loop}
|
||||
|
||||
{elseloop rel="customer_info_block"}
|
||||
You are not logged in. <a href="{viewurl view='login'}">Login now</a> or <a href="{viewurl view='connexion'}">create your account</a>
|
||||
{/elseloop}
|
||||
</div>
|
||||
<hr />
|
||||
@@ -1,26 +1,151 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title></title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
</head>
|
||||
<body>
|
||||
<div>TODO write content<br />
|
||||
<THELIA_cat type="category">
|
||||
#__COUNT__ - #TITLE <br />
|
||||
nb child : #NB_CHILD <br /><br />
|
||||
</THELIA_cat>
|
||||
{include file="includes/header.html"}
|
||||
<div>
|
||||
|
||||
<TEST_equal test="equal" variable="3" value="1">
|
||||
test vrai
|
||||
</TEST_equal>
|
||||
test faux
|
||||
<//TEST_equal>
|
||||
<br />
|
||||
<REPEAT_loopy start="6" end="12" increment="1">
|
||||
Compteur = #INDEX<br />
|
||||
</REPEAT_loopy>
|
||||
{loop type="auth" name="auth_test" context="front" roles="ROLE_CUSTOMER"}
|
||||
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
<p>Customer is authentified :-)</p>
|
||||
{/loop}
|
||||
|
||||
{elseloop rel="auth_test"}
|
||||
<p>Customer is not authentified :-(</p>
|
||||
{/elseloop}
|
||||
|
||||
An image from asset directory :
|
||||
{images file='assets/img/logo-thelia-34px.png'}<img src="{$asset_url}" alt="{intl l='Thelia, solution e-commerce libre'}" />{/images}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
{intl l='An internationalized string'}
|
||||
</div>
|
||||
|
||||
|
||||
<div>
|
||||
jQuery data: <span id="jquery_block"></span>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<p>Category loop example</p>
|
||||
<ul>
|
||||
{loop type="category" name="catloop1"}
|
||||
<li>{$LOOP_COUNT}/{$LOOP_TOTAL} : {$ID} {$TITLE}, children: {$NB_CHILD}
|
||||
{ifloop rel="inner1"}
|
||||
<ul>
|
||||
{loop type="category" name="inner1" parent="{$ID}"}
|
||||
<li>Sub cat {$ID} (parent is {$PARENT}): {$TITLE}</li>
|
||||
{/loop}
|
||||
</ul>
|
||||
{/ifloop}
|
||||
</li>
|
||||
{/loop}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div>
|
||||
<p>Conditional example #1</p>
|
||||
|
||||
{ifloop rel="catloop2"}
|
||||
Hey ! Loop catloop2 is not empty:
|
||||
<ul>
|
||||
{loop type="category" name="catloop2" parent="12"}
|
||||
<li>{$LOOP_COUNT}/{$LOOP_TOTAL} : {$ID} {$TITLE}</li>
|
||||
{/loop}
|
||||
</ul>
|
||||
{/ifloop}
|
||||
|
||||
{elseloop rel="catloop2"}
|
||||
<p>Loop catloop2 is empty</p>
|
||||
{/elseloop}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<p>Conditional example #2</p>
|
||||
|
||||
{ifloop rel="catloop3"}
|
||||
Loop catloop3 is not empty:
|
||||
<ul>
|
||||
{loop type="category" name="catloop3" parent="0"}
|
||||
<li>{$LOOP_COUNT}/{$LOOP_TOTAL} : {$ID} {$TITLE}</li>
|
||||
{/loop}
|
||||
</ul>
|
||||
{/ifloop}
|
||||
|
||||
{elseloop rel="catloop3"}
|
||||
<p>Loop catloop3 is empty</p>
|
||||
{/elseloop}
|
||||
|
||||
{elseloop rel="catloop2"}
|
||||
<p>... but catloop2 is still empty :-)</p>
|
||||
{/elseloop}
|
||||
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<p>Traditional for loop</p>
|
||||
{for $index=5 to 12 step 1}
|
||||
Compteur = {$index}<br />
|
||||
{/for}
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div>
|
||||
<p>Some pagination</p>
|
||||
<p>PAGE 1</p>
|
||||
<ul>
|
||||
{loop type="category" name="catloopwithpagination1" limit="2" page="1"}
|
||||
<li>{$LOOP_COUNT}/{$LOOP_TOTAL} : {$ID} {$TITLE}</li>
|
||||
{/loop}
|
||||
</ul>
|
||||
<p>PAGE 2</p>
|
||||
<ul>
|
||||
{loop type="category" name="catloopwithpagination2" limit="2" page="2"}
|
||||
<li>{$LOOP_COUNT}/{$LOOP_TOTAL} : {$ID} {$TITLE}</li>
|
||||
{/loop}
|
||||
</ul>
|
||||
<p>PAGE 1000</p>
|
||||
<ul>
|
||||
|
||||
{loop type="category" name="catloopwithpagination1000" limit="2" page="1000"}
|
||||
<li>{$LOOP_COUNT}/{$LOOP_TOTAL} : {$ID} {$TITLE}</li>
|
||||
{/loop}
|
||||
|
||||
{elseloop rel="catloopwithpagination1000"}
|
||||
NO RESULTS
|
||||
{/elseloop}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<p>Some pagination with page choice</p>
|
||||
{assign var=current_page value=2}
|
||||
<p>PAGE {$current_page} :</p>
|
||||
<ul>
|
||||
{loop type="category" name="catloopwithpaginationchoice" limit="2" page="{$current_page}"}
|
||||
<li>{$LOOP_COUNT}/{$LOOP_TOTAL} : {$ID} {$TITLE}</li>
|
||||
{/loop}
|
||||
</ul>
|
||||
<p>page choice</p>
|
||||
{pageloop rel="catloopwithpaginationchoice"}
|
||||
{if ${PAGE} != {$current_page}}
|
||||
{if {$PAGE} > {$current_page}-10 AND {$PAGE} < {$current_page}+10}
|
||||
{$PAGE}
|
||||
{/if}
|
||||
{if {$PAGE} == {$current_page}-10 OR {$PAGE} == {$current_page}+10}
|
||||
...
|
||||
{/if}
|
||||
{if ({$PAGE} < {$current_page}-10 OR {$PAGE} > {$current_page}+10) AND ({$PAGE}%10 == 0 OR ${PAGE} == {$LAST} OR ${PAGE} == 1)}
|
||||
{$PAGE}
|
||||
{/if}
|
||||
{else}
|
||||
{ {$PAGE} }
|
||||
{/if}
|
||||
{if {$PAGE} != {$LAST}}
|
||||
-
|
||||
{/if}
|
||||
{/pageloop}
|
||||
</div>
|
||||
|
||||
{include file="includes/footer.html"}
|
||||
52
templates/default/login.html
Normal file
@@ -0,0 +1,52 @@
|
||||
{include file="includes/header.html"}
|
||||
|
||||
<h1>{intl l='Please login'}</h1>
|
||||
|
||||
{form name="thelia.customer.login" }
|
||||
{* We use $index_page as form action to avoid mixing post and get data *}
|
||||
<form action="{$index_page}" method="post" {form_enctype form=$form}>
|
||||
|
||||
{*
|
||||
The two fields below are not par of the Login form, they are here to defines
|
||||
the action to process, and the view to render once the form is submited
|
||||
*}
|
||||
<input type="hidden" name="action" value="loginCustomer" /> {* the action triggered by this form *}
|
||||
<input type="hidden" name="view" value="login" /> {* the view to return to if the form cannot be validated *}
|
||||
|
||||
{*
|
||||
This field is common to all BaseForm instances (thus, this one), and defines
|
||||
the URL the customer is redirected to once the form has been successfully
|
||||
processed
|
||||
*}
|
||||
|
||||
{form_field form=$form field='success_url'}
|
||||
<input type="hidden" name="{$name}" value="{$return_to_url}" /> {* the url the user is redirected to on login success *}
|
||||
{/form_field}
|
||||
|
||||
{*
|
||||
customer_login_error_message is defined in Customer action processor class,
|
||||
and passed the parser through the ParserContext service.
|
||||
*}
|
||||
|
||||
{if isset($customer_login_error_message)}<div class="alert alert-error">{$customer_login_error_message}</div>{/if}
|
||||
|
||||
{form_hidden_fields form=$form}
|
||||
|
||||
{form_field form=$form field="email"}
|
||||
{if #error}{#message}{/if}
|
||||
<label>{intl l="Your e-mail address"}: </label><input type="email" name="{$name}" {$attr} ><br />
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='password'}
|
||||
<label>{intl l="Your password"}: </label><input type="password" name="{$name}" {$attr}> <br />
|
||||
{/form_field}
|
||||
|
||||
{form_field form=$form field='remember_me'}
|
||||
<label class="checkbox"> <input type="checkbox" name="{$name}" value="{$value}" {$attr} {if $options.checked}checked="checked"{/if}/> {intl l='Remember me'}</label>
|
||||
{/form_field}
|
||||
|
||||
<button type="submit">{intl l='Login'}</button>
|
||||
</form>
|
||||
{/form}
|
||||
|
||||
{include file='includes/footer.html'}
|
||||
6
templates/default/myaccount.html
Normal file
@@ -0,0 +1,6 @@
|
||||
{check_auth context="front" roles="ROLE_CUSTOMER" login_tpl="login"}
|
||||
|
||||
{$page_title="{intl l='My Account'}"}
|
||||
|
||||
{include file="includes/header.html"}
|
||||
{include file="includes/footer.html"}
|
||||
@@ -1 +0,0 @@
|
||||
subinclude1 success
|
||||
@@ -1,11 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html>
|
||||
<head>
|
||||
<title>{$page_title|default:{intl l="Thelia II"}}</title>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
|
||||
|
||||
{stylesheets file='../assets/css/*' filters='less,cssembed'}
|
||||
<link rel="stylesheet" href="{$asset_url}">
|
||||
{/stylesheets}
|
||||
</head>
|
||||
<body>
|
||||
@@ -1,151 +0,0 @@
|
||||
{include file="includes/header.html"}
|
||||
<div>
|
||||
|
||||
{loop type="auth" name="auth_test" context="front" roles="ROLE_CUSTOMER"}
|
||||
|
||||
<p>Customer is authentified :-)</p>
|
||||
{/loop}
|
||||
|
||||
{elseloop rel="auth_test"}
|
||||
<p>Customer is not authentified :-(</p>
|
||||
{/elseloop}
|
||||
|
||||
An image from asset directory :
|
||||
{images file='assets/img/logo-thelia-34px.png'}<img src="{$asset_url}" alt="{intl l='Thelia, solution e-commerce libre'}" />{/images}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
{intl l='An internationalized string'}
|
||||
</div>
|
||||
|
||||
|
||||
<div>
|
||||
jQuery data: <span id="jquery_block"></span>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<p>Category loop example</p>
|
||||
<ul>
|
||||
{loop type="category" name="catloop1"}
|
||||
<li>{$LOOP_COUNT}/{$LOOP_TOTAL} : {$ID} {$TITLE}, children: {$NB_CHILD}
|
||||
{ifloop rel="inner1"}
|
||||
<ul>
|
||||
{loop type="category" name="inner1" parent="{$ID}"}
|
||||
<li>Sub cat {$ID} (parent is {$PARENT}): {$TITLE}</li>
|
||||
{/loop}
|
||||
</ul>
|
||||
{/ifloop}
|
||||
</li>
|
||||
{/loop}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
|
||||
<div>
|
||||
<p>Conditional example #1</p>
|
||||
|
||||
{ifloop rel="catloop2"}
|
||||
Hey ! Loop catloop2 is not empty:
|
||||
<ul>
|
||||
{loop type="category" name="catloop2" parent="12"}
|
||||
<li>{$LOOP_COUNT}/{$LOOP_TOTAL} : {$ID} {$TITLE}</li>
|
||||
{/loop}
|
||||
</ul>
|
||||
{/ifloop}
|
||||
|
||||
{elseloop rel="catloop2"}
|
||||
<p>Loop catloop2 is empty</p>
|
||||
{/elseloop}
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<p>Conditional example #2</p>
|
||||
|
||||
{ifloop rel="catloop3"}
|
||||
Loop catloop3 is not empty:
|
||||
<ul>
|
||||
{loop type="category" name="catloop3" parent="0"}
|
||||
<li>{$LOOP_COUNT}/{$LOOP_TOTAL} : {$ID} {$TITLE}</li>
|
||||
{/loop}
|
||||
</ul>
|
||||
{/ifloop}
|
||||
|
||||
{elseloop rel="catloop3"}
|
||||
<p>Loop catloop3 is empty</p>
|
||||
{/elseloop}
|
||||
|
||||
{elseloop rel="catloop2"}
|
||||
<p>... but catloop2 is still empty :-)</p>
|
||||
{/elseloop}
|
||||
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<p>Traditional for loop</p>
|
||||
{for $index=5 to 12 step 1}
|
||||
Compteur = {$index}<br />
|
||||
{/for}
|
||||
</div>
|
||||
|
||||
|
||||
|
||||
<div>
|
||||
<p>Some pagination</p>
|
||||
<p>PAGE 1</p>
|
||||
<ul>
|
||||
{loop type="category" name="catloopwithpagination1" limit="2" page="1"}
|
||||
<li>{$LOOP_COUNT}/{$LOOP_TOTAL} : {$ID} {$TITLE}</li>
|
||||
{/loop}
|
||||
</ul>
|
||||
<p>PAGE 2</p>
|
||||
<ul>
|
||||
{loop type="category" name="catloopwithpagination2" limit="2" page="2"}
|
||||
<li>{$LOOP_COUNT}/{$LOOP_TOTAL} : {$ID} {$TITLE}</li>
|
||||
{/loop}
|
||||
</ul>
|
||||
<p>PAGE 1000</p>
|
||||
<ul>
|
||||
|
||||
{loop type="category" name="catloopwithpagination1000" limit="2" page="1000"}
|
||||
<li>{$LOOP_COUNT}/{$LOOP_TOTAL} : {$ID} {$TITLE}</li>
|
||||
{/loop}
|
||||
|
||||
{elseloop rel="catloopwithpagination1000"}
|
||||
NO RESULTS
|
||||
{/elseloop}
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<p>Some pagination with page choice</p>
|
||||
{assign var=current_page value=2}
|
||||
<p>PAGE {$current_page} :</p>
|
||||
<ul>
|
||||
{loop type="category" name="catloopwithpaginationchoice" limit="2" page="{$current_page}"}
|
||||
<li>{$LOOP_COUNT}/{$LOOP_TOTAL} : {$ID} {$TITLE}</li>
|
||||
{/loop}
|
||||
</ul>
|
||||
<p>page choice</p>
|
||||
{pageloop rel="catloopwithpaginationchoice"}
|
||||
{if ${PAGE} != {$current_page}}
|
||||
{if {$PAGE} > {$current_page}-10 AND {$PAGE} < {$current_page}+10}
|
||||
{$PAGE}
|
||||
{/if}
|
||||
{if {$PAGE} == {$current_page}-10 OR {$PAGE} == {$current_page}+10}
|
||||
...
|
||||
{/if}
|
||||
{if ({$PAGE} < {$current_page}-10 OR {$PAGE} > {$current_page}+10) AND ({$PAGE}%10 == 0 OR ${PAGE} == {$LAST} OR ${PAGE} == 1)}
|
||||
{$PAGE}
|
||||
{/if}
|
||||
{else}
|
||||
{ {$PAGE} }
|
||||
{/if}
|
||||
{if {$PAGE} != {$LAST}}
|
||||
-
|
||||
{/if}
|
||||
{/pageloop}
|
||||
</div>
|
||||
|
||||
{include file="includes/footer.html"}
|
||||