smpallen99 / coherence_demo Goto Github PK
View Code? Open in Web Editor NEWA coherence demo project
A coherence demo project
When I click on Sign Out link, it doesn't sign out the user. The Sign Out link points to "http://localhost:4008/users#"
Kind regards.
I keep seeing this error when I try to create a new user. I tried setting up my mailer configuration in config/config.exs, config/dev.exs, and config/prod.exs, but none of that seems to be working.
Throws a lot of warning: variable "xxx" does not exist and is being expanded to "xxx()", please use parentheses to remove the ambiguity or change the variable name
. Many deprecation warnings, also this:
Unchecked dependencies for environment dev:
* coherence (../coherence)
the dependency is not available
** (Mix) Can't continue due to errors on dependencies
and this:
warning: the Behaviour module is deprecated. Instead of using this module, use the @callback and @macrocallback module attributes.
In the end I can't run it because of:
== Compilation error on file web/views/coherence/confirmation_view.ex ==
** (CompileError) web/templates/coherence/confirmation/new.html.eex:5: undefined function confirmation_path/2
(stdlib) lists.erl:1338: :lists.foreach/2
(stdlib) erl_eval.erl:670: :erl_eval.do_apply/6
(elixir) lib/kernel/parallel_compiler.ex:117: anonymous fn/4 in Kernel.ParallelCompiler.
$ mix ecto.setup
warning: found quoted keyword "test" but the quotes are not required. Note that keywords are always atoms, even when quoted. Similar to atoms, keywords made exclusively of Unicode letters, numbers, underscore, and @ do not require quotes
mix.exs:59
Compiling 38 files (.ex)
warning: found quoted keyword "method" but the quotes are not required. Note that keywords are always atoms, even when quoted. Similar to atoms, keywords made exclusively of Unicode letters, numbers, underscore, and @ do not require quotes
lib/coherence_demo_web/templates/user/show.html.eex:19
warning: found quoted keyword "method" but the quotes are not required. Note that keywords are always atoms, even when quoted. Similar to atoms, keywords made exclusively of Unicode letters, numbers, underscore, and @ do not require quotes
lib/coherence_demo_web/templates/user/show.html.eex:31
Generated coherence_demo app
11:11:06.707 [error] GenServer #PID<0.470.0> terminating
** (CaseClauseError) no case clause matching: [11, 7, 7, 19, 10, 1]
(postgrex) lib/postgrex/utils.ex:69: Postgrex.Utils.parse_version/1
(postgrex) lib/postgrex/protocol.ex:641: Postgrex.Protocol.bootstrap_send/6
(postgrex) lib/postgrex/protocol.ex:475: Postgrex.Protocol.handshake/2
(db_connection) lib/db_connection/connection.ex:134: DBConnection.Connection.connect/2
(connection) lib/connection.ex:622: Connection.enter_connect/5
(stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
Last message: nil
State: Postgrex.Protocol
** (Mix) The database for CoherenceDemo.Repo couldn't be created: an exception was raised:
** (CaseClauseError) no case clause matching: [11, 7, 7, 19, 10, 1]
(postgrex) lib/postgrex/utils.ex:69: Postgrex.Utils.parse_version/1
(postgrex) lib/postgrex/protocol.ex:641: Postgrex.Protocol.bootstrap_send/6
(postgrex) lib/postgrex/protocol.ex:475: Postgrex.Protocol.handshake/2
(db_connection) lib/db_connection/connection.ex:134: DBConnection.Connection.connect/2
(connection) lib/connection.ex:622: Connection.enter_connect/5
(stdlib) proc_lib.erl:249: :proc_lib.init_p_do_apply/3
silverdr@shanghai:~/sources/coherence_demo$
elixir 1.9.1, phoenix 1.4.14
Some tests for PostController
and UserController
are failing with the following message and stacktrace:
1) test shows chosen resource (CoherenceDemo.PostControllerTest)
test/controllers/post_controller_test.exs:42
** (RuntimeError) expected response with status 200, got: 302, with body:
<html><body>You are being <a href="/">redirected</a>.</body></html>
stacktrace:
(phoenix) lib/phoenix/test/conn_test.ex:362: Phoenix.ConnTest.response/2
(phoenix) lib/phoenix/test/conn_test.ex:376: Phoenix.ConnTest.html_response/2
test/controllers/post_controller_test.exs:45: (test)
Following stricly the required step, i face this
== Compilation error on file lib/mix/tasks/coherence.install.ex ==
** (CompileError) lib/mix/tasks/coherence.install.ex:743: unhandled operator ->
(stdlib) lists.erl:1353: :lists.mapfoldl/3
(stdlib) lists.erl:1354: :lists.mapfoldl/3
(elixir) src/elixir_with.erl:30: :elixir_with.expand/3
On your Canada branch, I've changed the name of the app to "AuthServer" / auth_server. That's literally my only change. Now I'm receiving this error when attempting to login:
[info] POST /sessions [debug] Processing by Coherence.SessionController.create/2 Parameters: %{"_csrf_token" => "DRIHfSYZNyMcLAgCBygULBwZKlgJAAAAzbp5n/DKWNpIiDFmWHNwLw==", "_utf8" => "✓", "session" => %{"email" => "[email protected]", "password" => "[FILTERED]"}} Pipelines: [:public] [debug] QUERY OK source="users" db=2.4ms decode=0.1ms SELECT u0."id", u0."name", u0."email", u0."admin", u0."password_hash", u0."reset_password_token", u0."reset_password_sent_at", u0."remember_created_at", u0."sign_in_count", u0."current_sign_in_at", u0."last_sign_in_at", u0."current_sign_in_ip", u0."last_sign_in_ip", u0."failed_attempts", u0."locked_at", u0."unlock_token", u0."confirmation_token", u0."confirmed_at", u0."confirmation_sent_at", u0."inserted_at", u0."updated_at" FROM "users" AS u0 WHERE (u0."email" = $1) ["[email protected]"] [debug] QUERY OK db=0.1ms begin [] [debug] QUERY OK db=1.6ms UPDATE "users" SET "current_sign_in_at" = $1, "last_sign_in_at" = $2, "sign_in_count" = $3, "updated_at" = $4 WHERE "id" = $5 [{{2016, 10, 10}, {19, 8, 34, 0}}, {{2016, 10, 10}, {19, 4, 5, 0}}, 3, {{2016, 10, 10}, {19, 8, 34, 282400}}, 3] [debug] QUERY OK db=1.9ms commit [] [info] Sent 500 in 299ms [error] #PID<0.911.0> running AuthServer.Endpoint terminated Server: localhost:4008 (http) Request: POST /sessions ** (exit) an exception was raised: ** (UndefinedFunctionError) function Coherence.Redirects.session_create/2 is undefined (module Coherence.Redirects is not available) Coherence.Redirects.session_create(%Plug.Conn{adapter: {Plug.Adapters.Cowboy.Conn, :...}, assigns: %{current_user: nil}, before_send: [#Function<0.7834419/1 in Plug.CSRFProtection.call/2>, #Function<4.80593978/1 in Phoenix.Controller.fetch_flash/2>, #Function<0.82590416/1 in Plug.Session.before_send/2>, #Function<1.112419646/1 in Plug.Logger.call/2>, #Function<0.78287744/1 in Phoenix.LiveReloader.before_send_inject_reloader/1>], body_params: %{"_csrf_token" => "DRIHfSYZNyMcLAgCBygULBwZKlgJAAAAzbp5n/DKWNpIiDFmWHNwLw==", "_utf8" => "✓", "session" => %{"email" => "[email protected]", "password" => "secret"}}, cookies: %{"_auth_server_key" => "SFMyNTY.g3QAAAACbQAAAAtfY3NyZl90b2tlbm0AAAAYd3B3SEg2c2hLYnhLbmxSQUtRZC9Fdz09bQAAAA51c2VyX3JldHVybl90b20AAAAGL3VzZXJz.-_qrER3cU4Jjlga35OoWpay_QeitvMQgdl5WSY18WxY", "_backoffice_key" => "SFMyNTY.g3QAAAABbQAAAAtfY3NyZl90b2tlbm0AAAAYZ0kreWlpTDRrekxBL1dlMmJnMzBZdz09.darQhBfODE7GmnEVNmFFvACIi8xjy1f3QADHZcXoSXQ", "_bank_web_key" => "SFMyNTY.g3QAAAACbQAAAAtfY3NyZl90b2tlbm0AAAAYdnkySlRXVnU1MUNDeFRrckFnRzQxQT09bQAAAAtjdXN0b21lcl9pZGEB.5GdmOfKCGnwuUmLM7GBdf_DVKJzPQcHAaKdDWB4Tu-c", "_coherence_demo_key" => "g3QAAAADbQAAAAtfY3NyZl90b2tlbm0AAAAYR00zeDA2aDBwOHVwVUdjNlpxVFB4Zz09bQAAAAxzZXNzaW9uX2F1dGhkAANuaWxtAAAADnVzZXJfcmV0dXJuX3RvZAADbmls##Gpv624qLqozdbWKAfUbwqmaO1iQ=", "_ga" => "GA1.1.970664530.1472236137", "_mkto_trk" => "id:627-RVJ-941&token:_mch-localhost-1472236136730-48129", "_phoenix_roles_key" => "SFMyNTY.g3QAAAADbQAAAAtfY3NyZl90b2tlbm0AAAAYckNSbzFLaHA0Uzc5cnlkMnR3WGJJQT09bQAAAAxzZXNzaW9uX2F1dGhtAAAAJDUwN2I1OTQ2LThmMDQtMTFlNi05NjhkLWE0NWU2MGU0OTQ1NW0AAAAOdXNlcl9yZXR1cm5fdG9kAANuaWw.9VfPZCX5MvdkztuZfbtB8XGbKqmnP_HIlVwXA4-uK7U", "_px_web_key" => "SFMyNTY.g3QAAAABbQAAAAtfY3NyZl90b2tlbm0AAAAYNkhrRi9VbkZlalJqdUFoZ3FlNDhBZz09.Iaj2LWynCAMw5Q2X6T605tHnPRE3OwaHfgY7Vk7aFzI", "ajs_anonymous_id" => "%22556326e6-e985-4b44-a9b0-6848291650e0%22", "ajs_group_id" => "null", "ajs_user_id" => "null", "hblid" => "aseSmjkmFrTrx5lb5F7L7VQyWEM03R3C", "olfsk" => "olfsk889605459843219"}, halted: false, host: "localhost", method: "POST", owner: #PID<0.911.0>, params: %{"_csrf_token" => "DRIHfSYZNyMcLAgCBygULBwZKlgJAAAAzbp5n/DKWNpIiDFmWHNwLw==", "_utf8" => "✓", "session" => %{"email" => "[email protected]", "password" => "secret"}}, path_info: ["sessions"], peer: {{127, 0, 0, 1}, 60963}, port: 4008, private: %{AuthServer.Router => {[], %{}}, :phoenix_action => :create, :phoenix_controller => Coherence.SessionController, :phoenix_endpoint => AuthServer.Endpoint, :phoenix_flash => %{"notice" => "Signed in successfully."}, :phoenix_format => "html", :phoenix_layout => {Coherence.LayoutView, "app.html"}, :phoenix_pipelines => [:public], :phoenix_route => #Function<30.37515105/1 in AuthServer.Router.match_route/4>, :phoenix_router => AuthServer.Router, :phoenix_view => Coherence.SessionView, :plug_session => %{"_csrf_token" => "wpwHH6shKbxKnlRAKQd/Ew==", "session_auth" => "f0c72944-8f1c-11e6-86f3-a45e60e49455", "user_return_to" => "/users"}, :plug_session_fetch => :done, :plug_session_info => :write}, query_params: %{}, query_string: "", remote_ip: {127, 0, 0, 1}, req_cookies: %{"_auth_server_key" => "SFMyNTY.g3QAAAACbQAAAAtfY3NyZl90b2tlbm0AAAAYd3B3SEg2c2hLYnhLbmxSQUtRZC9Fdz09bQAAAA51c2VyX3JldHVybl90b20AAAAGL3VzZXJz.-_qrER3cU4Jjlga35OoWpay_QeitvMQgdl5WSY18WxY", "_backoffice_key" => "SFMyNTY.g3QAAAABbQAAAAtfY3NyZl90b2tlbm0AAAAYZ0kreWlpTDRrekxBL1dlMmJnMzBZdz09.darQhBfODE7GmnEVNmFFvACIi8xjy1f3QADHZcXoSXQ", "_bank_web_key" => "SFMyNTY.g3QAAAACbQAAAAtfY3NyZl90b2tlbm0AAAAYdnkySlRXVnU1MUNDeFRrckFnRzQxQT09bQAAAAtjdXN0b21lcl9pZGEB.5GdmOfKCGnwuUmLM7GBdf_DVKJzPQcHAaKdDWB4Tu-c", "_coherence_demo_key" => "g3QAAAADbQAAAAtfY3NyZl90b2tlbm0AAAAYR00zeDA2aDBwOHVwVUdjNlpxVFB4Zz09bQAAAAxzZXNzaW9uX2F1dGhkAANuaWxtAAAADnVzZXJfcmV0dXJuX3RvZAADbmls##Gpv624qLqozdbWKAfUbwqmaO1iQ=", "_ga" => "GA1.1.970664530.1472236137", "_mkto_trk" => "id:627-RVJ-941&token:_mch-localhost-1472236136730-48129", "_phoenix_roles_key" => "SFMyNTY.g3QAAAADbQAAAAtfY3NyZl90b2tlbm0AAAAYckNSbzFLaHA0Uzc5cnlkMnR3WGJJQT09bQAAAAxzZXNzaW9uX2F1dGhtAAAAJDUwN2I1OTQ2LThmMDQtMTFlNi05NjhkLWE0NWU2MGU0OTQ1NW0AAAAOdXNlcl9yZXR1cm5fdG9kAANuaWw.9VfPZCX5MvdkztuZfbtB8XGbKqmnP_HIlVwXA4-uK7U", "_px_web_key" => "SFMyNTY.g3QAAAABbQAAAAtfY3NyZl90b2tlbm0AAAAYNkhrRi9VbkZlalJqdUFoZ3FlNDhBZz09.Iaj2LWynCAMw5Q2X6T605tHnPRE3OwaHfgY7Vk7aFzI", "ajs_anonymous_id" => "%22556326e6-e985-4b44-a9b0-6848291650e0%22", "ajs_group_id" => "null", "ajs_user_id" => "null", "hblid" => "aseSmjkmFrTrx5lb5F7L7VQyWEM03R3C", "olfsk" => "olfsk889605459843219"}, req_headers: [{"host", "localhost:4008"}, {"connection", "keep-alive"}, {"content-length", "162"}, {"cache-control", "max-age=0"}, {"origin", "http://localhost:4008"}, {"upgrade-insecure-requests", "1"}, {"user-agent", "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_12_0) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/53.0.2785.143 Safari/537.36"}, {"content-type", "application/x-www-form-urlencoded"}, {"accept", "text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"}, {"referer", "http://localhost:4008/sessions"}, {"accept-encoding", "gzip, deflate"}, {"accept-language", "en-US,en;q=0.8"}, {"cookie", "ajs_anonymous_id=%22556326e6-e985-4b44-a9b0-6848291650e0%22; ajs_user_id=null; ajs_group_id=null; _mkto_trk=id:627-RVJ-941&token:_mch-localhost-1472236136730-48129; _ga=GA1.1.970664530.1472236137; olfsk=olfsk889605459843219; hblid=aseSmjkmFrTrx5lb5F7L7VQyWEM03R3C; _backoffice_key=SFMyNTY.g3QAAAABbQAAAAtfY3NyZl90b2tlbm0AAAAYZ0kreWlpTDRrekxBL1dlMmJnMzBZdz09.darQhBfODE7GmnEVNmFFvACIi8xjy1f3QADHZcXoSXQ; _bank_web_key=SFMyNTY.g3QAAAACbQAAAAtfY3NyZl90b2tlbm0AAAAYdnkySlRXVnU1MUNDeFRrckFnRzQxQT09bQAAAAtjdXN0b21lcl9pZGEB.5GdmOfKCGnwuUmLM7GBdf_DVKJzPQcHAaKdDWB4Tu-c; _px_web_key=SFMyNTY.g3QAAAABbQAAAAtfY3NyZl90b2tlbm0AAAAYNkhrRi9VbkZlalJqdUFoZ3FlNDhBZz09.Iaj2LWynCAMw5Q2X6T605tHnPRE3OwaHfgY7Vk7aFzI; _phoenix_roles_key=SFMyNTY.g3QAAAADbQAAAAtfY3NyZl90b2tlbm0AAAAYckNSbzFLaHA0Uzc5cnlkMnR3WGJJQT09bQAAAAxzZXNzaW9uX2F1dGhtAAAAJDUwN2I1OTQ2LThmMDQtMTFlNi05NjhkLWE0NWU2MGU0OTQ1NW0AAAAOdXNlcl9yZXR1cm5fdG9kAANuaWw.9VfPZCX5MvdkztuZfbtB8XGbKqmnP_HIlVwXA4-uK7U; _coherence_demo_key=g3QAAAADbQAAAAtfY3NyZl90b2tlbm0AAAAYR00zeDA2aDBwOHVwVUdjNlpxVFB4Zz09bQAAAAxzZXNzaW9uX2F1dGhkAANuaWxtAAAADnVzZXJfcmV0dXJuX3RvZAADbmls##Gpv624qLqozdbWKAfUbwqmaO1iQ=; _auth_server_key=SFMyNTY.g3QAAAACbQAAAAtfY3NyZl90b2tlbm0AAAAYd3B3SEg2c2hLYnhLbmxSQUtRZC9Fdz09bQAAAA51c2VyX3JldHVybl90b20AAAAGL3VzZXJz.-_qrER3cU4Jjlga35OoWpay_QeitvMQgdl5WSY18WxY"}], request_path: "/sessions", resp_body: nil, resp_cookies: %{}, resp_headers: [{"cache-control", "max-age=0, private, must-revalidate"}, {"x-request-id", "eqs6149j66ruitf321hu9q90sk8g448p"}, {"x-frame-options", "SAMEORIGIN"}, {"x-xss-protection", "1; mode=block"}, {"x-content-type-options", "nosniff"}], scheme: :http, script_name: [], secret_key_base: "fTFYZEpE/kju9exPqROgdfG70aYEQz/qAKJ/SowNcfkiBf9etSamqKe3X8bp7Q9C", state: :unset, status: nil}, %{"_csrf_token" => "DRIHfSYZNyMcLAgCBygULBwZKlgJAAAAzbp5n/DKWNpIiDFmWHNwLw==", "_utf8" => "✓", "session" => %{"email" => "[email protected]", "password" => "secret"}}) (coherence) web/controllers/session_controller.ex:1: Coherence.SessionController.action/2 (coherence) web/controllers/session_controller.ex:1: Coherence.SessionController.phoenix_controller_pipeline/2 (auth_server) lib/auth_server/endpoint.ex:1: AuthServer.Endpoint.instrument/4 (auth_server) lib/phoenix/router.ex:261: AuthServer.Router.dispatch/2 (auth_server) web/router.ex:1: AuthServer.Router.do_call/2 (auth_server) lib/auth_server/endpoint.ex:1: AuthServer.Endpoint.phoenix_pipeline/1 (auth_server) lib/plug/debugger.ex:123: AuthServer.Endpoint."call (overridable 3)"/2 (auth_server) lib/auth_server/endpoint.ex:1: AuthServ (truncated) [info] GET /users [info] Sent 200 in 472µs [info] GET /passwords/new [debug] Processing by Coherence.PasswordController.new/2 Parameters: %{} Pipelines: [:public] [info] Sent 200 in 3ms [info] POST /passwords [debug] Processing by Coherence.PasswordController.create/2 Parameters: %{"_csrf_token" => "ThYZIQd8Fy9kCz8qFzpnMnIDNlUXAAAA9fniOJdG/iGayV5s9RRzRw==", "_utf8" => "✓", "password" => "[FILTERED]"} Pipelines: [:public] [debug] QUERY OK source="users" db=2.1ms SELECT u0."id", u0."name", u0."email", u0."admin", u0."password_hash", u0."reset_password_token", u0."reset_password_sent_at", u0."remember_created_at", u0."sign_in_count", u0."current_sign_in_at", u0."last_sign_in_at", u0."current_sign_in_ip", u0."last_sign_in_ip", u0."failed_attempts", u0."locked_at", u0."unlock_token", u0."confirmation_token", u0."confirmed_at", u0."confirmation_sent_at", u0."inserted_at", u0."updated_at" FROM "users" AS u0 WHERE (u0."email" = $1) ["[email protected]"] [info] Sent 200 in 3ms
I have trouble with adding login functionality to my test cases.
It would be great to have example of testing controllers that requires authorization with coherence project
Since Phoenix 1.4 is now out, and a couple of dependencies have changed their internal structure (like plug_cowboy
) I think this repository might need some love. ❤️
The coherence module creation is having a problem. It is not correctly naming the defmodule in accordance to the package in which it is created in.
For example if my project name is called Test, the CoherenceView full file name should be created in the package views/coherence/coherence_view
and the code should contain
defmodule Test.Coherence.CoherenceView do
use Test.Coherence.Web, :view
end
However, when the code is generated, it only contains
defmodule Coherence.CoherenceView do1
use Test.Coherence.Web, :view
end
This is causing a compilation error. All the files that are created by the Coherence are missing the project name. I had to manually add them for the compilation to work
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.