def get_layout(self): return hg.If( hg.C("validlink"), auth_page( layout.forms.Form( hg.C("form"), layout.forms.FormField( "new_password1", inputelement_attrs={"_class": "field-02-background"}, style="width: 100%", ), layout.forms.FormField( "new_password2", inputelement_attrs={"_class": "field-02-background"}, ), id="authform", ), _("Change password"), ), auth_page( hg.BaseElement( hg.FORM(id="authform", action=reverse("login")), layout.notification.InlineNotification( _("Invalid password reset link"), _( "The password reset link was invalid, possibly because it has already been used. Please request a new password reset." ), kind="error", lowcontrast=True, style="margin-bottom: 4rem", ), ), _("Back to Login"), ), )
def auth_page(content, submitname, show_cancelbutton=False): return hg.DIV( hg.DIV( hg.H3(hg.C("pagetitle")), hg.FORM(id="cancelform", action=reverse("login")), content, hg.DIV( hg.If( show_cancelbutton, layout.button.Button( _("Cancel"), buttontype="ghost", form="cancelform", type="submit", style="width: 50%", ), hg.DIV(style="width: 50%"), ), layout.button.Button( submitname, type="submit", form="authform", style="width: 50%" ), style="margin: 1rem -1rem -1rem -1rem; display: flex; height: 64px", ), style="margin: auto; width: 25rem", _class="bx--tile", ), style="background-image: linear-gradient(#0F62FE, #0008C9); position: absolute; left: 0; top: 0; bottom: 0; right: 0; display: flex; flex-direction: column", )
def get_layout(self): return auth_page( hg.BaseElement( layout.notification.InlineNotification( _("Password successfully changed"), _("Please login again"), kind="success", lowcontrast=True, style="margin-bottom: 4rem", ), hg.FORM(action=reverse("login"), id="authform"), ), _("Back to Login"), )
def get_layout(self): return auth_page( hg.BaseElement( layout.notification.InlineNotification( _("Email instructions sent"), _( "If the email address provided exists, you will shortly receive an email containing recovery instructions." ), kind="success", lowcontrast=True, style="margin-bottom: 4rem", ), hg.FORM(action=reverse("login"), id="authform"), ), _("Back to Login"), )
def searchbar(search_urlparameter: str): """ Creates a searchbar element for datatables to submit an entered search term via a GET url parameter """ searchinput = Search( widgetattributes={ "autofocus": True, "name": search_urlparameter, "value": hg.F(lambda c: c["request"].GET.get(search_urlparameter, "")), "onfocus": "this.setSelectionRange(this.value.length, this.value.length);", }) searchinput.close_button.attributes[ "onclick"] = "this.closest('form').querySelector('input').value = ''; this.closest('form').submit()" return hg.DIV( hg.FORM( searchinput, hg.Iterator( hg.C("request").GET.lists(), "urlparameter", hg.If( hg.F( lambda c: c["urlparameter"][0] != search_urlparameter), hg.Iterator( hg.C("urlparameter")[1], "urlvalue", hg.INPUT( type="hidden", name=hg.C("urlparameter")[0], value=hg.C("urlvalue"), ), ), ), ), method="GET", ), _class="bx--toolbar-search-container-persistent", )