mirror of
https://github.com/casdoor/casdoor.git
synced 2025-05-23 02:35:49 +08:00
fix: init default captcha provider (#810)
* feat: init built in provider * Update built-in provider in application * Delete unnecessary judge * Update init.go Co-authored-by: Gucheng <85475922+nomeguy@users.noreply.github.com>
This commit is contained in:
parent
376bac15dc
commit
460a4d4969
@ -23,6 +23,7 @@ import (
|
||||
func InitDb() {
|
||||
existed := initBuiltInOrganization()
|
||||
if !existed {
|
||||
initBuiltInProvider()
|
||||
initBuiltInUser()
|
||||
initBuiltInApplication()
|
||||
initBuiltInCert()
|
||||
@ -127,7 +128,9 @@ func initBuiltInApplication() {
|
||||
Cert: "cert-built-in",
|
||||
EnablePassword: true,
|
||||
EnableSignUp: true,
|
||||
Providers: []*ProviderItem{},
|
||||
Providers: []*ProviderItem{
|
||||
{Name: "provider_captcha_default", CanSignUp: false, CanSignIn: false, CanUnlink: false, Prompted: false, AlertType: "None", Provider: nil},
|
||||
},
|
||||
SignupItems: []*SignupItem{
|
||||
{Name: "ID", Visible: false, Required: true, Prompted: false, Rule: "Random"},
|
||||
{Name: "Username", Visible: true, Required: true, Prompted: false, Rule: "None"},
|
||||
@ -201,3 +204,20 @@ func initBuiltInLdap() {
|
||||
}
|
||||
AddLdap(ldap)
|
||||
}
|
||||
|
||||
func initBuiltInProvider() {
|
||||
provider := GetProvider("admin/provider_captcha_default")
|
||||
if provider != nil {
|
||||
return
|
||||
}
|
||||
|
||||
provider = &Provider{
|
||||
Owner: "admin",
|
||||
Name: "provider_captcha_default",
|
||||
CreatedTime: util.GetCurrentTime(),
|
||||
DisplayName: "Captcha Default",
|
||||
Category: "Captcha",
|
||||
Type: "Default",
|
||||
}
|
||||
AddProvider(provider)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user