Commit 25d39c8b by aa.gusti

captcha

1 parent 13cc05c7
......@@ -50,7 +50,7 @@ class RegSchema(colander.Schema):
colander.String(),
validator=colander.Length(max=18, max_err='Maximum ${max} Digit',
min=15, min_err='Minimimum ${min} Digit'),
title="NIK",
title="No.Identitas/NIK",
oid="kode")
detail = NamaSchema()
captcha = colander.SchemaNode(
......
......@@ -14,7 +14,7 @@
<p><img src="${request._host}/static/img/logo.png" class="img-float img-thumbnail"/></p>
Anda tidak berhak mengakses halaman ${url}<br>
<a href="${request.route_url('home')}">Kembali ke Halaman Utama</a>
<a href="${request.referer}">Kembali ke Halaman Sebelumnya</a>
</div>
</body>
......
......@@ -95,7 +95,9 @@
<div metal:fill-slot="scripts">
<script tal:condition=captcha>
$(document).ready(function () {
$("#captcha").parent().prepend('<img style="height:30px; width:auto; margin-bottom:5px;" src="/captcha/${captcha}.png">')
$("#captcha").parent().prepend(
'<img style="height:30px; width:auto; margin-bottom:5px;" ' +
'src="${home}/captcha/${captcha}.png">')
$('#captcha').on('input', function(evt) {
$(this).val(function(_, val) {
......
......@@ -25,6 +25,7 @@ from importlib import import_module
import colander
from deform import widget, Form, ValidationFailure, Button
from pyramid.httpexceptions import HTTPFound, HTTPNotFound
from pyramid.renderers import render_to_response
from pyramid.security import remember, forget
from pyramid.view import view_config
from ziggurat_foundations.models.services.external_identity import ExternalIdentityService
......@@ -61,6 +62,7 @@ def get_login_headers(request, user):
@view_config(route_name='login', renderer='templates/login.pt')
def view_login(request):
next_url = request.params.get('next', request.referrer)
login_tpl = get_params('login_tpl', 'templates/login.pt')
if not next_url:
next_url = request.route_url('home') # get_params('_host')+
......@@ -145,12 +147,16 @@ def view_login(request):
return redirect_login(request, user)
message=""
login=""
return dict(form=form.render(),
message=message,
url=request.route_url('login'),
next_url=next_url,
login=login,
)
return render_to_response(login_tpl,
dict(form=form.render(),
message=message,
url=request.route_url('login'),
next_url=next_url,
login=login,),
request=request)
# return dict(
# )
def redirect_login(request, user):
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!