Display the OAuth association only in "account" page.

Improved the template to show only when pertinent.
This commit is contained in:
2015-07-16 15:49:14 +02:00
parent 3c0122d98f
commit 769c14caf8
3 changed files with 18 additions and 16 deletions

View File

@@ -1,12 +1,11 @@
<hr>
{unless isempty="$oauth_associated"}
<h4>Un-Associate Account with Oauth Consumer</h4>
<div>
{foreach item="consumer" from="$oauth_associated"}
<div>
<form method="post" action="{$site_url/}account/oauth-un-associate">
<div>
<input type="hidden" name="consumer" value="{$consumer/}"/>
</div>
<input type="hidden" name="consumer" value="{$consumer/}"/>
<div>
<button type="submit">Unlink {$consumer/}</button>
</div>
@@ -14,14 +13,14 @@
</div>
{/foreach}
</div>
{/unless}
{unless isempty="$oauth_not_associated"}
<h4>Associate Account with Oauth Consumer</h4>
<div>
{foreach item="consumer" from="$oauth_not_associated"}
<div>
<form method="post" action="{$site_url/}account/oauth-associate">
<div>
<input type="hidden" name="consumer" value="{$consumer/}"/>
</div>
<input type="hidden" name="consumer" value="{$consumer/}"/>
<div>
<input type="email" id="email" name="email" value="{$email/}" required/>
<button type="submit">Link with {$consumer/}</button>
@@ -29,4 +28,5 @@
</form>
</div>
{/foreach}
</div>
</div>
{/unless}

View File

@@ -266,10 +266,12 @@ feature -- Hooks
a_response.location.starts_with ("account/roc-oauth-login")
then
get_block_view_login (a_block_id, a_response)
elseif a_block_id.is_case_insensitive_equal_general ("account") then
elseif a_block_id.is_case_insensitive_equal_general ("account") and then
a_response.location.same_string ("account")
then
if
attached template_block ("account_info", a_response) as l_tpl_block and then
attached current_user (a_response.request) as l_user
attached a_response.user as l_user
then
associate_account (l_user, a_response.values)
a_response.add_block (l_tpl_block, "content")

View File

@@ -1,12 +1,11 @@
<hr>
{unless isempty="$oauth_associated"}
<h4>Un-Associate Account with Oauth Consumer</h4>
<div>
{foreach item="consumer" from="$oauth_associated"}
<div>
<form method="post" action="{$site_url/}account/oauth-un-associate">
<div>
<input type="hidden" name="consumer" value="{$consumer/}"/>
</div>
<input type="hidden" name="consumer" value="{$consumer/}"/>
<div>
<button type="submit">Unlink {$consumer/}</button>
</div>
@@ -14,14 +13,14 @@
</div>
{/foreach}
</div>
{/unless}
{unless isempty="$oauth_not_associated"}
<h4>Associate Account with Oauth Consumer</h4>
<div>
{foreach item="consumer" from="$oauth_not_associated"}
<div>
<form method="post" action="{$site_url/}account/oauth-associate">
<div>
<input type="hidden" name="consumer" value="{$consumer/}"/>
</div>
<input type="hidden" name="consumer" value="{$consumer/}"/>
<div>
<input type="email" id="email" name="email" value="{$email/}" required/>
<button type="submit">Link with {$consumer/}</button>
@@ -29,4 +28,5 @@
</form>
</div>
{/foreach}
</div>
</div>
{/unless}