|
|
@ -21,9 +21,7 @@ def get_user(request): |
|
|
|
return request.unauthenticated_userid |
|
|
|
return request.unauthenticated_userid |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@forbidden_view_config( |
|
|
|
@forbidden_view_config(renderer="superx_budget:pyramid/templates/login.jinja2") |
|
|
|
renderer="superx_budget:pyramid/templates/login.jinja2", |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
def forbidden_view(request): |
|
|
|
def forbidden_view(request): |
|
|
|
return {"error": False} |
|
|
|
return {"error": False} |
|
|
|
|
|
|
|
|
|
|
@ -42,9 +40,7 @@ def login(request): |
|
|
|
return {"error": True} |
|
|
|
return {"error": True} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@view_config( |
|
|
|
@view_config(context=Root, name="logout", permission="login") |
|
|
|
context=Root, name="logout", permission="login", |
|
|
|
|
|
|
|
) |
|
|
|
|
|
|
|
def logout(request): |
|
|
|
def logout(request): |
|
|
|
headers = forget(request) |
|
|
|
headers = forget(request) |
|
|
|
return HTTPFound("/", headers=headers) |
|
|
|
return HTTPFound("/", headers=headers) |
|
|
@ -53,7 +49,7 @@ def logout(request): |
|
|
|
def includeme(config): |
|
|
|
def includeme(config): |
|
|
|
settings = config.get_settings() |
|
|
|
settings = config.get_settings() |
|
|
|
authn_policy = MyAuthenticationPolicy( |
|
|
|
authn_policy = MyAuthenticationPolicy( |
|
|
|
settings["auth.secret"], hashalg="sha512", |
|
|
|
settings["auth.secret"], hashalg="sha512" |
|
|
|
) |
|
|
|
) |
|
|
|
config.set_authentication_policy(authn_policy) |
|
|
|
config.set_authentication_policy(authn_policy) |
|
|
|
config.set_authorization_policy(ACLAuthorizationPolicy()) |
|
|
|
config.set_authorization_policy(ACLAuthorizationPolicy()) |
|
|
|