bsw/jbe@1309: local verification = Verification:by_id(param.get_id())
bsw/jbe@1309:
bsw/jbe@1309: local data = {}
bsw/jbe@1309:
bsw/jbe@1309: for i, field in ipairs(config.verification.fields) do
bsw/jbe@1309: table.insert(data, {
bsw/jbe@1309: label = field.label,
bsw/jbe@1309: value = verification.request_data[field.name]
bsw/jbe@1309: })
bsw/jbe@1309: end
bsw/jbe@1309:
bsw/jbe@1309: table.insert(data, {
bsw/jbe@1309: label = _"IP address",
bsw/jbe@1309: value = verification.request_origin.ip
bsw/jbe@1309: })
bsw/jbe@1309:
bsw/jbe@1309: table.insert(data, {
bsw/jbe@1309: label = _"Hostname",
bsw/jbe@1309: value = verification.request_origin.hostname
bsw/jbe@1309: })
bsw/jbe@1309:
bsw/jbe@1309: if verification.verified then
bsw/jbe@1309: table.insert(data, {
bsw/jbe@1309: label = _"Requested at",
bsw/jbe@1309: value = format.timestamp(verification.requested)
bsw/jbe@1309: })
bsw/jbe@1309: end
bsw/jbe@1309:
bsw/jbe@1309: if verification.requesting_member_id then
bsw/jbe@1309: table.insert(data, {
bsw/jbe@1309: label = _"Requested by account",
bsw/jbe@1309: value = verification.requesting_member_id
bsw/jbe@1309: })
bsw/jbe@1309: end
bsw/jbe@1309:
bsw/jbe@1309: if verification.verified then
bsw/jbe@1309: table.insert(data, {
bsw/jbe@1309: label = _"Verified at",
bsw/jbe@1309: value = format.timestamp(verification.verified)
bsw/jbe@1309: })
bsw/jbe@1309: end
bsw/jbe@1309:
bsw/jbe@1309: if verification.denied then
bsw/jbe@1309: table.insert(data, {
bsw/jbe@1309: label = _"Denied at",
bsw/jbe@1309: value = format.timestamp(verification.denied)
bsw/jbe@1309: })
bsw/jbe@1309: end
bsw/jbe@1309:
bsw/jbe@1309: if verification.verifying_member_id then
bsw/jbe@1309: table.insert(data, {
bsw/jbe@1309: label = _"Verified by account",
bsw/jbe@1309: value = verification.verifying_member_id
bsw/jbe@1309: })
bsw/jbe@1309: end
bsw/jbe@1309:
bsw/jbe@1309: if verification.comment then
bsw/jbe@1309: table.insert(data, {
bsw/jbe@1309: label = _"Comment",
bsw/jbe@1309: value = verification.comment
bsw/jbe@1309: })
bsw/jbe@1309: end
bsw/jbe@1309:
bsw/jbe@1309: if verification.verified_member_id then
bsw/jbe@1309: table.insert(data, {
bsw/jbe@1309: label = _"Used by account",
bsw/jbe@1309: value = verification.veried_member_id
bsw/jbe@1309: })
bsw/jbe@1309: end
bsw/jbe@1309:
bsw/jbe@1309: ui.container{ attr = { class = "mdl-cell mdl-cell--12-col" }, content = function()
bsw/jbe@1309: ui.list{
bsw/jbe@1309: attr = { class = "mdl-data-table mdl-js-data-table mdl-shadow--2dp" },
bsw/jbe@1309: records = data,
bsw/jbe@1309: columns = {
bsw/jbe@1309: {
bsw/jbe@1309: label_attr = { class = "mdl-data-table__cell--non-numeric" },
bsw/jbe@1309: field_attr = { class = "mdl-data-table__cell--non-numeric" },
bsw/jbe@1309: label = _"Field",
bsw/jbe@1309: content = function(record)
bsw/jbe@1309: ui.tag{ content = record.label }
bsw/jbe@1309: end
bsw/jbe@1309: },
bsw/jbe@1309: {
bsw/jbe@1309: label_attr = { class = "mdl-data-table__cell--non-numeric" },
bsw/jbe@1309: field_attr = { class = "mdl-data-table__cell--non-numeric" },
bsw/jbe@1309: label = _"Value",
bsw/jbe@1309: content = function(record)
bsw/jbe@1309: ui.tag{ content = record.value }
bsw/jbe@1309: end
bsw/jbe@1309: },
bsw/jbe@1309: }
bsw/jbe@1309: }
bsw/jbe@1309: end }
bsw/jbe@1309:
bsw/jbe@1309: if not verification.verification_data and not verification.denied then
bsw/jbe@1309: ui.form{
bsw/jbe@1309: module = "admin", action = "verification_update", id = verification.id,
bsw/jbe@1309: record = verification,
bsw/jbe@1309: content = function()
bsw/jbe@1309: ui.field.text{
bsw/jbe@1309: container_attr = { class = "mdl-textfield mdl-js-textfield mdl-textfield--floating-label" },
bsw/jbe@1309: attr = { id = "lf-verification_data", class = "mdl-textfield__input" },
bsw/jbe@1309: label = _"Verification data",
bsw/jbe@1309: name = "verification_data"
bsw/jbe@1309: }
bsw/jbe@1309: slot.put("
")
bsw/jbe@1309: ui.tag{
bsw/jbe@1309: tag = "input",
bsw/jbe@1309: attr = {
bsw/jbe@1309: type = "submit",
bsw/jbe@1309: class = "mdl-button mdl-js-button mdl-button--raised mdl-button--colored",
bsw/jbe@1309: value = _"Verify account"
bsw/jbe@1309: }
bsw/jbe@1309: }
bsw/jbe@1309: slot.put(" ")
bsw/jbe@1309: ui.tag{
bsw/jbe@1309: tag = "input",
bsw/jbe@1309: attr = {
bsw/jbe@1309: type = "submit",
bsw/jbe@1309: name = "deny",
bsw/jbe@1309: class = "mdl-button mdl-js-button mdl-button--raised mdl-button--accent",
bsw/jbe@1309: value = _"Deny request"
bsw/jbe@1309: }
bsw/jbe@1309: }
bsw/jbe@1309: slot.put(" ")
bsw/jbe@1309: ui.link{
bsw/jbe@1309: attr = { class = "mdl-button mdl-js-button mdl-button--raised" },
bsw/jbe@1309: content = _"Cancel",
bsw/jbe@1309: module = "admin", view = "verification_list"
bsw/jbe@1309: }
bsw/jbe@1309: end
bsw/jbe@1309: }
bsw/jbe@1309: end