You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
defmoduleRealworldWeb.RouterdouseRealworldWeb,:routerimportRealworldWeb.UserAuthpipeline:browserdoplug:accepts,["html"]plug:fetch_sessionplug:fetch_live_flashplug:put_root_layout,html: {RealworldWeb.Layouts,:root}plug:protect_from_forgeryplug:put_secure_browser_headersplug:fetch_current_userendpipeline:apidoplug:accepts,["json"]endscope"/",RealworldWebdopipe_through:browserlive"/",ArticleLive.Index,:indexlive"/articles/:id",ArticleLive.Show,:showend# Other scopes may use custom stacks.# scope "/api", RealworldWeb do# pipe_through :api# end# Enable LiveDashboard and Swoosh mailbox preview in developmentifApplication.compile_env(:realworld,:dev_routes)do# If you want to use the LiveDashboard in production, you should put# it behind authentication and allow only admins to access it.# If your application does not have an admins-only section yet,# you can use Plug.BasicAuth to set up some basic authentication# as long as you are also using SSL (which you should anyway).importPhoenix.LiveDashboard.Routerscope"/dev"dopipe_through:browserlive_dashboard"/dashboard",metrics: RealworldWeb.Telemetryforward"/mailbox",Plug.Swoosh.MailboxPreviewendend## Authentication routesscope"/",RealworldWebdopipe_through[:browser,:redirect_if_user_is_authenticated]live_session:redirect_if_user_is_authenticated,on_mount: [{RealworldWeb.UserAuth,:redirect_if_user_is_authenticated}]dolive"/users/register",UserRegistrationLive,:newlive"/users/log_in",UserLoginLive,:newlive"/users/reset_password",UserForgotPasswordLive,:newlive"/users/reset_password/:token",UserResetPasswordLive,:editendpost"/users/log_in",UserSessionController,:createendscope"/",RealworldWebdopipe_through[:browser,:require_authenticated_user]live_session:require_authenticated_user,on_mount: [{RealworldWeb.UserAuth,:ensure_authenticated}]dolive"/users/settings",UserSettingsLive,:editlive"/users/settings/confirm_email/:token",UserSettingsLive,:confirm_emaillive"/articles/new",ArticleLive.Index,:newlive"/articles/:id/edit",ArticleLive.Index,:editlive"/articles/:id/show/edit",ArticleLive.Show,:editendendscope"/",RealworldWebdopipe_through[:browser]delete"/users/log_out",UserSessionController,:deletelive_session:current_user,on_mount: [{RealworldWeb.UserAuth,:mount_current_user}]dolive"/users/confirm/:token",UserConfirmationLive,:editlive"/users/confirm",UserConfirmationInstructionsLive,:newendendend
live view does not redirect me when I click "edit" on the article new link and when I try to access current_user I get nil
Expected behavior
I would expect live view to redirect me, as the default setup suggests it should do, if I place these routes in require_authenticated_user
The text was updated successfully, but these errors were encountered:
Environment
Actual behavior
running:
router.ex
live view does not redirect me when I click "edit" on the article
new
link and when I try to accesscurrent_user
I getnil
Expected behavior
I would expect live view to redirect me, as the default setup suggests it should do, if I place these routes in
require_authenticated_user
The text was updated successfully, but these errors were encountered: