added came_from to login.jinja2

This commit is contained in:
2023-02-08 11:10:41 +01:00
parent e60212239e
commit 7059553a03
6 changed files with 9 additions and 13 deletions

View File

@@ -1,7 +0,0 @@
INSERT INTO "allocation" (no_cat, classe, pc_cible, pc_atteint, valeur, type, ordre, bg_color, pc_ecart) VALUES(5,'Obligations',22,28.30000000000000071,74481.0,'AUTRE',40,'success',6.3000000000000007105);
INSERT INTO "allocation" (no_cat, classe, pc_cible, pc_atteint, valeur, type, ordre, bg_color, pc_ecart) VALUES(10,'Actions World',60,54.200000000000002841,142781.26000000000931,'ACTION',30,'warning',-5.7999999999999971578);
INSERT INTO "allocation" (no_cat, classe, pc_cible, pc_atteint, valeur, type, ordre, bg_color, pc_ecart) VALUES(12,'Cash',2,2.1000000000000000888,5591.0000000000000001,'AUTRE',60,'success',0.10000000000000008881);
INSERT INTO "allocation" (no_cat, classe, pc_cible, pc_atteint, valeur, type, ordre, bg_color, pc_ecart) VALUES(16,'Actions REITS',5,6.2999999999999998223,16690.799999999999273,'ACTION',12,'danger',1.2999999999999998223);
INSERT INTO "allocation" (no_cat, classe, pc_cible, pc_atteint, valeur, type, ordre, bg_color, pc_ecart) VALUES(17,'Actions Moment',10,8.5,22332.240000000001601,'ACTION',5,'danger',-1.5);
INSERT INTO "allocation" (no_cat, classe, pc_cible, pc_atteint, valeur, type, ordre, bg_color, pc_ecart) VALUES(19,'Crypto',1,0.59999999999999997779,1700.6400000000001,'ACTION',31,'warning',-0.4000000000000000222);

Binary file not shown.

Binary file not shown.

View File

@@ -12,7 +12,7 @@ def main(global_config, **settings):
# session factory # session factory
my_session_factory = SignedCookieSessionFactory('mGcAJn2HmNH6Hc') my_session_factory = SignedCookieSessionFactory('mGcAJn2HmNH6Hc')
authentication_policy = AuthTktAuthenticationPolicy('wMWvAWMZnp6Lch', authentication_policy = AuthTktAuthenticationPolicy('J2wv322aL5DTn2',
callback=groupfinder, hashalg='sha512', timeout=36000) callback=groupfinder, hashalg='sha512', timeout=36000)
authorization_policy = ACLAuthorizationPolicy() authorization_policy = ACLAuthorizationPolicy()
with Configurator(settings=settings, with Configurator(settings=settings,

View File

@@ -7,6 +7,8 @@
<form action="{{ login_url }}" method="post"> <form action="{{ login_url }}" method="post">
<h2>Se connecter</h2> <h2>Se connecter</h2>
<input type="hidden" name="came_from" value="{{ came_from }}" />
<div class="form-group"> <div class="form-group">
<input type="text" name="username" class="form-control" placeholder="Identifiant"> <input type="text" name="username" class="form-control" placeholder="Identifiant">
</div> </div>
@@ -14,7 +16,7 @@
<input type="password" name="password" class="form-control" placeholder="Mot de passe"> <input type="password" name="password" class="form-control" placeholder="Mot de passe">
</div> </div>
<div class="form-group"> <div class="form-group">
<input type="submit" value="Se connecter" class="btn btn-primary"> <input type="submit" name="form.submitted" value="Se connecter" class="btn btn-primary">
</div> </div>
</form> </form>

View File

@@ -33,7 +33,6 @@ def apropos(request):
@view_config(route_name='login', renderer='cao_blogr:templates/login.jinja2') @view_config(route_name='login', renderer='cao_blogr:templates/login.jinja2')
@forbidden_view_config(renderer='cao_blogr:templates/login.jinja2') @forbidden_view_config(renderer='cao_blogr:templates/login.jinja2')
def login(request): def login(request):
username = ''
login_url = request.route_url('login') login_url = request.route_url('login')
referrer = request.url referrer = request.url
@@ -41,9 +40,11 @@ def login(request):
referrer = '/' # never use the login form itself as came_from referrer = '/' # never use the login form itself as came_from
came_from = request.params.get('came_from', referrer) came_from = request.params.get('came_from', referrer)
username = ''
userpwd = ''
if 'form.submitted' in request.params:
username = request.POST.get('username') username = request.POST.get('username')
userpwd = request.POST.get('password') userpwd = request.POST.get('password')
if username:
user = UserService.by_name(request, username) user = UserService.by_name(request, username)
if user and user.verify_password(userpwd): if user and user.verify_password(userpwd):
headers = remember(request, username) headers = remember(request, username)