mirror of
https://github.com/hrfee/jfa-go.git
synced 2024-12-22 09:00:10 +00:00
referrals: enable for new users from profile
This commit is contained in:
parent
468b2f3284
commit
0b830e9b5e
13
api-users.go
13
api-users.go
@ -304,6 +304,12 @@ func (app *appContext) newUser(req newUserDTO, confirmed bool) (f errorFunc, suc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
id := user.ID
|
id := user.ID
|
||||||
|
|
||||||
|
emailStore := EmailAddress{
|
||||||
|
Addr: req.Email,
|
||||||
|
Contact: (req.Email != ""),
|
||||||
|
}
|
||||||
|
|
||||||
var profile Profile
|
var profile Profile
|
||||||
if invite.Profile != "" {
|
if invite.Profile != "" {
|
||||||
app.debug.Printf("Applying settings from profile \"%s\"", invite.Profile)
|
app.debug.Printf("Applying settings from profile \"%s\"", invite.Profile)
|
||||||
@ -325,10 +331,15 @@ func (app *appContext) newUser(req newUserDTO, confirmed bool) (f errorFunc, suc
|
|||||||
if !((status == 200 || status == 204) && err == nil) {
|
if !((status == 200 || status == 204) && err == nil) {
|
||||||
app.err.Printf("%s: Failed to set configuration template (%d): %v", req.Code, status, err)
|
app.err.Printf("%s: Failed to set configuration template (%d): %v", req.Code, status, err)
|
||||||
}
|
}
|
||||||
|
if app.config.Section("user_page").Key("enabled").MustBool(false) && app.config.Section("user_page").Key("referrals").MustBool(false) && profile.ReferralTemplateKey != "" {
|
||||||
|
emailStore.ReferralTemplateKey = profile.ReferralTemplateKey
|
||||||
|
// Store here, just incase email are disabled (whether this is even possible, i don't know)
|
||||||
|
app.storage.SetEmailsKey(id, emailStore)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// if app.config.Section("password_resets").Key("enabled").MustBool(false) {
|
// if app.config.Section("password_resets").Key("enabled").MustBool(false) {
|
||||||
if req.Email != "" {
|
if req.Email != "" {
|
||||||
app.storage.SetEmailsKey(id, EmailAddress{Addr: req.Email, Contact: true})
|
app.storage.SetEmailsKey(id, emailStore)
|
||||||
}
|
}
|
||||||
expiry := time.Time{}
|
expiry := time.Time{}
|
||||||
if invite.UserExpiry {
|
if invite.UserExpiry {
|
||||||
|
Loading…
Reference in New Issue
Block a user