%META:TOPICINFO{author="TWikiContributor" date="1398124906" format="1.1" version="$Rev$"}%
%META:TOPICPARENT{name="KnowdLoginPlugin"}%
---+ %PARENTBC% Knowd Device Manager

Use this form to manage your devices to automatically log in to TWiki. Conventionally, users access a TWiki site with username and password. The [[https://id.wave.com/][Wave Knowd cloud service]] manages the identity and trust score of user devices. With Knowd, users can log in to TWiki without specifying a password if the device used has a high enough trust score.
<noautolink>
%SET{ "user" value="%URLPARAM{ "user" default="%WIKINAME%" }%" }%<nop>
<span class="knowdaction">
%KNOWD{ "%URLPARAM{action}%" id="%URLPARAM{id}%" user="%GET{user}%" name="%URLPARAM{ "name" encode="quote" }%" }%
</span>
| User: | %USERREPORT{ action="slim_box_start" style="background-color: transparent;" }% %USERREPORT{ action="slim_box" user="%GET{user}%" style="margin: 1px -2px;" }% %USERREPORT{ action="slim_box_end" }% | <div id="select_user" style="display: %IF{"'%USERNAME%' ingroup 'TWikiAdminGroup'" then="block;" else="none;"}%"> <form action="%SCRIPTURL{view}%/%WEB%/%TOPIC%"> %USERREPORT{ action="select_one_user" name="user" selected="%GET{user}%" }% <input type="submit" value="Change" class="twikiButton" /> </form> </div> |||||
| | <b>Device ID:</b> | <b>Name:</b> | <b>Trust Score:</b> | <b>Registered:</b> | <b>Last Access, GMT:</b> | <b>Action:</b> |
%CALCULATE{$SET(label, Devices:)$SET(devices, %KNOWD{ "getdevices" user="%GET{user}%" }%)$SET(msg, none)$IF($LISTSIZE($GET(devices)==1, $IF($FIND(KNOWD ERROR, $GET(devices)), $SET(msg, $GET(devices))$SET(devices,))))$LISTJOIN($n, $LISTEACH(|$GET(label)$SET(label,^)| <form action="%SCRIPTURL{view}%/%WEB%/%TOPIC%" onsubmit="if( this.name.value=='' ) { alert( 'Please enter a memorable name for the device&#45; such as: Work PC' ); return false; }; return true;">$item | <div class="device_row_name_text $IF($LENGTH($GETHASH(knowd-name, $item))==0, device_not_registered)"> $GETHASH(knowd-name, $item) $IF($LENGTH($GETHASH(knowd-name, $item))==0, $NOP(%)ICON{info}$NOP(%) not registered) </div> <div class="device_row_name_input"> <input type="text" name="name" value="$GETHASH(knowd-name, $item)" class="twikiInputField" /> </div> | $IF($GETHASH(knowd-score, $item)>0, $GETHASH(knowd-score, $item), unknown) | $FORMATTIME($GETHASH(knowd-rtime, $item), $year-$mo-$day) | $FORMATTIME($GETHASH(knowd-atime, $item), $year-$mo-$day $hour:$min) | <div class="device_row_buttons"><input type="hidden" name="action" value="registerdevice" /> <input type="hidden" name="id" value="$item" /> <input type="hidden" name="user" value="%GET{user}%" /> <input type="submit" value="$IF($EXACT($GETHASH(knowd-name, $item),), Register, &nbsp;Update&nbsp;)" class="twikiButton" /> </form> $IF($EXACT($GETHASH(knowd-setupurl, $item),), , <form action="$GETHASH(knowd-setupurl, $item)"> <input type="submit" value="&nbsp;Setup&nbsp;" class="twikiButton" /> </form> )<form action="%SCRIPTURL{view}%/%WEB%/%TOPIC%"> <input type="hidden" name="action" value="deregisterdevice" /> <input type="hidden" name="id" value="$item" /> <input type="hidden" name="user" value="%GET{user}%" /> <input type="submit" value="&nbsp;Remove&nbsp;" class="twikiButton" /> </form> </div> |, $GET(devices)))$IF($EXACT($GET(label),^), , |Devices:| $GET(msg) ||||||)}%
</noautolink>
<style>
.knowdaction {
  display: inline-block;
  margin: -5px 0 8px 0;
  padding: 2px 10px;
  -moz-border-radius: 6px;
  border-radius: 6px;
}
.device_row_name_text {
  width: 250px;
}
.device_row_name_input {
  width: 250px;
  display: none;
}
.device_row_name_input input {
  width: 240px;
}
.device_row_buttons {
 visibility: hidden;
}
</style>
<script>
$(".device_row_buttons").parent().parent().hover(
  function () {
    $(this).find(".device_row_buttons").css('visibility', 'visible');
    $(this).find(".device_row_name_text").hide();
    $(this).find(".device_row_name_input").show();
  },
  function () {
    $(this).find(".device_row_buttons").css('visibility', 'hidden');
    $(this).find(".device_row_name_text").show();
    $(this).find(".device_row_name_input").hide();
  }
);
$( document ).ready(function() {
  $(".device_not_registered").parent().css('background-color', '#F7F6A3');
  var txt = $( ".knowdaction" ).text();
  if( txt.match( /^\s*KNOWD ERROR/m ) ) {
    $( ".knowdaction" ).css('background-color', '#f7bbbb');
  } else if( txt.match( /^\s*KNOWD NOTE/m ) ) {
    $( ".knowdaction" ).css('background-color', '#bdf7bb');
  }
});
</script>

__Related:__ KnowdLoginPlugin, UserToolsCategory, AdminToolsCategory
