Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1#!/usr/local/bin/python
2# encoding: utf-8
3"""
4*Simple Login Page*
6:Author:
7 David Young
8"""
9from builtins import object
10import sys
11import os
12from fundamentals import tools, times
13import khufu
15class login_page(object):
16 """
17 *The worker class for the login_page module*
19 **Key Arguments**
21 - ``log`` -- logger
22 - ``mainCssFilePath`` -- the filepath of the main CSS file
23 - ``jsFilePath`` -- the filepath of the main JS file
24 - ``pageTitle`` -- pageTitle
25 - ``iconPath`` -- webapp icon path
26 - ``came_from`` -- the url this login page was triggered from
27 - ``message`` -- message to display as notification
29 """
31 def __init__(
32 self,
33 log,
34 mainCssFilePath="/static/styles/main.css",
35 jsFilePath="/static/js/main-ck.js",
36 pageTitle="Login",
37 iconPath="",
38 came_from="/",
39 message=""
40 ):
41 self.log = log
42 log.debug("instansiating a new 'login_page' object")
43 self.mainCssFilePath = mainCssFilePath
44 self.jsFilePath = jsFilePath
45 self.pageTitle = pageTitle
46 self.iconPath = iconPath
47 self.came_from = came_from
48 self.message = message
50 # xt-self-arg-tmpx
52 # create the form
53 formContent = khufu.forms.login_form(
54 self.log,
55 self.iconPath,
56 self.message
57 )
58 self.formContent = formContent.get()
59 self.webapge = self._build_webapge_scaffolding()
61 return None
63 def close(self):
64 del self
65 return None
67 def get(self):
68 """
69 *get the login_page object*
71 **Return**
73 - ``login_page`` -- the html login page
75 """
76 self.log.debug('starting the ``get`` method')
78 # CREATE THE WEBPAGE
79 login_page = self.webapge
80 # CLEAR MESSAGE
81 self.message = ""
83 self.log.debug('completed the ``get`` method')
84 return login_page
86 def _build_webapge_scaffolding(
87 self):
88 """
89 *build webapge scaffolding*
91 **Key Arguments**
95 **Return**
97 - ``webpage`` -- the html login page
99 """
100 self.log.debug('starting the ``_build_webapge_scaffolding`` method')
102 head = khufu.head(
103 relativeUrlBase=False,
104 mainCssFilePath=self.mainCssFilePath,
105 pageTitle=self.pageTitle,
106 extras=''
107 )
109 pageContent = khufu.grid_row(
110 responsive=True,
111 columns=self.formContent,
112 htmlId="login_row",
113 htmlClass=False,
114 onPhone=True,
115 onTablet=True,
116 onDesktop=True
117 )
119 body = khufu.body(
120 navBar=False,
121 content=pageContent,
122 htmlId='',
123 extraAttr='',
124 relativeUrlBase=False,
125 responsive=True,
126 googleAnalyticsCode=False,
127 jsFilePath=self.jsFilePath
128 )
130 webpage = khufu.htmlDocument(
131 contentType=False,
132 content="%(head)s %(body)s" % locals()
133 )
135 self.log.debug('completed the ``_build_webapge_scaffolding`` method')
136 return webpage