Skip to content

Commit

Permalink
Update README + custom state fix
Browse files Browse the repository at this point in the history
  • Loading branch information
m-2k committed Jan 26, 2017
1 parent 7e5b10e commit 3f10dd4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -133,8 +133,14 @@ Use `-include_lib("eauth/include/eauth_user.hrl").` in you project for define `#
* `eauth_user:is_alive(#user{} | any()) -> true | false` – Check for non-deleted user

By default, user (in state) stored in process state.
You can override `put(State,User) -> User` and `get(State) -> User` functions.
You can override this if want store user in custom state.
Just setup `function_state` and `function_state_user` in `sys.config` as `{Mod,Fun}`.
```erlang
function_state() -> State % get custom state
function_state(State) -> State % write custom state
function_state_user(State) -> User % get from custom state
function_state_user(State,User) -> State % write to custom state
```

## Credits

Expand Down
2 changes: 1 addition & 1 deletion src/eauth_user.erl
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ state() -> % get state
_ -> ok
end.
state(State) -> % write state
case wf:config(eauth,function_state_user) of
case wf:config(eauth,function_state) of
{M,F} -> M:F(State);
_ -> ok
end.
Expand Down

0 comments on commit 3f10dd4

Please sign in to comment.