chore (plg_authentication_simple): banner update

This commit is contained in:
MickaelK 2024-12-06 07:21:41 +11:00
parent b317a50609
commit e35158c259
2 changed files with 29 additions and 5 deletions

View file

@ -12,16 +12,17 @@ import (
type SimpleAuth struct{}
func (this SimpleAuth) Setup() Form {
n := 0
a := 0
nUsers := 0
aUsers := 0
if users, err := getUsers(); err == nil {
n = len(users)
nUsers = len(users)
for i := range users {
if users[i].Disabled == false {
a += 1
aUsers += 1
}
}
}
return Form{
Elmnts: []FormElement{
{
@ -33,7 +34,11 @@ STATS:
TOTAL USERS ACTIVE USERS
| %.4d | %.4d
</pre>`, n, a),
MANAGEMENT GUI: <a href="/admin/simple-user-management">/admin/simple-user-management</a>
EMAIL SERVER : %t
</pre>`, nUsers, aUsers, isEmailSetup()),
},
{
Name: "type",

View file

@ -10,6 +10,25 @@ import (
"gopkg.in/gomail.v2"
)
func isEmailSetup() bool {
if Config.Get("email.from").String() == "" {
return false
}
if Config.Get("email.server").String() == "" {
return false
}
if Config.Get("email.port").Int() == 0 {
return false
}
if Config.Get("email.username").String() == "" {
return false
}
if Config.Get("email.password").String() == "" {
return false
}
return true
}
func sendInvitateMail(user User) error {
cfg, err := getPluginData()
if err != nil {