WhakerKit 2.0

https://sourceforge.net/projects/whakerkit/

Module whakerkit.nodes

Class WhakerKitLoginNode

Description

Node for the login dialog.

Constructor

Create the login node.

Parameters
  • parent: (str) The parent node identifier
View Source
def __init__(self, parent: str):
    """Create the login node.

    :param parent: (str) The parent node identifier

    """
    super(WhakerKitLoginNode, self).__init__(parent, 'login_dialog', 'dialog', attributes={'id': 'login_dialog'})
    self.reset()

Public functions

reset

Reset the login to its default values.

Expects a JS instance authManager to open the login dialog.

View Source
def reset(self):
    """Reset the login to its default values.

        Expects a JS instance authManager to open the login dialog.

        """
    self._children = list()
    nav = WhakerKitAccessibilityNavNode(self.identifier)
    self.append_child(nav)
    title = HTMLNode(self.identifier, None, 'h1', value=get_msg(MSG_HEADER_H1))
    self.append_child(title)
    attributes = {'method': 'POST', 'id': 'login_form', 'accept-charset': 'UTF-8', 'action': 'javascript:void(0);', 'onsubmit': 'authManager.submitLoginDialog();'}
    form = HTMLNode(self.identifier, 'login_form', 'form', attributes=attributes)
    self.append_child(form)
    WhakerKitLoginNode.__login_form_content(form)

Protected functions

__login_form_content

Create the content of the login form.

Parameters
  • form: (HTMLNode) The node of the login form
View Source
@staticmethod
def __login_form_content(form: HTMLNode):
    """Create the content of the login form.

        :param form: (HTMLNode) The node of the login form

        """
    label_username = HTMLNode(form.identifier, 'username_label', 'label', value=get_msg(MSG_USERNAME), attributes={'for': 'username_input'})
    form.append_child(label_username)
    att = {'id': 'username_input', 'name': 'username_input', 'placeholder': get_msg(MSG_USERID), 'type': 'text', 'aria-labelledby': 'username_label'}
    input_username = HTMLNode(form.identifier, 'username_input', 'input', attributes=att)
    form.append_child(input_username)
    label_password = HTMLNode(form.identifier, 'password_label', 'label', value=get_msg(MSG_PASSWORD), attributes={'for': 'password_input'})
    form.append_child(label_password)
    att = {'id': 'password_input', 'name': 'password_input', 'placeholder': '*********', 'type': 'password', 'aria-labelledby': 'password_label'}
    input_password = HTMLNode(form.identifier, 'password_input', 'input', attributes=att)
    form.append_child(input_password)
    btn = create_action_button(form.identifier, None, get_msg(MSG_LOGIN), whakerkit.sg.path + 'statics/icons/authentication.png')
    btn.add_attribute('id', 'login_button')
    btn.add_attribute('type', 'submit')
    form.append_child(btn)