liquid_feedback_frontend

changeset 1073:f9c1acb859d0

Fixed errors in registration after import of LDAP patch, updated registration layout
author bsw
date Fri Jul 18 23:13:19 2014 +0200 (2014-07-18)
parents ba51e72830e6
children aefef1556d55
files app/main/index/register.lua app/main/member/_profile.lua
line diff
     1.1 --- a/app/main/index/register.lua	Fri Jul 18 23:12:14 2014 +0200
     1.2 +++ b/app/main/index/register.lua	Fri Jul 18 23:13:19 2014 +0200
     1.3 @@ -16,234 +16,229 @@
     1.4  local name = param.get("name")
     1.5  local login = param.get("login")
     1.6  
     1.7 -
     1.8 -ui.form{
     1.9 -  attr = { class = "section vertical" },
    1.10 -  module = 'index',
    1.11 -  action = 'register',
    1.12 -  params = {
    1.13 -    code = code,
    1.14 -    notify_email = notify_email,
    1.15 -    name = name,
    1.16 -    login = login
    1.17 -  },
    1.18 -  content = function()
    1.19 +local member
    1.20  
    1.21 -    if not code and not ldap_uid then
    1.22 -      ui.field.hidden{ name = "step", value = 1 }
    1.23 -      ui.title(_"Registration (step 1 of 3: Invite code)")
    1.24 -      ui.sectionHead( function()
    1.25 -        ui.heading { level = 1, content = _"Please enter the invite code you've received" }
    1.26 -      end )
    1.27 -      ui.sectionRow( function()
    1.28 -        ui.field.text{
    1.29 -          label = _'Invite code',
    1.30 -          name  = 'code',
    1.31 -          value = param.get("invite")
    1.32 -        }
    1.33 -        ui.submit{
    1.34 -          text = _'proceed with registration'
    1.35 -        }
    1.36 -        slot.put(" ")
    1.37 -        ui.link{
    1.38 -          content = _"cancel registration",
    1.39 -          module = "index",
    1.40 -          action = "cancel_register",
    1.41 -          routing = { default = {
    1.42 -            mode = "redirect", module = "index", view = "index"
    1.43 -          } }
    1.44 -        }
    1.45 -      end )
    1.46 -    else
    1.47 -      local member
    1.48 -      
    1.49 -      if ldap_uid then
    1.50 -        member, err = ldap.create_member(ldap_uid, true)
    1.51 -        if err then
    1.52 -          error(err)
    1.53 -        end
    1.54 -      else
    1.55 -        member = Member:new_selector()
    1.56 -          :add_where{ "invite_code = ?", code }
    1.57 -          :add_where{ "activated ISNULL" }
    1.58 -          :optional_object_mode()
    1.59 -          :exec()
    1.60 -      end
    1.61 +if ldap_uid then
    1.62 +  member, err = ldap.create_member(ldap_uid, true)
    1.63 +  if err then
    1.64 +    error(err)
    1.65 +  end
    1.66 +elseif code then
    1.67 +  member = Member:new_selector()
    1.68 +    :add_where{ "invite_code = ?", code }
    1.69 +    :add_where{ "activated ISNULL" }
    1.70 +    :optional_object_mode()
    1.71 +    :exec()
    1.72 +end
    1.73  
    1.74 -      if    (not member.notify_email and not notify_email)
    1.75 +
    1.76 +
    1.77 +ui.section( function()
    1.78 +
    1.79 +  if not code and not ldap_uid then
    1.80 +    ui.title(_"Registration (step 1 of 3: Invite code)")
    1.81 +    ui.sectionHead( function()
    1.82 +      ui.heading { level = 1, content = _"Invite code" }
    1.83 +    end )
    1.84 +  elseif (not member.notify_email and not notify_email)
    1.85           or (not member.name and not name)
    1.86           or (not member.login and not login and not member.authority)
    1.87           or step == 1 then
    1.88 -        ui.title(_"Registration (step 2 of 3: Personal information)")
    1.89 -        ui.field.hidden{ name = "step", value = 2 }
    1.90 -
    1.91 -        ui.sectionHead( function()
    1.92 -          ui.heading { level = 1, content = _"Check and enter personal data" }
    1.93 -        end )
    1.94 -        ui.sectionRow( function()
    1.95 -          ui.tag{
    1.96 -            tag = "p",
    1.97 -            content = _"This invite key is connected with the following information:"
    1.98 -          }
    1.99 -          
   1.100 -          execute.view{ module = "member", view = "_profile", params = { member = member, for_registration = true } }
   1.101 +    ui.title(_"Registration (step 2 of 3: Personal information)")
   1.102 +    ui.sectionHead( function()
   1.103 +      ui.heading { level = 1, content = _"Check and enter personal data" }
   1.104 +    end )
   1.105 +  else
   1.106 +    ui.title(_"Registration (step 3 of 3: Terms of use and password)")
   1.107 +    ui.sectionHead( function()
   1.108 +      ui.heading { level = 1, content = _"Read and accept the terms and choose a password" }
   1.109 +    end )
   1.110 +  end
   1.111  
   1.112 -          if not util.is_profile_field_locked(member, "notify_email") then
   1.113 -            ui.tag{
   1.114 -              tag = "p",
   1.115 -              content = _"Please enter your email address. This address will be used for automatic notifications (if you request them) and in case you've lost your password. This address will not be published. After registration you will receive an email with a confirmation link."
   1.116 -            }
   1.117 -            ui.field.text{
   1.118 -              label     = _'Email address',
   1.119 -              name      = 'notify_email',
   1.120 -              value     = param.get("notify_email") or member.notify_email
   1.121 -            }
   1.122 -          end
   1.123 -          if not util.is_profile_field_locked(member, "name") then
   1.124 -            ui.tag{
   1.125 -              tag = "p",
   1.126 -              content = _"Please choose a name, i.e. your real name or your nick name. This name will be shown to others to identify you."
   1.127 -            }
   1.128 -            ui.field.text{
   1.129 -              label     = _'Screen name',
   1.130 -              name      = 'name',
   1.131 -              value     = param.get("name") or member.name
   1.132 -            }
   1.133 -          end
   1.134 -          if not util.is_profile_field_locked(member, "login") then
   1.135 -            ui.tag{
   1.136 -              tag = "p",
   1.137 -              content = _"Please choose a login name. This name will not be shown to others and is used only by you to login into the system. The login name is case sensitive."
   1.138 -            }
   1.139 -            ui.field.text{
   1.140 -              label     = _'Login name',
   1.141 -              name      = 'login',
   1.142 -              value     = param.get("login") or member.login
   1.143 -            }
   1.144 -          end
   1.145 +  ui.sectionRow( function()
   1.146 +    ui.form{
   1.147 +      attr = { class = "wide" },
   1.148 +      module = 'index',
   1.149 +      action = 'register',
   1.150 +      params = {
   1.151 +        code = code,
   1.152 +        notify_email = notify_email,
   1.153 +        name = name,
   1.154 +        login = login
   1.155 +      },
   1.156 +      content = function()
   1.157 +
   1.158 +        if not code and not ldap_uid then
   1.159 +          ui.field.hidden{ name = "step", value = 1 }
   1.160 +          ui.heading { level = 2, content = _"Please enter the invite code you've received" }
   1.161 +          ui.field.text{
   1.162 +            name  = 'code',
   1.163 +            value = param.get("invite")
   1.164 +          }
   1.165            ui.submit{
   1.166 -            text = _'proceed with registration'
   1.167 -          }
   1.168 -          slot.put(" ")
   1.169 -          ui.link{
   1.170 -            content = _"one step back",
   1.171 -            module = "index",
   1.172 -            view = "register",
   1.173 -            params = {
   1.174 -              invite = code
   1.175 -            }
   1.176 +            text = _'proceed with registration',
   1.177 +              attr = { class = "btn btn-default" }
   1.178            }
   1.179            slot.put(" ")
   1.180 -          ui.link{
   1.181 -            content = _"cancel registration",
   1.182 -            module = "index",
   1.183 -            action = "cancel_register",
   1.184 -            routing = { default = {
   1.185 -              mode = "redirect", module = "index", view = "index"
   1.186 -            } }
   1.187 -          }
   1.188 -        end )
   1.189 -      else
   1.190 +        else
   1.191 +          if (not member.notify_email and not notify_email)
   1.192 +            or (not member.name and not name)
   1.193 +            or (not member.login and not login and not member.authority)
   1.194 +            or step == 1 then
   1.195 +            ui.field.hidden{ name = "step", value = 2 }
   1.196  
   1.197 -        ui.field.hidden{ name = "step", value = "3" }
   1.198 -        ui.title(_"Registration (step 3 of 3: Terms of use and password)")
   1.199 -        ui.sectionHead( function()
   1.200 -          ui.heading { level = 1, content = _"Read and accept the terms and choose a password" }
   1.201 -        end )
   1.202 -        ui.sectionRow( function()
   1.203 -          ui.container{
   1.204 -            attr = { class = "wiki use_terms" },
   1.205 -            content = function()
   1.206 -              slot.put(config.use_terms)
   1.207 -            end
   1.208 -          }
   1.209 +            ui.tag{
   1.210 +              tag = "p",
   1.211 +              content = _"This invite key is connected with the following information:"
   1.212 +            }
   1.213 +            
   1.214 +            execute.view{ module = "member", view = "_profile", params = { member = member, for_registration = true } }
   1.215  
   1.216 -          member.notify_email = notify_email or member.notify_email
   1.217 -          member.name = name or member.name
   1.218 -          member.login = login or member.login
   1.219 -          
   1.220 -          execute.view{ module = "member", view = "_profile", params = {
   1.221 -            member = member, include_private_data = true
   1.222 -          } }
   1.223 -          
   1.224 -          for i, checkbox in ipairs(config.use_terms_checkboxes) do
   1.225 -            slot.put("<br />")
   1.226 -            ui.tag{
   1.227 -              tag = "div",
   1.228 +            if not util.is_profile_field_locked(member, "notify_email") then
   1.229 +              ui.heading { level = 2, content = _'Email address' }
   1.230 +              ui.tag{
   1.231 +                tag = "p",
   1.232 +                content = _"Please enter your email address. This address will be used for automatic notifications (if you request them) and in case you've lost your password. This address will not be published. After registration you will receive an email with a confirmation link."
   1.233 +              }
   1.234 +              ui.field.text{
   1.235 +                name      = 'notify_email',
   1.236 +                value     = param.get("notify_email") or member.notify_email
   1.237 +              }
   1.238 +            end
   1.239 +            if not util.is_profile_field_locked(member, "name") then
   1.240 +              ui.heading { level = 2, content = _'Screen name' }
   1.241 +              ui.tag{
   1.242 +                tag = "p",
   1.243 +                content = _"Please choose a name, i.e. your real name or your nick name. This name will be shown to others to identify you."
   1.244 +              }
   1.245 +              ui.field.text{
   1.246 +                name      = 'name',
   1.247 +                value     = param.get("name") or member.name
   1.248 +              }
   1.249 +            end
   1.250 +            if not util.is_profile_field_locked(member, "login") then
   1.251 +              ui.heading { level = 2, content = _'Login name' }
   1.252 +              ui.tag{
   1.253 +                tag = "p",
   1.254 +                content = _"Please choose a login name. This name will not be shown to others and is used only by you to login into the system. The login name is case sensitive."
   1.255 +              }
   1.256 +              ui.field.text{
   1.257 +                name      = 'login',
   1.258 +                value     = param.get("login") or member.login
   1.259 +              }
   1.260 +            end
   1.261 +            ui.submit{
   1.262 +              text = _'proceed with registration',
   1.263 +              attr = { class = "btn btn-default" }
   1.264 +            }
   1.265 +            slot.put(" ")
   1.266 +            ui.link{
   1.267 +              content = _"one step back",
   1.268 +              module = "index",
   1.269 +              view = "register",
   1.270 +              params = {
   1.271 +                invite = code
   1.272 +              }
   1.273 +            }
   1.274 +          else
   1.275 +
   1.276 +            ui.field.hidden{ name = "step", value = "3" }
   1.277 +            ui.container{
   1.278 +              attr = { class = "wiki use_terms" },
   1.279                content = function()
   1.280 -                ui.tag{
   1.281 -                  tag = "input",
   1.282 -                  attr = {
   1.283 -                    type = "checkbox",
   1.284 -                    id = "use_terms_checkbox_" .. checkbox.name,
   1.285 -                    name = "use_terms_checkbox_" .. checkbox.name,
   1.286 -                    value = "1",
   1.287 -                    style = "float: left;",
   1.288 -                    checked = param.get("use_terms_checkbox_" .. checkbox.name, atom.boolean) and "checked" or nil
   1.289 -                  }
   1.290 -                }
   1.291 -                slot.put("&nbsp;")
   1.292 -                ui.tag{
   1.293 -                  tag = "label",
   1.294 -                  attr = { ['for'] = "use_terms_checkbox_" .. checkbox.name },
   1.295 -                  content = function() slot.put(checkbox.html) end
   1.296 -                }
   1.297 +                slot.put(config.use_terms)
   1.298                end
   1.299              }
   1.300 -          end
   1.301 -
   1.302 -          slot.put("<br />")
   1.303  
   1.304 -          if not member.authority == "ldap" then
   1.305 -            ui.tag{
   1.306 -              tag = "p",
   1.307 -              content = _"Please choose a password and enter it twice. The password is case sensitive."
   1.308 -            }
   1.309 +            for i, checkbox in ipairs(config.use_terms_checkboxes) do
   1.310 +              slot.put("<br />")
   1.311 +              ui.tag{
   1.312 +                tag = "div",
   1.313 +                content = function()
   1.314 +                  ui.tag{
   1.315 +                    tag = "input",
   1.316 +                    attr = {
   1.317 +                      type = "checkbox",
   1.318 +                      id = "use_terms_checkbox_" .. checkbox.name,
   1.319 +                      name = "use_terms_checkbox_" .. checkbox.name,
   1.320 +                      value = "1",
   1.321 +                      style = "float: left;",
   1.322 +                      checked = param.get("use_terms_checkbox_" .. checkbox.name, atom.boolean) and "checked" or nil
   1.323 +                    }
   1.324 +                  }
   1.325 +                  slot.put("&nbsp;")
   1.326 +                  ui.tag{
   1.327 +                    tag = "label",
   1.328 +                    attr = { ['for'] = "use_terms_checkbox_" .. checkbox.name },
   1.329 +                    content = function() slot.put(checkbox.html) end
   1.330 +                  }
   1.331 +                end
   1.332 +              }
   1.333 +            end
   1.334 +
   1.335 +            slot.put("<br />")
   1.336 +
   1.337 +            member.notify_email = notify_email or member.notify_email
   1.338 +            member.name = name or member.name
   1.339 +            member.login = login or member.login
   1.340 +            
   1.341 +            ui.heading { level = 2, content = _"Personal information" }
   1.342 +            execute.view{ module = "member", view = "_profile", params = {
   1.343 +              member = member, include_private_data = true
   1.344 +            } }
   1.345              ui.field.text{
   1.346                readonly  = true,
   1.347                label     = _'Login name',
   1.348                name      = 'login',
   1.349                value     = member.login
   1.350              }
   1.351 -            ui.field.password{
   1.352 -              label     = _'Password',
   1.353 -              name      = 'password1',
   1.354 +            
   1.355 +            if not (member.authority == "ldap") then
   1.356 +              ui.heading { level = 2, content = _'Password' }
   1.357 +              ui.tag{
   1.358 +                tag = "p",
   1.359 +                content = _"Please choose a password and enter it twice. The password is case sensitive."
   1.360 +              }
   1.361 +              ui.field.password{
   1.362 +                name      = 'password1',
   1.363 +              }
   1.364 +              ui.field.password{
   1.365 +                name      = 'password2',
   1.366 +              }
   1.367 +            end
   1.368 +            
   1.369 +            ui.submit{
   1.370 +              text = _'activate account',
   1.371 +              attr = { class = "btn btn-default" }
   1.372              }
   1.373 -            ui.field.password{
   1.374 -              label     = _'Password (repeat)',
   1.375 -              name      = 'password2',
   1.376 +            slot.put(" ")
   1.377 +            ui.link{
   1.378 +              content = _"one step back",
   1.379 +              module = "index",
   1.380 +              view = "register",
   1.381 +              params = {
   1.382 +                code = code,
   1.383 +                notify_email = notify_email,
   1.384 +                name = name,
   1.385 +                login = login, 
   1.386 +                step = 1
   1.387 +              }
   1.388              }
   1.389            end
   1.390 -          
   1.391 -          ui.submit{
   1.392 -            text = _'activate account'
   1.393 -          }
   1.394 -          slot.put(" ")
   1.395 -          ui.link{
   1.396 -            content = _"one step back",
   1.397 -            module = "index",
   1.398 -            view = "register",
   1.399 -            params = {
   1.400 -              code = code,
   1.401 -              notify_email = notify_email,
   1.402 -              name = name,
   1.403 -              login = login, 
   1.404 -              step = 1
   1.405 -            }
   1.406 -          }
   1.407 -          slot.put(" ")
   1.408 -          ui.link{
   1.409 -            content = _"cancel registration",
   1.410 -            module = "index",
   1.411 -            action = "cancel_register",
   1.412 -            routing = { default = {
   1.413 -              mode = "redirect", module = "index", view = "index"
   1.414 -            } }
   1.415 -          }
   1.416 -        end )
   1.417 +        end
   1.418        end
   1.419 -    end
   1.420 -  end
   1.421 -}
   1.422 +    }
   1.423 +
   1.424 +    slot.put("<br /><br />")
   1.425  
   1.426 +    ui.link{
   1.427 +      content = _"cancel registration",
   1.428 +      module = "index",
   1.429 +      action = "cancel_register",
   1.430 +      routing = { default = {
   1.431 +        mode = "redirect", module = "index", view = "index"
   1.432 +      } }
   1.433 +    }
   1.434 +  end )
   1.435 +end )
   1.436  
     2.1 --- a/app/main/member/_profile.lua	Fri Jul 18 23:12:14 2014 +0200
     2.2 +++ b/app/main/member/_profile.lua	Fri Jul 18 23:13:19 2014 +0200
     2.3 @@ -114,8 +114,6 @@
     2.4          end
     2.5        }
     2.6      end
     2.7 -    slot.put("<br style=\"clear: both;\" /><br />")
     2.8    end
     2.9  }
    2.10  
    2.11 -slot.put("<br />")
    2.12 \ No newline at end of file

Impressum / About Us