1
0
mirror of https://github.com/hrfee/jfa-go.git synced 2024-12-22 09:00:10 +00:00

form: fix account creation with no profile

missing "profile != nil" check.
This commit is contained in:
Harvey Tindall 2024-10-11 11:45:18 +01:00
parent bb41bc3844
commit 71922212d9
Signed by: hrfee
GPG Key ID: BBC65952848FB1A2

View File

@ -187,7 +187,7 @@ func (app *appContext) NewUserFromInvite(gc *gin.Context) {
} else if err := app.email.send(msg, req.Email); err != nil { } else if err := app.email.send(msg, req.Email); err != nil {
app.err.Printf(lm.FailedSendConfirmationEmail, req.Code, req.Email, err) app.err.Printf(lm.FailedSendConfirmationEmail, req.Code, req.Email, err)
} else { } else {
app.err.Printf(lm.SentConfirmationEmail, req.Code, req.Email) app.debug.Printf(lm.SentConfirmationEmail, req.Code, req.Email)
} }
return return
} }
@ -243,7 +243,9 @@ func (app *appContext) NewUserFromInvite(gc *gin.Context) {
Addr: req.Email, Addr: req.Email,
Contact: (req.Email != ""), Contact: (req.Email != ""),
Label: invite.UserLabel, Label: invite.UserLabel,
ReferralTemplateKey: profile.ReferralTemplateKey, }
if profile != nil {
profile.ReferralTemplateKey = profile.ReferralTemplateKey
} }
/// Ensures at least one contact method is enabled. /// Ensures at least one contact method is enabled.
if nonEmailContactMethodEnabled { if nonEmailContactMethodEnabled {
@ -257,8 +259,6 @@ func (app *appContext) NewUserFromInvite(gc *gin.Context) {
if !settings["notify-creation"] { if !settings["notify-creation"] {
continue continue
} }
// FIXME: Forgot how "go" works, but these might get killed if not finished
// before we do?
go func(addr string) { go func(addr string) {
msg, err := app.email.constructCreated(req.Code, req.Username, req.Email, invite, app, false) msg, err := app.email.constructCreated(req.Code, req.Username, req.Email, invite, app, false)
if err != nil { if err != nil {
@ -273,7 +273,7 @@ func (app *appContext) NewUserFromInvite(gc *gin.Context) {
if err != nil { if err != nil {
app.err.Printf(lm.FailedSendCreationAdmin, req.Code, addr, err) app.err.Printf(lm.FailedSendCreationAdmin, req.Code, addr, err)
} else { } else {
app.info.Printf(lm.SentCreationAdmin, req.Code, addr) app.debug.Printf(lm.SentCreationAdmin, req.Code, addr)
} }
} }
}(address) }(address)