1
0

Send a notification on failed TOTP

This commit is contained in:
kolaente
2021-07-29 18:05:25 +02:00
parent 1571dfa825
commit 3572ac4b82
2 changed files with 40 additions and 1 deletions

View File

@ -110,3 +110,28 @@ func (n *ResetPasswordNotification) ToDB() interface{} {
func (n *ResetPasswordNotification) Name() string {
return ""
}
// InvalidTOTPNotification represents a InvalidTOTPNotification notification
type InvalidTOTPNotification struct {
User *User
}
// ToMail returns the mail notification for InvalidTOTPNotification
func (n *InvalidTOTPNotification) ToMail() *notifications.Mail {
return notifications.NewMail().
Subject("Someone just tried to login to your Vikunja account, but failed").
Greeting("Hi "+n.User.GetName()+",").
Line("Someone just tried to log in into your account with correct username and password but a wrong TOTP passcode.").
Line("**If this was not you, someone else knows your password. You should set a new one immediately!**").
Action("Reset your password", config.ServiceFrontendurl.GetString()+"get-password-reset")
}
// ToDB returns the InvalidTOTPNotification notification in a format which can be saved in the db
func (n *InvalidTOTPNotification) ToDB() interface{} {
return nil
}
// Name returns the name of the notification
func (n *InvalidTOTPNotification) Name() string {
return "totp.invalid"
}