Commit Graph
100 Commits
Author SHA1 Message Date
max 6d6aff50b3 Only show logout (now CSRF protected) if user is authenticated, include relevant authentication logic in GET controllers (this should be moved to middleware) 2024-02-14 13:20:35 -06:00
max a6be73765a Add GET verb to static handler 2024-02-14 13:16:52 -06:00
max ddc9e51831 Fix boolean column migration example 2024-02-14 13:16:15 -06:00
max dc450e26dd Move logout to POST route and controller with CSRF middleware. Add CsrfToken to home for logout 2024-02-12 14:46:26 -06:00
max de4a217c5f Update extended crypto library 2024-02-09 14:47:29 -06:00
max c4e83d06b9 Bump go version to 1.22 2024-02-09 14:21:45 -06:00
max 51da24be9b Small formatting fix 2024-02-09 13:44:21 -06:00
Maximilian e497f4d2f0 Ignore fields that are zero value 2024-01-20 16:32:07 -06:00
Maximilian b30af86e58 Prebuild templates (base.html + content) at startup to avoid a file parse every page load 2023-12-22 21:03:15 -06:00
Maximilian 3ffd548623 Fix ordering for html attributes 2023-12-21 00:14:28 -06:00
Maximilian cb4f10e0b4 Better alignment for memory 2023-12-19 16:41:31 -06:00
Maximilian 878ce01b29 Get the sha256 hash of password before passing to bcrypt to avoid character limit 2023-12-19 16:06:00 -06:00
Maximilian c82cdb4f13 Use best naming practices 2023-12-18 23:04:31 -06:00
Maximilian ce81c36e9f Update x/crypto 2023-12-18 23:01:19 -06:00
Maximilian ab1b82c680 Update x/crypto 2023-10-10 21:37:54 -05:00
Maximilian d8b1a5c999 Remove unnecessary comparison 2023-09-26 11:32:39 -05:00
Maximilian 0f59a6eba9 Go mod tidy and update x/crypto 2023-09-17 19:23:57 -05:00
Maximilian bb69c16cdf Update How to use section 2023-09-03 16:18:48 -05:00
Maximilian e87f14bcbf Make all slog errors uniform (lowercase) 2023-09-03 15:56:35 -05:00
Maximilian ed712a5344 Clean up error handling, migrate to log/slog, add todo for flash message system in post controller 2023-09-03 15:45:12 -05:00
Maximilian ee4c9f9199 Clean up error handling, begin migration to log/slog 2023-08-17 21:13:17 -05:00
Maximilian 1d400efa19 Update x/crypto and Go version 2023-08-12 14:30:12 -05:00
Maximilian b36cbf4b9e Comment cleanup 2023-08-12 14:28:21 -05:00
Maximilian fa3165d317 Use proper error comparison 2023-08-03 12:13:37 -05:00
Maximilian 7cb36db3c2 Handle errors 2023-08-03 12:13:15 -05:00
Maximilian eda5344685 Fix spelling 2023-08-03 12:11:01 -05:00
Maximilian 9670b7d717 Better naming of functions and files, delete less than helpful comments 2023-08-03 12:09:40 -05:00
Maximilian a1438f4fe2 Update README.md 2023-07-31 20:18:11 -05:00
Maximilian 052fa689c7 Merge branch 'middleware' 2023-07-31 18:41:49 -05:00
Maximilian f1fad7e4e3 Pass in handler to middleware, create definition for MiddlewareFunc 2023-07-31 18:37:54 -05:00
Maximilian b475da66da Fix nil error for GET requests 2023-07-26 13:09:01 -05:00
Maximilian d0085ab2c3 Update crypto dependency 2023-07-25 15:36:25 -05:00
Maximilian 58514f4c5f Update client to handle GET (no body) requests, multipart requests, and JSON requests 2023-07-25 15:34:11 -05:00
Maximilian 606f5df45a Refactor name 2023-07-22 23:37:38 -05:00
Maximilian 2a32a1b3ce Add restclient package, and a simple function to send HTTP requests 2023-07-21 16:35:18 -05:00
Maximilian eb36156c52 Change function name to ProcessGroup 2023-07-21 16:26:43 -05:00
Maximilian bada24884a Use ungrouped CSRF middleware on register and login POST routes 2023-07-21 11:59:55 -05:00
Maximilian 05397c2b61 Initial middleware implementation for CSRF and update comment 2023-07-21 11:59:01 -05:00
Maximilian 3d80b95f55 Initial wrapper implementation 2023-07-07 18:05:17 -05:00
Maximilian 6da7d408f9 Add .gitattributes to force LF line endings 2023-05-05 12:19:17 -05:00
max e993bcf317 Update dependency versions 2023-05-04 09:00:35 -05:00
Maximilian 9b231a73d6 Update README.md 2023-04-07 21:32:39 -05:00
Maximilian 34acd0fa8d Remove old session query 2023-04-07 21:27:14 -05:00
Maximilian 71d3bd77d0 Add ability to get session given an AuthToken, fix GetCurrentUser() 2023-04-07 21:23:46 -05:00
Maximilian 1451abcca4 Formatting 2023-04-06 12:01:29 -05:00
max 53a780343f Fix scheduler by adding a wait group 2023-04-06 09:55:56 -05:00
max 8e4c5e3268 Fix wrong query for clearing 6-hour old sessions 2023-04-06 09:35:53 -05:00
max f18f512fea Properly set the name of the checkbox for parsing 2023-04-06 09:31:12 -05:00
max 58328fe505 Fix some SQL errors 2023-04-06 09:30:53 -05:00
max 10e7830349 Remember me checkbox on login form 2023-04-06 08:57:17 -05:00
max 5f7e674d32 Add remember me functionality, handle both types of sessions appropriately 2023-04-06 08:56:48 -05:00
max ec9c1a8fb5 Initial clear old sessions implementation 2023-04-04 14:37:36 -05:00
max 242029f2e5 Initial task scheduler implementation 2023-04-04 14:37:23 -05:00
Maximilian b1c65f2ab1 Remove erroneous SetCookie (leftover from redundant remove) 2023-03-27 15:05:11 -05:00
max 965139ea18 Remove redundant session cookie clear 2023-03-16 08:40:50 -05:00
Maximilian cf8aea5115 Update README.md 2023-03-06 21:34:12 -06:00
Maximilian c510646c84 Make username text placeholder instead of value 2023-03-06 21:27:05 -06:00
Maximilian a4366c7395 Add more to .gitignore 2023-03-06 21:23:56 -06:00
Maximilian 073dfafb28 Change log message 2023-03-06 21:10:09 -06:00
Maximilian 3fa5cf46d2 Update experimental crypto library 2023-03-06 21:08:56 -06:00
Maximilian bd8b015f44 Update README.md 2023-03-06 21:02:41 -06:00
Maximilian 5a1cd77676 Update README.md 2023-03-06 13:10:50 -06:00
Maximilian 012906eee2 Update README.md 2023-03-06 13:00:11 -06:00
Maximilian 2a705483d9 Add README.md 2023-03-06 12:58:58 -06:00
Maximilian be2c3ae178 Add default theme and apply to pages 2023-03-06 12:44:20 -06:00
Maximilian f32223f12c Fix static file handling for the embedded filesystem 2023-03-06 12:43:54 -06:00
Maximilian eff740072d Decouple SQL queries from logic 2023-03-05 15:46:43 -06:00
Maximilian 75d8996cf9 Fix some queries, comments, and error logging 2023-02-28 15:02:21 -06:00
Maximilian ac2b5262fd Remove print 2023-02-28 14:57:15 -06:00
Maximilian b9ac6fbd5f Add session migration 2023-02-28 14:55:09 -06:00
Maximilian baa8eb2b93 Move to a session based system for AuthTokens 2023-02-28 14:54:55 -06:00
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