diff options
author | Alex Auvolat <alex@adnab.me> | 2018-10-12 15:52:42 +0200 |
---|---|---|
committer | Alex Auvolat <alex@adnab.me> | 2018-10-12 15:52:42 +0200 |
commit | 0d358f6f699a5ce04ffe1bccf4f375b5f321391c (patch) | |
tree | b90a1093b3ac0cd1e7d3643abb34e87078b6072e /shardweb/lib/controllers/identity_controller.ex | |
parent | 1e91dc596fd2f7fdd96b7fd2fc50724f93e46529 (diff) | |
download | shard-0d358f6f699a5ce04ffe1bccf4f375b5f321391c.tar.gz shard-0d358f6f699a5ce04ffe1bccf4f375b5f321391c.zip |
Private chat interface
Diffstat (limited to 'shardweb/lib/controllers/identity_controller.ex')
-rw-r--r-- | shardweb/lib/controllers/identity_controller.ex | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/shardweb/lib/controllers/identity_controller.ex b/shardweb/lib/controllers/identity_controller.ex index fdaefd0..3c04fe8 100644 --- a/shardweb/lib/controllers/identity_controller.ex +++ b/shardweb/lib/controllers/identity_controller.ex @@ -9,12 +9,16 @@ defmodule ShardWeb.IdentityController do render conn, "self.html" end + def view(conn, %{"pk" => pk}) do + #TODO + end + def update(conn, params) do pid = SApp.Identity.find_proc(conn.assigns.pk) info = GenServer.call(pid, :get_info) info = %{info | nick: params["nick"]} GenServer.call(pid, {:set_info, info}) - redirect conn, to: identity_path(conn, :view) + redirect conn, to: identity_path(conn, :self) end def switch(conn, params) do @@ -23,22 +27,22 @@ defmodule ShardWeb.IdentityController do if Shard.Keys.have_sk? pk do conn |> put_session(:pk, pk) - |> redirect(to: identity_path(conn, :view)) + |> redirect(to: identity_path(conn, :self)) else conn |> put_flash(:error, "No secret key found") - |> render("view.html") + |> render("self.html") end _ -> conn |> put_flash(:error, "Bad argument") - |> render("view.html") + |> render("self.html") end end def create(conn, _params) do pk = Shard.Keys.new_identity conn = put_session(conn, :pk, pk) - redirect conn, to: identity_path(conn, :view) + redirect conn, to: identity_path(conn, :self) end end |