kotti.views.login

Login / logout and forbidden views and forms.

class kotti.views.login.UserSelfRegistered(obj, request=None)[source]

This event is emitted just after user self registered.

Intended use is to allow addons to do some preparation for such a user (create custom contents, nodes etc.

Event handler object parameter is a Principal object.

class kotti.views.login.RegisterSchema(*arg, **kw)[source]
kotti.views.login.login_success_callback(request, user, came_from)[source]

Default implementation of kotti.login_success_callback. You can implement a custom function with the same signature and point the kotti.login_success_callback setting to it.

Parameters:
  • request (kotti.request.Request) – Current request
  • user (kotti.security.Princial) – Principal, who just logged in successfully.
  • came_from (str) – URL the user came from
Result:

Any Pyramid response object, by default a redirect to came_from or the context where login was called.

Return type:

pyramid.httpexceptions.HTTPFound

kotti.views.login.reset_password_callback(request, user)[source]

Default implementation of kotti.reset_password_callback. You can implement a custom function with the same signature and point the kotti.reset_password_callback setting to it.

Parameters:
  • request (kotti.request.Request) – Current request
  • user (kotti.security.Princial) – Principal, who’s password was requested to be reset.
Result:

Any Pyramid response object, by default a redirect to to the same URL from where the password reset was called.

Return type:

pyramid.httpexceptions.HTTPFound

kotti.views.login.login(context, request)[source]

Login view. Renders either the login or password forgot form templates or handles their form submission and redirects to came_from on success.

Result:Either a redirect response or a dictionary passed to the template for rendering
Return type:pyramid.httpexceptions.HTTPFound or dict
kotti.views.login.logout(context, request)[source]

Logout view. Always redirects the user to where he came from.

Result:Redirect to came_from
Return type:pyramid.httpexceptions.HTTPFound
class kotti.views.login.SetPasswordSchema(*arg, **kw)[source]

Schema for the set password form

password = None

colander.String

token = None

colander.String

email = None

colander.String

continue_to = None

colander.String

kotti.views.login.set_password(context, request, success_msg='You have reset your password.')[source]

Set password view. Displays the set password form and handles its form submission.

Parameters:
Result:

Redirect response or dictionary passed to the template for rendering.

Return type:

pyramid.httpexceptions.HTTPFound or dict

kotti.views.login.forbidden_redirect(context, request)[source]

Forbidden redirect view. Redirects to the login form for anonymous users or to the forbidden view for authenticated users.

Result:Redirect to one of the above.
Return type:pyramid.httpexceptions.HTTPFound
kotti.views.login.forbidden_view(request)[source]

Forbidden view. Raises 403 for requests not originating from a web browser like device.

Result:403
Return type:pyramid.httpexceptions.HTTPForbidden
kotti.views.login.forbidden_view_html(request)[source]

Forbidden view for browsers.

Result:empty dictionary passed to the template for rendering
Return type:dict
kotti.views.login.includeme(config)[source]

Pyramid includeme hook.

Parameters:config (pyramid.config.Configurator) – app config