Further work on web interface.
This commit is contained in:
@ -4,9 +4,13 @@
|
||||
pwd_salt,
|
||||
name,
|
||||
email,
|
||||
join_date
|
||||
join_date%,
|
||||
% ext_data % other extensible data
|
||||
}).
|
||||
|
||||
% ts_user.ext_data can be:
|
||||
% [{last_timeline, TimelineId}]
|
||||
|
||||
-record(ts_timeline, {
|
||||
ref, % {username, timelineid}
|
||||
created,% {{year, month, day}, {hour, minute, second}}
|
||||
|
@ -10,16 +10,23 @@ create_table(TableOpts) ->
|
||||
TableOpts ++ [{attributes, record_info(fields, ts_user)},
|
||||
{type, ordered_set}]).
|
||||
|
||||
% expects the password in clear
|
||||
new(UR = #ts_user{}) ->
|
||||
case mnesia:dirty_read(ts_user, UR#ts_user.username) of
|
||||
[ExistingRecord] -> {error, {record_exists, ExistingRecord}};
|
||||
[] -> mnesia:dirty_write(hash_input_record(UR))
|
||||
end.
|
||||
|
||||
update(UR = #ts_user{}) ->
|
||||
update(UR = #ts_user{}) ->
|
||||
case mnesia:dirty_read(ts_user, UR#ts_user.username) of
|
||||
[] -> no_record;
|
||||
[_Record] -> mnesia:dirty_write(hash_input_record(UR))
|
||||
[Record] ->
|
||||
UpdatedRecord = ts_common:update_record(Record, UR),
|
||||
HashedRecord = case UR#ts_user.password of
|
||||
undefined -> UpdatedRecord;
|
||||
_Password -> hash_input_record(UpdatedRecord)
|
||||
end.
|
||||
mnesia:dirty_write(HashedRecord)
|
||||
end.
|
||||
|
||||
lookup(Username) ->
|
||||
|
Reference in New Issue
Block a user