equal
deleted
inserted
replaced
99 end |
99 end |
100 local salt = generate_uuid(); |
100 local salt = generate_uuid(); |
101 local valid, stored_key, server_key = getAuthenticationDatabaseSHA1(password, salt, default_iteration_count); |
101 local valid, stored_key, server_key = getAuthenticationDatabaseSHA1(password, salt, default_iteration_count); |
102 local stored_key_hex = to_hex(stored_key); |
102 local stored_key_hex = to_hex(stored_key); |
103 local server_key_hex = to_hex(server_key); |
103 local server_key_hex = to_hex(server_key); |
104 return accounts:set(username, {stored_key = stored_key_hex, server_key = server_key_hex, salt = salt, iteration_count = default_iteration_count}); |
104 return accounts:set(username, { |
|
105 stored_key = stored_key_hex, server_key = server_key_hex, |
|
106 salt = salt, iteration_count = default_iteration_count |
|
107 }); |
105 end |
108 end |
106 |
109 |
107 function provider.delete_user(username) |
110 function provider.delete_user(username) |
108 return accounts:set(username, nil); |
111 return accounts:set(username, nil); |
109 end |
112 end |
120 usermanager.set_password(username, credentials.password, host); |
123 usermanager.set_password(username, credentials.password, host); |
121 credentials = accounts:get(username); |
124 credentials = accounts:get(username); |
122 if not credentials then return; end |
125 if not credentials then return; end |
123 end |
126 end |
124 |
127 |
125 local stored_key, server_key, iteration_count, salt = credentials.stored_key, credentials.server_key, credentials.iteration_count, credentials.salt; |
128 local stored_key, server_key = credentials.stored_key, credentials.server_key; |
|
129 local iteration_count, salt = credentials.iteration_count, credentials.salt; |
126 stored_key = stored_key and from_hex(stored_key); |
130 stored_key = stored_key and from_hex(stored_key); |
127 server_key = server_key and from_hex(server_key); |
131 server_key = server_key and from_hex(server_key); |
128 return stored_key, server_key, iteration_count, salt, true; |
132 return stored_key, server_key, iteration_count, salt, true; |
129 end |
133 end |
130 }; |
134 }; |