smpallen99 / coherence

Coherence is a full featured, configurable authentication system for Phoenix
MIT License
1.27k stars 223 forks source link

Logout link doesn't appear to be working. #265

Open jonathanclarke opened 7 years ago

jonathanclarke commented 7 years ago

Have attempted two different versions of the logout link and both appear to produce the same behaviour.

<%= Project.Coherence.ViewHelpers.signout_link(@conn, "Sign out") %>

produces

<a class="" data-csrf="QlxKBwU/ZQpacSRtGT8jGFUeIUseEAAA1eeTjX3xiFrYottJ7QJ2/g==" data-method="delete" data-to="/sessions" href="#" rel="nofollow">Sign out</a>

While the approach below

<%= link "Log out", to: session_path(@conn, :delete), method: "delete" %>

produces a similar result.

<a data-csrf="QlxKBwU/ZQpacSRtGT8jGFUeIUseEAAA1eeTjX3xiFrYottJ7QJ2/g==" data-method="delete" data-to="/sessions" href="#" rel="nofollow">Log out</a>

Neither of the links allow the user to log out. My routes appear to be in order:

session_path  GET     /sessions/new     Coherence.SessionController :new
session_path  POST    /sessions         Coherence.SessionController :create
session_path  DELETE  /sessions         Coherence.SessionController :delete

I'm on coherence 0.5. I'm sure it's something silly that I've overlooked somewhere.

jonathanclarke commented 7 years ago

OK; seemed to have figured out that it was a javascript issue with a new app. Was getting a 404 on app.js

To solve it; did the following: cd assets && npm install --save babel-preset-latest && brunch build

app.js was missing out of the directory; surprising for a brand new app. Anyhow; this can be closed. Putting this here in case anyone else has this issue.

joaquinalcerro commented 6 years ago

@jonathanclarke I am currently having this issue and have tried the commands you mentioned without luck.

I am running Phoenix 1.3, Elixir 1.5.1, Coherence 0.5.

The difference is that I don't get a 404 error. In my case, when you click the link, nothing happens.

I had this same issue and saw other blog recommending to delete the node_modules folder. I did that and it worked but I tried with this project and it didn't.

Any suggestions are welcome.

Best regards.

joaquinalcerro commented 6 years ago

Just found the issue. I had a problem with my brunch-config.js and I updated it as this post: https://elixirforum.com/t/how-to-change-version-of-bootstrap/2215/5.

Best regards.

tmorton commented 6 years ago

In case anyone else has this problem:

One reason this occurs is if you've updated the phoenix_html package, but you're still using the old version of its javascript. Try deleting node_modules/phoenix_html and running npm install