fleet/server/mail/users.go
Gabriel Hernandez 6555d8def4
Feat UI windows automatic enrollment (#12988)
relates to #12606

Implementation of the Windows automatic enrollment Fleet UI pages. This
includes implementation of card for windows automatic enrollment, the
setup page for windows automatic enrollment, and terms and conditions
page for windows (This is currently still being worked on as our current
solution is not working).

**windows mdm auto enrollment card**


![image](https://github.com/fleetdm/fleet/assets/1153709/d4dc1813-dc28-4a63-bacd-cb7e43e18170)

**windows auto enrollment setup page**


![image](https://github.com/fleetdm/fleet/assets/1153709/92da4b05-0d5d-4404-867f-6d315957bdc3)

- [x] Changes file added for user-visible changes in `changes/` or
`orbit/changes/`.
See [Changes
files](https://fleetdm.com/docs/contributing/committing-changes#changes-files)
for more information.
- [x] Manual QA for all new/changed functionality

---------

Co-authored-by: Marcos Oviedo <marcos@fleetdm.com>
2023-08-08 15:57:55 +01:00

50 lines
1007 B
Go

package mail
import (
"bytes"
"html/template"
"github.com/fleetdm/fleet/v4/server"
)
type ChangeEmailMailer struct {
BaseURL template.URL
AssetURL template.URL
Token string
}
func (cem *ChangeEmailMailer) Message() ([]byte, error) {
t, err := server.GetTemplate("server/mail/templates/change_email_confirmation.html", "email_template")
if err != nil {
return nil, err
}
var msg bytes.Buffer
err = t.Execute(&msg, cem)
if err != nil {
return nil, err
}
return msg.Bytes(), nil
}
type PasswordResetMailer struct {
// Base URL to use for Fleet endpoints
BaseURL template.URL
// URL for loading image assets
AssetURL template.URL
// Token password reset token
Token string
}
func (r PasswordResetMailer) Message() ([]byte, error) {
t, err := server.GetTemplate("server/mail/templates/password_reset.html", "email_template")
if err != nil {
return nil, err
}
var msg bytes.Buffer
if err = t.Execute(&msg, r); err != nil {
return nil, err
}
return msg.Bytes(), nil
}