-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
14 changed files
with
229 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
# python package |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<configure | ||
xmlns="http://namespaces.zope.org/z3c" | ||
i18n_domain="ice.control"> | ||
|
||
<pagelet | ||
name="loginForm.html" | ||
for="*" | ||
class=".loginform.Pagelet" | ||
permission="zope.Public" | ||
layer="bbru.skin.interfaces.ILayer" | ||
/> | ||
<template | ||
for=".loginform.Pagelet" | ||
template="loginform.pt" | ||
/> | ||
|
||
<pagelet | ||
name="login.html" | ||
for="*" | ||
class=".login.Pagelet" | ||
permission="zope.Public" | ||
allowed_interface="zope.app.publisher.interfaces.http.ILogin" | ||
layer="bbru.skin.interfaces.ILayer" | ||
/> | ||
|
||
<pagelet | ||
name="logout.html" | ||
for="*" | ||
class=".logout.Pagelet" | ||
permission="zope.Public" | ||
allowed_interface="zope.app.publisher.interfaces.http.ILogout" | ||
layer="bbru.skin.interfaces.ILayer" | ||
/> | ||
|
||
</configure> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<h1>Login successful!</h1> | ||
|
||
<p style="font-size: 120%; font-weight:bold;"> | ||
You are now logged in as | ||
<em tal:content="view/request/principal/title" /> | ||
</p> | ||
|
||
<a href=".">Back to the main page.</a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
### -*- coding: utf-8 -*- #################################################### | ||
# | ||
# Copyright (C) 2010 Ilshad R. Khabibullin <astoon.net at gmail.com> | ||
# | ||
# This library is free software: you can redistribute it and/or modify it | ||
# under the terms of the GNU General Public License as published by the Free | ||
# Software Foundation, either version 3 of the License. | ||
# | ||
# This software is distributed in the hope that it will be useful, but | ||
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
# for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this software. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
# Project homepage: <http://launchpad.net/ice.control> | ||
# | ||
# This pagelet is modified browser view based on code of zope.*, | ||
# Copyright (C) Zope Corporation and Contributors. | ||
# | ||
############################################################################## | ||
|
||
from zope import interface, component | ||
from zope.app.publisher.interfaces.http import ILogin | ||
from zope.authentication.interfaces import IUnauthenticatedPrincipal | ||
from zope.authentication.interfaces import IAuthentication | ||
from zope.app.pagetemplate import ViewPageTemplateFile | ||
|
||
class Pagelet(object): | ||
interface.implements(ILogin) | ||
|
||
confirmation = ViewPageTemplateFile('login.pt') | ||
failed = ViewPageTemplateFile('login_failed.pt') | ||
|
||
def render(self): | ||
nextURL = self.request.get('nextURL') | ||
if IUnauthenticatedPrincipal(self.request.principal, False): | ||
component.getUtility(IAuthentication).unauthorized( | ||
self.request.principal.id, self.request) | ||
return self.failed() | ||
if nextURL is None: | ||
return self.confirmation() | ||
self.request.response.redirect(nextURL) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<h1>Login Failed!</h1> | ||
|
||
<p style="font-size: 150%"> | ||
You cancelled the login procedure. | ||
<a tal:attributes="href python: view.request.get('nextURL', '.')"> | ||
Click here to return. | ||
</a> | ||
</p> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<tal:block define="principal python:request.principal.id"> | ||
<h1 i18n:translate="" tal:condition="python: principal == 'zope.anybody'"> | ||
Please provide Login Information | ||
</h1> | ||
<h1 i18n:translate="" tal:condition="python: principal != 'zope.anybody'"> | ||
You are not authorized to perform this action. However, you may login as a | ||
different user who is authorized. | ||
</h1> | ||
<form action="" method="post"> | ||
<div tal:omit-tag="" | ||
tal:condition="python:principal != 'zope.anybody' and 'SUBMIT' in request"> | ||
<span tal:define="dummy python:request.response.redirect(request.get('camefrom', ''))" /> | ||
</div> | ||
<div class="row"> | ||
<div class="label"><label for="login" i18n:translate="">Login</label></div> | ||
<div class="field"> | ||
<input type="text" name="login" id="login" /> | ||
</div> | ||
</div> | ||
|
||
<div class="row"> | ||
<div class="label"><label for="password" i18n:translate="">Password</label></div> | ||
<div class="field"> | ||
<input type="password" name="password" id="password" /> | ||
</div> | ||
</div> | ||
|
||
<div class="row"> | ||
<input class="form-element" type="submit" | ||
name="SUBMIT" value="Log in" i18n:attributes="value login-button" /> | ||
</div> | ||
<input type="hidden" name="camefrom" tal:attributes="value request/camefrom | nothing"> | ||
</form> | ||
</tal:block> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
### -*- coding: utf-8 -*- #################################################### | ||
# | ||
# Copyright (C) 2010 Ilshad R. Khabibullin <astoon.net at gmail.com> | ||
# | ||
# This library is free software: you can redistribute it and/or modify it | ||
# under the terms of the GNU General Public License as published by the Free | ||
# Software Foundation, either version 3 of the License. | ||
# | ||
# This software is distributed in the hope that it will be useful, but | ||
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
# for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this software. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
# Project homepage: <http://launchpad.net/ice.control> | ||
# | ||
############################################################################## | ||
|
||
class Pagelet: pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
<h1>Logout successful!</h1> | ||
|
||
<p style="font-size: 200%">You are now logged out.</p> | ||
|
||
<a href=".">Back to the main page.</a> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
### -*- coding: utf-8 -*- #################################################### | ||
# | ||
# Copyright (C) 2010 Ilshad R. Khabibullin <astoon.net at gmail.com> | ||
# | ||
# This library is free software: you can redistribute it and/or modify it | ||
# under the terms of the GNU General Public License as published by the Free | ||
# Software Foundation, either version 3 of the License. | ||
# | ||
# This software is distributed in the hope that it will be useful, but | ||
# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY | ||
# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
# for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this software. If not, see <http://www.gnu.org/licenses/>. | ||
# | ||
# Project homepage: <http://launchpad.net/ice.control> | ||
# | ||
# This pagelet is modified browser view based on code of zope.*, | ||
# Copyright (C) Zope Corporation and Contributors. | ||
# | ||
############################################################################## | ||
|
||
from zc.resourcelibrary import need | ||
from zope import interface, component | ||
from zope.authentication.interfaces import IUnauthenticatedPrincipal | ||
from zope.authentication.interfaces import IAuthentication, ILogout | ||
from zope.app.pagetemplate import ViewPageTemplateFile | ||
|
||
class Pagelet(object): | ||
interface.implements(ILogout) | ||
|
||
confirmation = ViewPageTemplateFile('logout.pt') | ||
redirect = ViewPageTemplateFile('redirect.pt') | ||
|
||
def render(self): | ||
nextURL = self.request.get('nextURL') | ||
if not IUnauthenticatedPrincipal(self.request.principal, False): | ||
auth = component.getUtility(IAuthentication) | ||
ILogout(auth).logout(self.request) | ||
if nextURL: | ||
return self.redirect() | ||
if nextURL is None: | ||
return self.confirmation() | ||
return self.request.response.redirect(nextURL) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
<script type="text/javascript"> | ||
try { | ||
if (window.XMLHttpRequest) { | ||
var xmlhttp = new XMLHttpRequest(); | ||
xmlhttp.open("GET", "@@", true, "logout", "logout"); | ||
xmlhttp.send(""); | ||
xmlhttp.abort(); | ||
} else if (document.execCommand) { | ||
document.execCommand("ClearAuthenticationCache"); | ||
} | ||
} catch(e) { } | ||
</script> | ||
|
||
<h1>You are being redirected!</h1> | ||
|
||
<p style="font-size: 150%"> | ||
<a tal:attributes="href view/request/nextURL"> | ||
If you see this screen for more than 5 seconds, click here. | ||
</a> | ||
</p> | ||
|
||
<tal:block content="python:request.response.redirect(request.get('nextURL'))" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,4 +14,6 @@ | |
name="Create User" | ||
/> | ||
|
||
<include package=".browser" /> | ||
|
||
</configure> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters