{$_reload = true} {* Webasyst ID (WA) auth types: backend/invite/bind *} {$_auth_type = $result.type|default:''} {* Webasyst ID (WA) auth result *} {$_auth_result = $result.result|default:[]} {$_auth_result.status = $_auth_result.status|default:false} {$_auth_result.details = $_auth_result.details|default:[]} {$_auth_result.details.error_code = $_auth_result.details.error_code|default:''} {* Sytem error (exception) from WA adapter *} {$_system_error_msg = $result.error_msg|default:''} {* system error from webasyst ID auth adapter *} {* in process of primary binding (connetion) backend user with webasyst ID contact *} {$_is_bind_with_webasyst_contact = $_auth_type === 'bind'} {* process of primary binding is finished ok *} {$_is_bind_ok = $_is_bind_with_webasyst_contact && $_auth_result.status} {* in process of primary binding (or inviting user over team) end up with already_bound error *} {$_is_already_bound = ($_auth_type === 'bind' || $_auth_type === 'invite') && !$_auth_result.status && $_auth_result.details.error_code === 'already_bound'} {* in process of primary binding end up with 'not_bound' error *} {$_is_bind_fail = $_is_bind_with_webasyst_contact && !$_auth_result.status && $_auth_result.details.error_code === 'not_bound'} {* in process of auth (login) backend user somehow backend user is not connected to webasyst ID contact *} {$_backend_contact_not_bound = $_auth_type === 'backend' && !$_auth_result.status && $_auth_result.details.error_code == 'not_bound'} {* force backend - there is no standard auth (login) into backend - only webasyst ID auth *} {$_is_backend_auth_forced = $is_backend_auth_forced|default:false} {* not bound case while backend auth force *} {$_is_force_login_not_bound = $_is_backend_auth_forced && $_backend_contact_not_bound} {* redirect: url *} {$_redirect_url = ''} {if !empty($redirect.url)} {$_redirect_url = $redirect.url} {/if} {* redirect: application returns error *} {$_redirect_error_message = ''} {if !empty($redirect.error.message)} {$_redirect_error_message = $redirect.error.message} {elseif !empty($redirect.error.code)} {$_redirect_error_message = $redirect.error.code} {/if} {$_info_content_exists = false} {capture assign="_info_content"} {if !$_system_error_msg} {if $_is_bind_ok} {include file="./bind_ok.html" inline} {$_reload = false} {$_info_content_exists = true} {elseif $_is_force_login_not_bound} {include file="./force_login_not_bound.html" inline} {$_reload = false} {$_info_content_exists = true} {elseif $_is_already_bound} {include file="./bind_already_bound.html" inline} {$_reload = false} {$_info_content_exists = true} {elseif $_redirect_error_message} {include file="./redirect_error.html" inline} {$_reload = false} {$_info_content_exists = true} {/if} {else} {include file="./system_error.html" inline} {$_reload = false} {$_info_content_exists = true} {/if} {/capture} [s`Sign-in with Webasyst ID`] {if $_info_content_exists}
{$_info_content}
{/if}