mirror of
https://github.com/hrfee/jfa-go.git
synced 2024-12-22 17:10:10 +00:00
Admin: auto enable contact when an email is added
"Contact through email" is now automatically enabled when adding an email address to an account without one on the admin page. Solves #233.
This commit is contained in:
parent
2722e8482d
commit
5d289ce023
@ -326,7 +326,7 @@ func (app *appContext) TelegramAddUser(gc *gin.Context) {
|
|||||||
// @Success 200 {object} boolResponse
|
// @Success 200 {object} boolResponse
|
||||||
// @Success 400 {object} boolResponse
|
// @Success 400 {object} boolResponse
|
||||||
// @Success 500 {object} boolResponse
|
// @Success 500 {object} boolResponse
|
||||||
// @Router /users/telegram/notify [post]
|
// @Router /users/contact [post]
|
||||||
// @Security Bearer
|
// @Security Bearer
|
||||||
// @tags Other
|
// @tags Other
|
||||||
func (app *appContext) SetContactMethods(gc *gin.Context) {
|
func (app *appContext) SetContactMethods(gc *gin.Context) {
|
||||||
|
@ -1023,9 +1023,16 @@ func (app *appContext) ModifyEmails(gc *gin.Context) {
|
|||||||
id := jfUser.ID
|
id := jfUser.ID
|
||||||
if address, ok := req[id]; ok {
|
if address, ok := req[id]; ok {
|
||||||
var emailStore = EmailAddress{}
|
var emailStore = EmailAddress{}
|
||||||
if oldEmail, ok := app.storage.emails[id]; ok {
|
oldEmail, ok := app.storage.emails[id]
|
||||||
|
if ok {
|
||||||
emailStore = oldEmail
|
emailStore = oldEmail
|
||||||
}
|
}
|
||||||
|
// Auto enable contact by email for newly added addresses
|
||||||
|
if !ok || oldEmail.Addr == "" {
|
||||||
|
emailStore.Contact = true
|
||||||
|
app.storage.storeEmails()
|
||||||
|
}
|
||||||
|
|
||||||
emailStore.Addr = address
|
emailStore.Addr = address
|
||||||
app.storage.emails[id] = emailStore
|
app.storage.emails[id] = emailStore
|
||||||
if ombiEnabled {
|
if ombiEnabled {
|
||||||
|
Loading…
Reference in New Issue
Block a user