replaceMap.put(KEY_PAGE_REFRESH,
params.isEmpty() ? "" : String.format(HTML_META_REFRESH_CONTENT, servletBaseURL));
- if (!reqError.isBlank()) {
+ if (reqError != null && !reqError.isBlank()) {
logger.debug("Webex redirected with an error: {}", reqError);
replaceMap.put(KEY_ERROR, String.format(HTML_ERROR, reqError));
} else if (!reqState.isBlank()) {
map.put(ACCOUNT_SHWOMSG, "u-show");
map.put(ACCOUNT_MSG, "Configure account.");
} else if (handler.isAuthorized()) {
- map.put(ACCOUNT_USER_ID, String.format(" (Authorized user: %s)", webexUser));
+ map.put(ACCOUNT_USER_ID, String.format("Authorized user: %s", webexUser));
map.put(ACCOUNT_SHOWBTN, "u-hide");
map.put(ACCOUNT_SHWOMSG, "u-show");
map.put(ACCOUNT_MSG, "Authorized.");
- } else if (!webexUser.isBlank()) {
- map.put(ACCOUNT_USER_ID, String.format(" (Unauthorized user: %s)", webexUser));
+ } else if (webexUser.isBlank()) {
+ map.put(ACCOUNT_USER_ID, "Unauthorized user");
map.put(ACCOUNT_SHOWBTN, "u-show");
map.put(ACCOUNT_SHWOMSG, "u-hide");
map.put(ACCOUNT_MSG, "");
private @Nullable OAuthClientService authService;
- private boolean configured = false; // is the handler instance properly configured?
+ private boolean configured; // is the handler instance properly configured?
private volatile boolean active; // is the handler instance active?
String accountType = ""; // bot or person?
public void initialize() {
logger.debug("Initializing thing {}", this.getThing().getUID());
active = true;
+ this.configured = false;
config = getConfigAs(WebexTeamsConfiguration.class);
final String token = config.token;
public boolean isAuthorized() {
final AccessTokenResponse accessTokenResponse = getAccessTokenResponse();
+ if (accessTokenResponse == null) {
+ return false;
+ }
if ("person".equals(this.accountType)) {
return accessTokenResponse != null && accessTokenResponse.getAccessToken() != null
updateStatus(ThingStatus.ONLINE);
return true;
} catch (WebexTeamsException e) {
- logger.warn("Failed to refresh: {}", e.getMessage());
+ logger.warn("Failed to refresh: {}. Did you authorize?", e.getMessage());
updateStatus(ThingStatus.OFFLINE, ThingStatusDetail.COMMUNICATION_ERROR, e.getMessage());
}
return false;
<div class="row" id="${account.id}">
- <div class="one column">${account.type}:</div>
- <div class="nine columns"><i>${account.name}${account.user}</i></div>
+ <div class="three columns">${account.name}:</div>
+ <div class="seven columns"><i>${account.user} (${account.type})</i></div>
<div class="two columns ${account.showbtn}">
<div class="button-primary"><a href=${account.authorize}>Authorize Account</a></div>
</div>