diff options
| author | Bobby <[email protected]> | 2025-12-22 14:44:37 +0530 |
|---|---|---|
| committer | Bobby <[email protected]> | 2025-12-22 14:44:37 +0530 |
| commit | 318360a60aa52cf91ac80d547285f4d14c2c4517 (patch) | |
| tree | b5261424716c4ecbe4085dfe914e99223a1a610d /controllers/auth.go | |
| parent | 32ee8047eba06c9f1c7575b66fc0f9195657ac04 (diff) | |
| download | lain-318360a60aa52cf91ac80d547285f4d14c2c4517.tar.xz lain-318360a60aa52cf91ac80d547285f4d14c2c4517.zip | |
imap client, flash messages, imap login verification
Diffstat (limited to 'controllers/auth.go')
| -rw-r--r-- | controllers/auth.go | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/controllers/auth.go b/controllers/auth.go index 3351058..f945d8d 100644 --- a/controllers/auth.go +++ b/controllers/auth.go @@ -6,6 +6,7 @@ import ( "lain/session" "lain/types" "lain/utils/crypto" + "lain/utils/email" "lain/utils/meta" "lain/utils/shortcuts" @@ -26,6 +27,14 @@ func Login(context *fiber.Ctx) error { return BadRequest(context, err) } + imapClient, err := email.ConnectIMAP(formData.Email, formData.Password) + if err != nil { + return shortcuts.RedirectWithFlash(context, "auth.login", fiber.Map{ + "Error": "Invalid email or password.", + }) + } + imapClient.Close() + encryptedPassword, err := crypto.Encrypt(formData.Password) if err != nil { return InternalServerError(context, err) |
