liquid_feedback_frontend

view app/main/index/login.lua @ 1679:ac45e0fe1221

Automatically assume dropdown item id from name when id is empty
author bsw
date Mon Sep 20 09:02:57 2021 +0200 (2021-09-20)
parents 32cc544d5a5b
children b27b327be05e
line source
1 ui.tag{
2 tag = "noscript",
3 content = function()
4 slot.put(_"JavaScript is disabled or not available.")
5 end
6 }
8 ui.title(_"Login")
9 app.html_title.title = _"Login"
11 ui.container{ attr = { class = "mdl-grid" }, content = function()
12 ui.container{ attr = { class = "mdl-cell mdl-cell--12-col" }, content = function()
13 execute.view{ module = "index", view = "_sidebar_motd_public" }
15 execute.view{ module = "index", view = "_lang_chooser" }
17 ui.heading{ level = 1, content = _"Login" }
19 local redirect_params = {}
20 local redirect_params_string = param.get("redirect_params")
22 if redirect_params_string then
23 local tmp = json.import(redirect_params_string)
24 if type(tmp) == "table" then
25 for k, v in pairs(tmp) do
26 if type(v) == "string" then
27 redirect_params[k] = v
28 end
29 end
30 end
31 end
33 ui.form{
34 module = 'index',
35 action = 'login',
36 routing = {
37 ok = {
38 mode = 'redirect',
39 module = param.get("redirect_module") or "index",
40 view = param.get("redirect_view") or "index",
41 id = param.get("redirect_id"),
42 params = redirect_params
43 },
44 error = {
45 mode = 'redirect',
46 module = "index",
47 view = "login",
48 params = {
49 redirect_module = param.get("redirect_module"),
50 redirect_view = param.get("redirect_view"),
51 redirect_id = param.get("redirect_id"),
52 redirect_params = param.get("redirect_params")
53 }
54 }
55 },
56 content = function()
57 if slot.get_content("error_code") == "invalid_credentials" then
58 ui.container{ attr = { class = "warning" }, content = _"Invalid login name or password!" }
59 end
60 ui.field.text{
61 container_attr = { class = "mdl-textfield mdl-js-textfield mdl-textfield--floating-label" },
62 attr = { id = "lf-login__username", class = "mdl-textfield__input" },
63 label_attr = { class = "mdl-textfield__label", ["for"] = "lf-login__username" },
64 label = _'Login name',
65 name = 'login',
66 value = ''
67 }
68 slot.put("<br />")
69 ui.field.password{
70 container_attr = { class = "mdl-textfield mdl-js-textfield mdl-textfield--floating-label" },
71 attr = { id = "lf-login__password", class = "mdl-textfield__input" },
72 label_attr = { class = "mdl-textfield__label", ["for"] = "lf-login__password" },
73 label = _'Password',
74 name = 'password',
75 value = ''
76 }
77 slot.put("<br /><br />")
78 ui.tag{
79 tag = "input",
80 attr = {
81 type = "submit",
82 class = "mdl-button mdl-js-button mdl-button--raised mdl-button--colored",
83 value = _'Login'
84 }
85 }
86 slot.put(" &nbsp; ")
87 ui.link{
88 attr = { class = "mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect" },
89 module = "index", view = "index", text = _"Cancel"
90 }
91 if not config.disable_registration then
92 slot.put(" &nbsp; ")
93 ui.link{
94 attr = { class = "mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--underlined" },
95 module = "index", view = "register", text = _"No account yet?", params = {
96 redirect_module = param.get("redirect_module"),
97 redirect_view = param.get("redirect_view"),
98 redirect_id = param.get("redirect_id"),
99 redirect_params = param.get("redirect_params")
100 }
101 }
102 end
103 if config.self_registration then
104 slot.put(" &nbsp; ")
105 ui.link{
106 attr = { class = "mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--underlined" },
107 module = "registration", view = "register", text = _"No account yet?", params = {
108 redirect_module = param.get("redirect_module"),
109 redirect_view = param.get("redirect_view"),
110 redirect_id = param.get("redirect_id"),
111 redirect_params = param.get("redirect_params")
112 }
113 }
114 end
115 slot.put("<br /><br />")
116 ui.link{
117 attr = { class = "mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--underlined" },
118 module = "index", view = "reset_password", text = _"Forgot password?", params = {
119 redirect_module = param.get("redirect_module"),
120 redirect_view = param.get("redirect_view"),
121 redirect_id = param.get("redirect_id"),
122 redirect_params = param.get("redirect_params")
123 }
124 }
125 slot.put(" &nbsp; ")
126 ui.link{
127 attr = { class = "mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--underlined" },
128 module = "index", view = "send_login", text = _"Forgot login name?", params = {
129 redirect_module = param.get("redirect_module"),
130 redirect_view = param.get("redirect_view"),
131 redirect_id = param.get("redirect_id"),
132 redirect_params = param.get("redirect_params")
133 }
134 }
135 end
136 }
137 end }
138 end }

Impressum / About Us