I'm new to Erlang and N2O but have some experience in python web development. I want to create authentication by email address (email - password) in my application instead of using AVZ. I've created Sign Up page with this code (other code is as n2o_sample). But instead of putting user to kvs
I have {error, no_container}
-module(signup_page).
-compile(export_all).
-include_lib("n2o/include/wf.hrl").
-include_lib("n2o_sample/include/users.hrl").
title() -> [ <<"Sign Up Page">> ].
main() -> #dtl{file = "login", app = n2o_sample,
bindings = [{title,title()},{body,body()}]}.
body() ->
[ #span{id=display}, #br{},
#span{body="Email: "}, #textbox{id=user}, #br{},
#span{body="Password: "}, #password{id=pass}, #br{},
#span{body="Confirm Password"}, #password{id=confirm}, #br{},
#button{id=signup, body="Sign Up",
postback=signup,source=[user,pass,confirm]}].
event(signup) ->
User = wf:q(user), Password = wf:q(pass), Confirm = wf:q(confirm),
U = kvs:get(user, User, undefined),
case U of
{ok, undefined} ->
case Password of
undefined -> wf:update(display, <<"No pass">>);
Confirm -> Status = kvs:put(#user{id=User}),
% -> {error, no_container}
io:format("~w~n", [Status]);
B -> io:format("~w~n", [B]) end;
A -> io:format("~w~n", [A]),
wf:update(display, <<"Already registered!">>) end;
event(_) -> [].