diff options
Diffstat (limited to '')
-rw-r--r-- | server/dispatcher.erl | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/server/dispatcher.erl b/server/dispatcher.erl index 86b2627..a296c78 100644 --- a/server/dispatcher.erl +++ b/server/dispatcher.erl @@ -8,18 +8,18 @@ init() -> dict:new(). handle(_, {register, {User, Password}}, Dict) -> - case dict:find(User) of - {ok, _} -> + case dict:find(User, Dict) of + {ok, _}-> {{error, duplicated_user}, Dict}; - true -> + _ -> {{ok, user_created}, dict:store(User, Password, Dict)} end; handle(From, {login, {User, Password}}, Dict) -> - case dict:find(User) of + case dict:find(User, Dict) of {ok, Password} -> {{ok, {logged_in, client:start(From)}}, Dict}; - true -> + _ -> {{error, user_or_password_invalid}, Dict} end; |