loginwidget
authorCiro Scognamiglio <ciro.scognamiglio@cslash.net>
Thu, 8 Jan 2015 16:25:41 +0000 (17:25 +0100)
committerCiro Scognamiglio <ciro.scognamiglio@cslash.net>
Thu, 8 Jan 2015 16:25:41 +0000 (17:25 +0100)
myslice/urls.py
portal/loginwidget.py [new file with mode: 0644]
portal/templates/loginwidget.html [new file with mode: 0644]

index 5f4c7d4..083fbdc 100644 (file)
@@ -16,6 +16,7 @@ import portal.platformsview
 import portal.dashboardview
 import portal.homeview
 import portal.newsview
+import portal.loginwidget
 
 from portal.about                   import AboutView
 from portal.registrationview        import RegistrationView
@@ -98,6 +99,8 @@ urls = [
     #(r'^view/?', include('view.urls')),
     #(r'^list/slices', 'view.list.slices')
     #
+    # Login widget to be used in an iframe
+    (r'^loginwidget/?$', portal.loginwidget.LoginWidget.as_view()),
     #
     # Portal
     (r'^news/?$', portal.newsview.NewsView.as_view()),
diff --git a/portal/loginwidget.py b/portal/loginwidget.py
new file mode 100644 (file)
index 0000000..2438fa9
--- /dev/null
@@ -0,0 +1,14 @@
+from django.template                 import RequestContext
+from django.shortcuts                import render_to_response
+
+from django.views.generic.base      import TemplateView
+from unfold.loginrequired import FreeAccessView
+
+from django.http import HttpResponse
+from django.shortcuts import render
+
+class LoginWidget(FreeAccessView):
+    
+    def get(self, request):
+        env = {}
+        return render_to_response("loginwidget.html", env, context_instance=RequestContext(request))
diff --git a/portal/templates/loginwidget.html b/portal/templates/loginwidget.html
new file mode 100644 (file)
index 0000000..03f0cac
--- /dev/null
@@ -0,0 +1,17 @@
+<form action="/login/" method="post" role="form">
+{% csrf_token %}
+<div class="form-group">
+    <input class="input-md" type="email" name="username" placeholder="Enter Email / Username">
+</div>
+<div class="form-group">
+    <input type="password" name="password" placeholder="Password">
+</div>
+<div class="login-submit">
+    <input type="submit" class="btn btn-onelab" value="Sign In" />
+    <span class="lost-password">&nbsp;&nbsp;&nbsp;|&nbsp;&nbsp;&nbsp;<a href="http://portal.onelab.eu/portal/pass_reset/">Can't access your account?</a></span>
+</div>
+<div class="login-signup">
+    You don't have an account yet? 
+    <br /><a href="http://portal.onelab.eu/register">Sign Up!</a>
+</div>
+</form>
\ No newline at end of file