liquid_feedback_frontend

diff app/main/index/login.lua @ 1309:32cc544d5a5b

Cumulative patch for upcoming frontend version 4
author bsw/jbe
date Sun Jul 15 14:07:29 2018 +0200 (2018-07-15)
parents 904f6807f7fa
children b27b327be05e
line diff
     1.1 --- a/app/main/index/login.lua	Thu Jun 23 03:30:57 2016 +0200
     1.2 +++ b/app/main/index/login.lua	Sun Jul 15 14:07:29 2018 +0200
     1.3 @@ -8,90 +8,131 @@
     1.4  ui.title(_"Login")
     1.5  app.html_title.title = _"Login"
     1.6  
     1.7 -execute.view{ module = "index", view = "_sidebar_motd_public" }
     1.8 +ui.container{ attr = { class = "mdl-grid" }, content = function()
     1.9 +  ui.container{ attr = { class = "mdl-cell mdl-cell--12-col" }, content = function()
    1.10 +    execute.view{ module = "index", view = "_sidebar_motd_public" }
    1.11  
    1.12 -ui.section(function() 
    1.13 +    execute.view{ module = "index", view = "_lang_chooser" }
    1.14 +
    1.15 +    ui.heading{ level = 1, content = _"Login" }
    1.16  
    1.17 -ui.sectionHead(function()
    1.18 -  ui.heading{ level = 1, content = _"Login" }
    1.19 -  ui.container { attr = { class = "right" }, content = function()
    1.20 -    for i, lang in ipairs(config.enabled_languages) do
    1.21 -      local langcode
    1.22 -      locale.do_with({ lang = lang }, function()
    1.23 -        langcode = _("[Name of Language]")
    1.24 -      end)
    1.25 -      
    1.26 -      if i > 1 then
    1.27 -        slot.put(" | ")
    1.28 +    local redirect_params = {}
    1.29 +    local redirect_params_string = param.get("redirect_params") 
    1.30 +
    1.31 +    if redirect_params_string then
    1.32 +      local tmp = json.import(redirect_params_string)
    1.33 +      if type(tmp) == "table" then
    1.34 +        for k, v in pairs(tmp) do
    1.35 +          if type(v) == "string" then
    1.36 +            redirect_params[k] = v
    1.37 +          end
    1.38 +        end
    1.39        end
    1.40 -      
    1.41 -      ui.link{
    1.42 -        content = function()
    1.43 -          ui.tag{ content = langcode }
    1.44 -        end,
    1.45 -        module = "index",
    1.46 -        action = "set_lang",
    1.47 -        params = { lang = lang },
    1.48 -        routing = {
    1.49 -          default = {
    1.50 -            mode = "redirect",
    1.51 -            module = request.get_module(),
    1.52 -            view = request.get_view(),
    1.53 -            id = request.get_id_string(),
    1.54 -            params = request.get_param_strings()
    1.55 +    end
    1.56 +
    1.57 +    ui.form{
    1.58 +      module = 'index',
    1.59 +      action = 'login',
    1.60 +      routing = {
    1.61 +        ok = {
    1.62 +          mode   = 'redirect',
    1.63 +          module = param.get("redirect_module") or "index",
    1.64 +          view = param.get("redirect_view") or "index",
    1.65 +          id = param.get("redirect_id"),
    1.66 +          params = redirect_params
    1.67 +        },
    1.68 +        error = {
    1.69 +          mode   = 'redirect',
    1.70 +          module = "index",
    1.71 +          view = "login",
    1.72 +          params = {
    1.73 +      redirect_module = param.get("redirect_module"),
    1.74 +      redirect_view   = param.get("redirect_view"),
    1.75 +      redirect_id     = param.get("redirect_id"),
    1.76 +      redirect_params = param.get("redirect_params")
    1.77            }
    1.78          }
    1.79 -      }
    1.80 -    end
    1.81 -  end }
    1.82 -end)
    1.83 -ui.form{
    1.84 -  module = 'index',
    1.85 -  action = 'login',
    1.86 -  routing = {
    1.87 -    ok = {
    1.88 -      mode   = 'redirect',
    1.89 -      module = param.get("redirect_module") or "index",
    1.90 -      view = param.get("redirect_view") or "index",
    1.91 -      id = param.get("redirect_id"),
    1.92 -    },
    1.93 -    error = {
    1.94 -      mode   = 'forward',
    1.95 -      module = 'index',
    1.96 -      view   = 'login',
    1.97 -    }
    1.98 -  },
    1.99 -  content = function()
   1.100 -    ui.sectionRow(function()
   1.101 -      ui.field.text{
   1.102 -        attr = { id = "username_field" },
   1.103 -        label     = _'Login name',
   1.104 -        name = 'login',
   1.105 -        value     = ''
   1.106 -      }
   1.107 -      ui.script{ script = 'document.getElementById("username_field").focus();' }
   1.108 -      ui.field.password{
   1.109 -        label     = _'Password',
   1.110 -        name = 'password',
   1.111 -        value     = ''
   1.112 -      }
   1.113 -      ui.container { attr = { class = "actions" }, content = function()
   1.114 +      },
   1.115 +      content = function()
   1.116 +        if slot.get_content("error_code") == "invalid_credentials" then
   1.117 +          ui.container{ attr = { class = "warning" }, content = _"Invalid login name or password!" }
   1.118 +        end
   1.119 +        ui.field.text{
   1.120 +          container_attr = { class = "mdl-textfield mdl-js-textfield mdl-textfield--floating-label" },
   1.121 +          attr = { id = "lf-login__username", class = "mdl-textfield__input" },
   1.122 +          label_attr = { class = "mdl-textfield__label", ["for"] = "lf-login__username" },
   1.123 +          label     = _'Login name',
   1.124 +          name = 'login',
   1.125 +          value     = ''
   1.126 +        }
   1.127 +        slot.put("<br />")
   1.128 +        ui.field.password{
   1.129 +          container_attr = { class = "mdl-textfield mdl-js-textfield mdl-textfield--floating-label" },
   1.130 +          attr = { id = "lf-login__password", class = "mdl-textfield__input" },
   1.131 +          label_attr = { class = "mdl-textfield__label", ["for"] = "lf-login__password" },
   1.132 +          label     = _'Password',
   1.133 +          name = 'password',
   1.134 +          value     = ''
   1.135 +        }
   1.136 +        slot.put("<br /><br />")
   1.137          ui.tag{
   1.138            tag = "input",
   1.139            attr = {
   1.140              type = "submit",
   1.141 -            class = "btn btn-default",
   1.142 +            class = "mdl-button mdl-js-button mdl-button--raised mdl-button--colored",
   1.143              value = _'Login'
   1.144 -          },
   1.145 -          content = ""
   1.146 +          }
   1.147 +        }
   1.148 +        slot.put(" &nbsp; ")
   1.149 +        ui.link{ 
   1.150 +          attr = { class = "mdl-button mdl-js-button mdl-button--raised mdl-js-ripple-effect" },
   1.151 +          module = "index", view = "index", text = _"Cancel"
   1.152          }
   1.153 -        slot.put("<br />")
   1.154 -        slot.put("<br />")
   1.155 -        ui.link{ module = "index", view = "reset_password", text = _"Forgot password?" }
   1.156 -        slot.put("&nbsp;&nbsp;")
   1.157 -        ui.link{ module = "index", view = "send_login", text = _"Forgot login name?" }
   1.158 -      end }
   1.159 -    end )
   1.160 -  end
   1.161 -}
   1.162 -end )
   1.163 \ No newline at end of file
   1.164 +        if not config.disable_registration then
   1.165 +          slot.put(" &nbsp; ")
   1.166 +          ui.link{ 
   1.167 +            attr = { class = "mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--underlined" },
   1.168 +            module = "index", view = "register", text = _"No account yet?", params = {
   1.169 +              redirect_module = param.get("redirect_module"),
   1.170 +              redirect_view = param.get("redirect_view"),
   1.171 +              redirect_id = param.get("redirect_id"),
   1.172 +              redirect_params = param.get("redirect_params")
   1.173 +            } 
   1.174 +          }
   1.175 +        end
   1.176 +        if config.self_registration then
   1.177 +          slot.put(" &nbsp; ")
   1.178 +          ui.link{ 
   1.179 +            attr = { class = "mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--underlined" },
   1.180 +            module = "registration", view = "register", text = _"No account yet?", params = {
   1.181 +              redirect_module = param.get("redirect_module"),
   1.182 +              redirect_view = param.get("redirect_view"),
   1.183 +              redirect_id = param.get("redirect_id"),
   1.184 +              redirect_params = param.get("redirect_params")
   1.185 +            } 
   1.186 +          }
   1.187 +        end
   1.188 +        slot.put("<br /><br />")
   1.189 +        ui.link{
   1.190 +          attr = { class = "mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--underlined" },
   1.191 +          module = "index", view = "reset_password", text = _"Forgot password?", params = {
   1.192 +            redirect_module = param.get("redirect_module"),
   1.193 +            redirect_view = param.get("redirect_view"),
   1.194 +            redirect_id = param.get("redirect_id"),
   1.195 +            redirect_params = param.get("redirect_params")
   1.196 +          }
   1.197 +        }
   1.198 +        slot.put(" &nbsp; ")
   1.199 +        ui.link{
   1.200 +          attr = { class = "mdl-button mdl-js-button mdl-js-ripple-effect mdl-button--underlined" },
   1.201 +          module = "index", view = "send_login", text = _"Forgot login name?", params = {
   1.202 +            redirect_module = param.get("redirect_module"),
   1.203 +            redirect_view = param.get("redirect_view"),
   1.204 +            redirect_id = param.get("redirect_id"),
   1.205 +            redirect_params = param.get("redirect_params")
   1.206 +          }
   1.207 +        }
   1.208 +      end
   1.209 +    }
   1.210 +  end }
   1.211 +end }

Impressum / About Us