Comments (12)
Pow v1.0.32 is out, let me know if it's all working now!
from pow.
I believe this error happens when you are changing the controller to use :formats
option. This is will change how Phoenix build the module name, so now it'll expect AafWeb.Pow.SessionHTML
rather than AafWeb.Pow.SessionView
.
You'll need to update the view module name to the new format, or remove the : formats
option if you wish to keep the view module naming.
Easiest approach would likely be to just run mix pow.phoenix.gen.templates
again, generating the new structure, and then move over the templates into the newly generated files.
Let me know if this solves the issue! I should probably add a 1.7 migration note regarding this.
from pow.
created a new instace with Erlang 25.3.2.4, Elixir 1.14.5-otp-25, phoenix 1.7.7
add {:pow, "~> 1.0.31"} to mix.exs
run mix pow.phoenix.gen.templates
In upgraded existing instance:
mix pow.phoenix.gen.templates
update fields with additional fields that were created
deleted registration_view.ex and session_view.ex under app_web/views/pow
deleted app_web/templates/pow directory
ran mix phx.server and getting
% mix phx.server
Compiling 2 files (.ex)
== Compilation error in file lib/aaf_web/controllers/pow/registration_html.ex ==
** (UndefinedFunctionError) function AafWeb.html/0 is undefined or private
AafWeb.html()
expanding macro: AafWeb.using/1
lib/aaf_web/controllers/pow/registration_html.ex:2: AafWeb.Pow.RegistrationHTML (module)
(elixir 1.14.5) expanding macro: Kernel.use/2
lib/aaf_web/controllers/pow/registration_html.ex:2: AafWeb.Pow.RegistrationHTML (module)
arnimikelsons@MacBook-Pro-2 aaf %
from pow.
Oh I see. Phoenix.View
has been removed as. default in Phoenix 1.7 so you'll need to update your web module plus all views to the new Phoenix 1.7 setup. This means that you need something like this in AafWeb
(phoenix diff can show all the changes):
def html do
quote do
use Phoenix.Component
# Import convenience functions from controllers
import Phoenix.Controller,
only: [get_csrf_token: 0, view_module: 1, view_template: 1]
# Include general helpers for rendering HTML
unquote(html_helpers())
end
end
defp html_helpers do
quote do
# HTML escaping functionality
import Phoenix.HTML
# Core UI components and translation
import AafWeb.CoreComponents
import AafWeb.Gettext
# Shortcut for generating JS commands
alias Phoenix.LiveView.JS
# Routes generation with the ~p sigil
unquote(verified_routes())
end
end
You can see in the above there's an expectation for AafWeb.CoreComponents
to exist.
Backwards compability with Phoenix.View
is still possible if you are not planning to move over the template components. You'll need to have phoenix_view
as a dependency for this to work. You won't need to change anything, but you must not set :formats
option for the controller in your web module.
If you do want to set that option and still keep the view module then I think you can get away with just renaming them (so it would be AafWeb.Pow.SessionHTML
instead of AafWeb.Pow.SessionView
).
Sorry for the back and fourth here. The Phoenix 1.7 upgrade does kinda work, but all these changes are significant so it means if you enable an option in Phoenix it'll have very different expectations of your project structure. I would have thought you would experience issues with your other view templates as well unless you have updated them to the new structure?
from pow.
Hi, I'm also upgrading to Phoenix 1.7 and found the same no "new" html template defined for AppWeb.Pow.SessionHTML (the module does not exist)
error.
Adding the code that @danschultzer did not fix the issue.
Are there plans to support Phoenix 1.7 and Elixir 1.15?
from pow.
I found the issue. There's was an incorrect assumption when Phoenix.View
is available. I've fixed it in #709, which will be merged and new release out later today. Thanks for the reports!
from pow.
Thanks @danschultzer - using 1.0.32 fixed the issue for me.
from pow.
@danschultzer
Unfortunately it broke my app.
Request: GET /admin/session/new
** (exit) an exception was raised:
** (ArgumentError) no "new" html template defined for MyAppWeb.Pow.SessionView (the module does not exist)
I was using MyAppWeb.Pow.SessionHTML
before and it was working.
Doesn't seem like I can pass an option to pow or anything like that to fix this.
I think
Code.ensure_loaded?(Phoenix.View)
is not good enough. Looking at my dependency graph there are some dependants.
And there's also a case for projects migrating from Views to HTML where they might want to keep part of their code with views.
There's no Phoenix.View
referenced by itself in my app(checked with grep).
from pow.
@ravensiris ugh, thanks for the report, I'll revert this change and find a better solution.
from pow.
@ravensiris this should be fixed with #712. I'll get this out later today when I have some free time, but if you want to help please test this and let me know if it works for you:
{:pow, github: "pow-auth/pow", ref: "fix-phoenix-view-namespace"}
My preliminay testing did confirm this works with both your scenario, and resolves OP issue.
from pow.
This should be fixed in v1.0.33, I couldn't reproduce any issue in any of the scenarios I've tested with in local.
from pow.
@danschultzer Thanks! It's working with v1.0.33
from pow.
Related Issues (20)
- Reset password - test fails issue HOT 1
- Upgrading to Phoenix 1.7 HOT 5
- Create account without email/password using some unique ID?
- Phoenix 1.7 compilers warning HOT 1
- Maintain case when storing emails HOT 2
- Permissions issues with mnesia backend for Pow HOT 16
- Improve mix tasks
- Crash @missing_field? in Schema.ex HOT 1
- Inject values on registration HOT 2
- users_context seems to be ignored HOT 1
- Changeset errors into view HOT 1
- POW & LiveView - best way to implement `assigns.current_user` ? HOT 7
- Elixir 1.15 deprecation warnings HOT 1
- Persistence of stale session ids in MnesiaCache HOT 10
- Phoenix 1.6 App upgraded to 1.7 warning about layout conflicts. HOT 2
- POW with MongoDB HOT 2
- `mix pow.install` throws error HOT 2
- How to migrate from `pow_mailer_layout` to `pow_mailer_layouts` HOT 1
- Extract `validate_email` and its private functions into a new library? HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from pow.