| rev | 
   line source | 
| 
bsw/jbe@1309
 | 
     1 local verification = Verification:by_id(param.get_id())
 | 
| 
bsw/jbe@1309
 | 
     2 
 | 
| 
bsw/jbe@1309
 | 
     3 local data = {}
 | 
| 
bsw/jbe@1309
 | 
     4 
 | 
| 
bsw/jbe@1309
 | 
     5 for i, field in ipairs(config.verification.fields) do
 | 
| 
bsw/jbe@1309
 | 
     6   table.insert(data, {
 | 
| 
bsw/jbe@1309
 | 
     7     label = field.label,
 | 
| 
bsw/jbe@1309
 | 
     8     value = verification.request_data[field.name]
 | 
| 
bsw/jbe@1309
 | 
     9   })
 | 
| 
bsw/jbe@1309
 | 
    10 end
 | 
| 
bsw/jbe@1309
 | 
    11 
 | 
| 
bsw/jbe@1309
 | 
    12 table.insert(data, {
 | 
| 
bsw/jbe@1309
 | 
    13   label = _"IP address",
 | 
| 
bsw/jbe@1309
 | 
    14   value = verification.request_origin.ip
 | 
| 
bsw/jbe@1309
 | 
    15 })
 | 
| 
bsw/jbe@1309
 | 
    16 
 | 
| 
bsw/jbe@1309
 | 
    17 table.insert(data, {
 | 
| 
bsw/jbe@1309
 | 
    18   label = _"Hostname",
 | 
| 
bsw/jbe@1309
 | 
    19   value = verification.request_origin.hostname
 | 
| 
bsw/jbe@1309
 | 
    20 })
 | 
| 
bsw/jbe@1309
 | 
    21 
 | 
| 
bsw/jbe@1309
 | 
    22 if verification.verified then
 | 
| 
bsw/jbe@1309
 | 
    23   table.insert(data, {
 | 
| 
bsw/jbe@1309
 | 
    24     label = _"Requested at",
 | 
| 
bsw/jbe@1309
 | 
    25     value = format.timestamp(verification.requested)
 | 
| 
bsw/jbe@1309
 | 
    26   })
 | 
| 
bsw/jbe@1309
 | 
    27 end
 | 
| 
bsw/jbe@1309
 | 
    28 
 | 
| 
bsw/jbe@1309
 | 
    29 if verification.requesting_member_id then
 | 
| 
bsw/jbe@1309
 | 
    30   table.insert(data, {
 | 
| 
bsw/jbe@1309
 | 
    31     label = _"Requested by account",
 | 
| 
bsw/jbe@1309
 | 
    32     value = verification.requesting_member_id
 | 
| 
bsw/jbe@1309
 | 
    33   })
 | 
| 
bsw/jbe@1309
 | 
    34 end
 | 
| 
bsw/jbe@1309
 | 
    35 
 | 
| 
bsw/jbe@1309
 | 
    36 if verification.verified then
 | 
| 
bsw/jbe@1309
 | 
    37   table.insert(data, {
 | 
| 
bsw/jbe@1309
 | 
    38     label = _"Verified at",
 | 
| 
bsw/jbe@1309
 | 
    39     value = format.timestamp(verification.verified)
 | 
| 
bsw/jbe@1309
 | 
    40   })
 | 
| 
bsw/jbe@1309
 | 
    41 end
 | 
| 
bsw/jbe@1309
 | 
    42 
 | 
| 
bsw/jbe@1309
 | 
    43 if verification.denied then
 | 
| 
bsw/jbe@1309
 | 
    44   table.insert(data, {
 | 
| 
bsw/jbe@1309
 | 
    45     label = _"Denied at",
 | 
| 
bsw/jbe@1309
 | 
    46     value = format.timestamp(verification.denied)
 | 
| 
bsw/jbe@1309
 | 
    47   })
 | 
| 
bsw/jbe@1309
 | 
    48 end
 | 
| 
bsw/jbe@1309
 | 
    49 
 | 
| 
bsw/jbe@1309
 | 
    50 if verification.verifying_member_id then
 | 
| 
bsw/jbe@1309
 | 
    51   table.insert(data, {
 | 
| 
bsw/jbe@1309
 | 
    52     label = _"Verified by account",
 | 
| 
bsw/jbe@1309
 | 
    53     value = verification.verifying_member_id
 | 
| 
bsw/jbe@1309
 | 
    54   })
 | 
| 
bsw/jbe@1309
 | 
    55 end
 | 
| 
bsw/jbe@1309
 | 
    56 
 | 
| 
bsw/jbe@1309
 | 
    57 if verification.comment then
 | 
| 
bsw/jbe@1309
 | 
    58   table.insert(data, {
 | 
| 
bsw/jbe@1309
 | 
    59     label = _"Comment",
 | 
| 
bsw/jbe@1309
 | 
    60     value = verification.comment
 | 
| 
bsw/jbe@1309
 | 
    61   })
 | 
| 
bsw/jbe@1309
 | 
    62 end
 | 
| 
bsw/jbe@1309
 | 
    63 
 | 
| 
bsw/jbe@1309
 | 
    64 if verification.verified_member_id then
 | 
| 
bsw/jbe@1309
 | 
    65   table.insert(data, {
 | 
| 
bsw/jbe@1309
 | 
    66     label = _"Used by account",
 | 
| 
bsw/jbe@1309
 | 
    67     value = verification.veried_member_id
 | 
| 
bsw/jbe@1309
 | 
    68   })
 | 
| 
bsw/jbe@1309
 | 
    69 end
 | 
| 
bsw/jbe@1309
 | 
    70 
 | 
| 
bsw/jbe@1309
 | 
    71 ui.container{ attr = { class = "mdl-cell mdl-cell--12-col" }, content = function()
 | 
| 
bsw/jbe@1309
 | 
    72   ui.list{
 | 
| 
bsw/jbe@1309
 | 
    73     attr = { class = "mdl-data-table mdl-js-data-table mdl-shadow--2dp" },
 | 
| 
bsw/jbe@1309
 | 
    74     records = data,
 | 
| 
bsw/jbe@1309
 | 
    75     columns = {
 | 
| 
bsw/jbe@1309
 | 
    76       {
 | 
| 
bsw/jbe@1309
 | 
    77         label_attr = { class = "mdl-data-table__cell--non-numeric" },
 | 
| 
bsw/jbe@1309
 | 
    78         field_attr = { class = "mdl-data-table__cell--non-numeric" },
 | 
| 
bsw/jbe@1309
 | 
    79         label = _"Field",
 | 
| 
bsw/jbe@1309
 | 
    80         content = function(record)
 | 
| 
bsw/jbe@1309
 | 
    81           ui.tag{ content = record.label }
 | 
| 
bsw/jbe@1309
 | 
    82         end
 | 
| 
bsw/jbe@1309
 | 
    83       },
 | 
| 
bsw/jbe@1309
 | 
    84       {
 | 
| 
bsw/jbe@1309
 | 
    85         label_attr = { class = "mdl-data-table__cell--non-numeric" },
 | 
| 
bsw/jbe@1309
 | 
    86         field_attr = { class = "mdl-data-table__cell--non-numeric" },
 | 
| 
bsw/jbe@1309
 | 
    87         label = _"Value",
 | 
| 
bsw/jbe@1309
 | 
    88         content = function(record)
 | 
| 
bsw/jbe@1309
 | 
    89           ui.tag{ content = record.value }
 | 
| 
bsw/jbe@1309
 | 
    90         end
 | 
| 
bsw/jbe@1309
 | 
    91       },
 | 
| 
bsw/jbe@1309
 | 
    92     }
 | 
| 
bsw/jbe@1309
 | 
    93   }
 | 
| 
bsw/jbe@1309
 | 
    94 end }
 | 
| 
bsw/jbe@1309
 | 
    95 
 | 
| 
bsw/jbe@1309
 | 
    96 if not verification.verification_data and not verification.denied then
 | 
| 
bsw/jbe@1309
 | 
    97   ui.form{
 | 
| 
bsw/jbe@1309
 | 
    98     module = "admin", action = "verification_update", id = verification.id,
 | 
| 
bsw/jbe@1309
 | 
    99     record = verification,
 | 
| 
bsw/jbe@1309
 | 
   100     content = function()
 | 
| 
bsw/jbe@1309
 | 
   101       ui.field.text{ 
 | 
| 
bsw/jbe@1309
 | 
   102         container_attr = { class = "mdl-textfield mdl-js-textfield mdl-textfield--floating-label" },
 | 
| 
bsw/jbe@1309
 | 
   103         attr = { id = "lf-verification_data", class = "mdl-textfield__input" },
 | 
| 
bsw/jbe@1309
 | 
   104         label = _"Verification data",
 | 
| 
bsw/jbe@1309
 | 
   105         name = "verification_data"
 | 
| 
bsw/jbe@1309
 | 
   106       }
 | 
| 
bsw/jbe@1309
 | 
   107       slot.put("<br /><br />")
 | 
| 
bsw/jbe@1309
 | 
   108       ui.tag{
 | 
| 
bsw/jbe@1309
 | 
   109         tag = "input",
 | 
| 
bsw/jbe@1309
 | 
   110         attr = {
 | 
| 
bsw/jbe@1309
 | 
   111           type = "submit",
 | 
| 
bsw/jbe@1309
 | 
   112           class = "mdl-button mdl-js-button mdl-button--raised mdl-button--colored",
 | 
| 
bsw/jbe@1309
 | 
   113           value = _"Verify account"
 | 
| 
bsw/jbe@1309
 | 
   114         }
 | 
| 
bsw/jbe@1309
 | 
   115       }
 | 
| 
bsw/jbe@1309
 | 
   116       slot.put("   ")
 | 
| 
bsw/jbe@1309
 | 
   117       ui.tag{
 | 
| 
bsw/jbe@1309
 | 
   118         tag = "input",
 | 
| 
bsw/jbe@1309
 | 
   119         attr = {
 | 
| 
bsw/jbe@1309
 | 
   120           type = "submit",
 | 
| 
bsw/jbe@1309
 | 
   121           name = "deny",
 | 
| 
bsw/jbe@1309
 | 
   122           class = "mdl-button mdl-js-button mdl-button--raised mdl-button--accent",
 | 
| 
bsw/jbe@1309
 | 
   123           value = _"Deny request"
 | 
| 
bsw/jbe@1309
 | 
   124         }
 | 
| 
bsw/jbe@1309
 | 
   125       }
 | 
| 
bsw/jbe@1309
 | 
   126       slot.put("   ")
 | 
| 
bsw/jbe@1309
 | 
   127       ui.link{ 
 | 
| 
bsw/jbe@1309
 | 
   128         attr = { class = "mdl-button mdl-js-button mdl-button--raised" },
 | 
| 
bsw/jbe@1309
 | 
   129         content = _"Cancel", 
 | 
| 
bsw/jbe@1309
 | 
   130         module = "admin", view = "verification_list"
 | 
| 
bsw/jbe@1309
 | 
   131       }
 | 
| 
bsw/jbe@1309
 | 
   132     end
 | 
| 
bsw/jbe@1309
 | 
   133   }
 | 
| 
bsw/jbe@1309
 | 
   134 end
 |