mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-04 13:20:19 +08:00
Fix HasPromptPage() for signup items
This commit is contained in:
@ -73,6 +73,10 @@ func (application *Application) IsSignupItemRequired(itemName string) bool {
|
||||
return signupItem.Required
|
||||
}
|
||||
|
||||
func (si *SignupItem) isSignupItemPrompted() bool {
|
||||
return si.Visible && si.Prompted
|
||||
}
|
||||
|
||||
func (application *Application) GetSignupItemRule(itemName string) string {
|
||||
signupItem := application.getSignupItem(itemName)
|
||||
if signupItem == nil {
|
||||
@ -92,6 +96,16 @@ func (application *Application) getAllPromptedProviderItems() []*ProviderItem {
|
||||
return res
|
||||
}
|
||||
|
||||
func (application *Application) getAllPromptedSignupItems() []*SignupItem {
|
||||
res := []*SignupItem{}
|
||||
for _, signupItem := range application.SignupItems {
|
||||
if signupItem.isSignupItemPrompted() {
|
||||
res = append(res, signupItem)
|
||||
}
|
||||
}
|
||||
return res
|
||||
}
|
||||
|
||||
func (application *Application) isAffiliationPrompted() bool {
|
||||
signupItem := application.getSignupItem("Affiliation")
|
||||
if signupItem == nil {
|
||||
@ -107,5 +121,10 @@ func (application *Application) HasPromptPage() bool {
|
||||
return true
|
||||
}
|
||||
|
||||
signupItems := application.getAllPromptedSignupItems()
|
||||
if len(signupItems) != 0 {
|
||||
return true
|
||||
}
|
||||
|
||||
return application.isAffiliationPrompted()
|
||||
}
|
||||
|
Reference in New Issue
Block a user