0
응용 프로그램에 로그인하려면 devise omniauth를 사용하는 레일 응용 프로그램. 성공 로그인 후 , 내가 자리를 다시하고 싶은 @의 current_user.email로그인 후 부분적으로 사용자 이름이 표시됩니다.
$(function() {
$('#facebook-connect').click(function(e) {
e.preventDefault();
FB.login(function(response) {
if(response.authResponse) {
$.ajax({
type: 'POST',
url: '/users/auth/facebook/callback',
dataType: 'json',
data: {signed_request: response.authResponse.signedRequest},
success: function(data, textStatus, jqXHR) {
$('#loginout_button').html("<%= j render(:partial => 'account_info') %>");
},
}
}
, {scope: 'email'});
});
});
그리고 일부 디스플레이의 HTML 코드가있는 "로그인"버튼 :
<% if user_signed_in? %>
<p class="text-left small"><%=current_user.email%></p>
<p class="text-left">
<%= link_to destroy_user_session_path, :method => :delete do %>
<%=t('auth.logout')%>
<% end%>
을하지만, 물론 페이지에서 렌더링 된 부분이로드되어서 로그 아웃 한 사용자의 템플릿을 생성하기 때문에 작동하지 않습니다.
$('#loginout_button').html(" <li>\n <button type=\"button\" onclick=\"openLoginModal(); return false;\">Login<\/button>\n <\/li>\n");
devise @current_user 상태를 기반으로 템플릿을 생성하는 방법은 무엇입니까?
상담해주세요. – user664859