1
0
mirror of https://github.com/muety/wakapi.git synced 2023-08-10 21:12:56 +03:00

feat: password resets (resolve #133)

This commit is contained in:
Ferdinand Mütsch
2021-04-05 22:57:57 +02:00
parent e6e134678a
commit 6ad33e3c3b
17 changed files with 335 additions and 19 deletions

23
services/mail/mail.go Normal file
View File

@ -0,0 +1,23 @@
package mail
import (
"github.com/emvi/logbuch"
conf "github.com/muety/wakapi/config"
"github.com/muety/wakapi/models"
"github.com/muety/wakapi/services"
)
func NewMailService() services.IMailService {
config := conf.Get()
if config.Mail.Provider == conf.MailProviderMailWhale {
return NewMailWhaleService(config.Mail.MailWhale)
}
return &NoopMailService{}
}
type NoopMailService struct{}
func (n NoopMailService) SendPasswordResetMail(recipient *models.User, resetLink string) error {
logbuch.Info("noop mail service doing nothing instead of sending password reset mail to %s", recipient.ID)
return nil
}