Commit Graph

109 Commits

Author SHA1 Message Date
Maximilian
402c514970 Add checks to skip table and column creation if they already exist 2023-02-17 19:01:59 -06:00
Maximilian
89d1b96400 Change CreatedAt and UpdatedAt to type Time and update migrations.go accordingly 2023-02-17 18:55:27 -06:00
Maximilian
2b46385126 Fix time.Time matching to timestamp postgres type (reflection just gives "Time") 2023-02-17 18:52:15 -06:00
Maximilian
0a77813360 Fix postgres type matching 2023-02-17 18:47:29 -06:00
Maximilian
f7eb852c66 Gracefully shut down server when interrupt signal is received and remove panic when creating log directory 2023-02-17 18:25:14 -06:00
Maximilian
5ae84c1995 Remove unneeded comments 2023-02-15 19:13:05 -06:00
Maximilian
3336bd0b3f Remove default condition 2023-02-15 19:10:50 -06:00
max
f2a7336283 Fix user queries and a logical error in GetCurrentUser 2023-02-14 09:43:02 -06:00
max
204971d40a AutoMigrate changed to DbAutoMigrate to match correctly 2023-02-14 08:31:13 -06:00
Maximilian
fcd6477ec3 Migration implementation, auto migrate when starting program 2023-02-13 23:41:45 -06:00
Maximilian
bbbf14bdc7 Fix example config to have AutoMigrate be a proper boolean type in JSON 2023-02-13 23:32:16 -06:00
Maximilian
eb1c2daa6a Add AuthToken to user struct, and update SQL statements to match struct fields 2023-02-13 23:30:12 -06:00
Maximilian
cb786a6a56 Prepare config option to enable auto migrations 2023-02-13 23:28:36 -06:00
Maximilian
b962bbdd88 Fix import order 2023-02-13 22:28:11 -06:00
Maximilian
a2077131a7 Update experimental crypto library 2023-02-08 19:55:10 -06:00
Maximilian
edccb95be3 Remove unnecessary assignment 2023-02-08 19:47:08 -06:00
Maximilian
9e4216301d Move models to its own package 2023-02-08 19:39:53 -06:00
Maximilian
f2f2187872 Fix issue with logging to a file. Only log by day. 2023-02-05 13:01:38 -06:00
Maximilian
112a549162 Update to go 1.20 2023-02-05 12:59:37 -06:00
Maximilian
1360f93ac3 Embed static and templates folder when compiling, RenderTemplate now renders and serves from the embedded filesystem 2023-02-05 12:46:47 -06:00
Maximilian
4f4722350f Add license 2023-01-07 22:08:25 -06:00
Maximilian
2961f132fb More uniform errors 2022-12-23 20:42:14 -06:00
Maximilian
03bab76650 Fix existing auth_token check and comment fixes 2022-12-21 21:22:11 -06:00
Maximilian
007830ab33 Log error when failing to close the config file 2022-12-14 15:23:48 -06:00
Maximilian
8c93b3746b Fix csrf token unexported error 2022-12-04 19:06:51 -06:00
Maximilian
e8e42f3724 Code cleanup 2022-12-04 18:04:24 -06:00
Maximilian
ed2d0063f0 Fix line separators (LF only now) 2022-12-04 17:55:05 -06:00
max
1eb278c4b9 Use csrf tokens and validation with login and register forms 2022-11-14 12:29:55 -06:00
max
2f631cf3ee Make token error more clear, rename cookie and form value to csrf_token 2022-11-14 12:12:06 -06:00
max
18ee7b2fac Make error message more clear 2022-11-14 12:11:10 -06:00
max
58af44bdd6 Add csrf protection functions 2022-11-14 12:03:51 -06:00
max
35f7cb7601 Make sure a duplicate session token is never stored 2022-11-06 10:50:54 -06:00
max
8f87ee1c4e Fix and add comments 2022-11-04 15:12:57 -05:00
max
2a95868d5f Log err in GetCurrentUser 2022-11-04 13:59:24 -05:00
max
bd4f9047d9 Add function to return the current user based off of the session cookie 2022-11-04 13:58:03 -05:00
Maximilian
6ddafff871 Formatting 2022-11-01 23:07:22 -05:00
Maximilian
92529640d6 Make session cookie HttpOnly and Secure 2022-11-01 17:59:18 -05:00
Maximilian
967e918df1 Properly overwrite session cookie when logging out 2022-11-01 17:31:19 -05:00
Maximilian
a6b6c259ce Proper Logout logic 2022-11-01 17:29:41 -05:00
Maximilian
2f3c12a06c Fix auth_token assignment 2022-11-01 17:28:28 -05:00
Maximilian
d68badc41c Fix password authentication 2022-11-01 17:15:19 -05:00
Maximilian
619469059c Create logs folder if it doesn't already exist 2022-11-01 16:30:54 -05:00
Maximilian
601b3d2cb0 Login function now authenticates and redirects 2022-11-01 16:14:49 -05:00
Maximilian
e6b08266ac Update dependencies 2022-11-01 15:39:30 -05:00
max
187d10ca4a Routes and show controller functions for login and logout 2022-11-01 11:23:44 -05:00
max
5a9ee796f8 Rearrange functions 2022-11-01 11:23:08 -05:00
Maximilian
200942b2a2 Set session cookie name 2022-10-22 12:23:34 -05:00
Maximilian
a590c96d0b Error handling for CreateUser query 2022-10-22 12:18:14 -05:00
max
93a1cb6049 ValidateSessionCookie() and LogoutUser() 2022-10-21 21:04:46 -05:00
max
3417622841 Pass response writer to createSessionCookie() 2022-10-21 20:17:11 -05:00