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:
parent
bb41bc3844
commit
71922212d9
16
api-users.go
16
api-users.go
@ -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
|
||||||
}
|
}
|
||||||
@ -240,10 +240,12 @@ func (app *appContext) NewUserFromInvite(gc *gin.Context) {
|
|||||||
|
|
||||||
if (emailEnabled && req.Email != "") || invite.UserLabel != "" || referralsEnabled {
|
if (emailEnabled && req.Email != "") || invite.UserLabel != "" || referralsEnabled {
|
||||||
emailStore := EmailAddress{
|
emailStore := EmailAddress{
|
||||||
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)
|
||||||
|
Loading…
Reference in New Issue
Block a user