Fixed bug #2675: Follow up to 9503ff20ce
- Linking auth provider account from profile fails.
This commit is contained in:
parent
ec8b7b5be1
commit
0cdc3ffb7b
2 changed files with 13 additions and 3 deletions
|
@ -2,6 +2,7 @@ class Index extends App.ControllerSubContent
|
|||
requiredPermission: 'user_preferences.linked_accounts'
|
||||
header: 'Linked Accounts'
|
||||
events:
|
||||
'click .js-add': 'add'
|
||||
'click .js-remove': 'remove'
|
||||
|
||||
constructor: ->
|
||||
|
@ -20,6 +21,11 @@ class Index extends App.ControllerSubContent
|
|||
auth_providers: auth_providers
|
||||
)
|
||||
|
||||
add: (e) =>
|
||||
e.preventDefault()
|
||||
key = $(e.target).data('key')
|
||||
@el.find(".js-addForm-#{key}").submit()
|
||||
|
||||
remove: (e) =>
|
||||
e.preventDefault()
|
||||
provider = $(e.target).data('provider')
|
||||
|
|
|
@ -7,8 +7,12 @@
|
|||
<ul>
|
||||
<% for key, provider of @auth_providers: %>
|
||||
<li> <%- @T( provider.name ) %>
|
||||
<% if !@user['accounts'] || !@user['accounts'][key]: %><a href="<%= provider.url %>">
|
||||
<%- @T('Add') %></a>
|
||||
<% if !@user['accounts'] || !@user['accounts'][key]: %>
|
||||
<form method="post" class="hidden js-addForm-<%= key %>" action="<%= provider.url %>">
|
||||
<input type="hidden" name="authenticity_token" value="<%= Spine.Ajax.defaults.headers['X-CSRF-Token'] %>">
|
||||
</form>
|
||||
|
||||
<a href="#" data-key="<%= key %>" class="js-add"><%- @T('Add') %></a>
|
||||
<% else: %>
|
||||
"<%= @user['accounts'][key]['username'] %>" <a href="#" data-uid="<%= @user['accounts'][key]['uid'] %>" data-provider="<%= key %>" class="js-remove"><%- @T('remove') %></a>
|
||||
<% end %>
|
||||
|
|
Loading…
Reference in a new issue