mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-02 11:20:18 +08:00
Fix get null object bug.
This commit is contained in:
@ -183,8 +183,8 @@ func (c *ApiController) Login() {
|
|||||||
resp = c.HandleLoggedIn(application, user, &form)
|
resp = c.HandleLoggedIn(application, user, &form)
|
||||||
}
|
}
|
||||||
} else if form.Provider != "" {
|
} else if form.Provider != "" {
|
||||||
organization := object.GetOrganization(fmt.Sprintf("%s/%s", "admin", form.Organization))
|
|
||||||
application := object.GetApplication(fmt.Sprintf("admin/%s", form.Application))
|
application := object.GetApplication(fmt.Sprintf("admin/%s", form.Application))
|
||||||
|
organization := object.GetOrganization(fmt.Sprintf("%s/%s", "admin", application.Organization))
|
||||||
provider := object.GetProvider(fmt.Sprintf("admin/%s", form.Provider))
|
provider := object.GetProvider(fmt.Sprintf("admin/%s", form.Provider))
|
||||||
providerItem := application.GetProviderItem(provider.Name)
|
providerItem := application.GetProviderItem(provider.Name)
|
||||||
|
|
||||||
|
@ -83,6 +83,10 @@ func extendApplicationWithOrg(application *Application) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func getApplication(owner string, name string) *Application {
|
func getApplication(owner string, name string) *Application {
|
||||||
|
if owner == "" || name == "" {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
application := Application{Owner: owner, Name: name}
|
application := Application{Owner: owner, Name: name}
|
||||||
existed, err := adapter.Engine.Get(&application)
|
existed, err := adapter.Engine.Get(&application)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -44,6 +44,10 @@ func GetOrganizations(owner string) []*Organization {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func getOrganization(owner string, name string) *Organization {
|
func getOrganization(owner string, name string) *Organization {
|
||||||
|
if owner == "" || name == "" {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
organization := Organization{Owner: owner, Name: name}
|
organization := Organization{Owner: owner, Name: name}
|
||||||
existed, err := adapter.Engine.Get(&organization)
|
existed, err := adapter.Engine.Get(&organization)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -67,6 +67,10 @@ func GetProviders(owner string) []*Provider {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func getProvider(owner string, name string) *Provider {
|
func getProvider(owner string, name string) *Provider {
|
||||||
|
if owner == "" || name == "" {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
provider := Provider{Owner: owner, Name: name}
|
provider := Provider{Owner: owner, Name: name}
|
||||||
existed, err := adapter.Engine.Get(&provider)
|
existed, err := adapter.Engine.Get(&provider)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -60,6 +60,10 @@ func GetTokens(owner string) []*Token {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func getToken(owner string, name string) *Token {
|
func getToken(owner string, name string) *Token {
|
||||||
|
if owner == "" || name == "" {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
token := Token{Owner: owner, Name: name}
|
token := Token{Owner: owner, Name: name}
|
||||||
existed, err := adapter.Engine.Get(&token)
|
existed, err := adapter.Engine.Get(&token)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -78,6 +78,10 @@ func GetUsers(owner string) []*User {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func getUser(owner string, name string) *User {
|
func getUser(owner string, name string) *User {
|
||||||
|
if owner == "" || name == "" {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
user := User{Owner: owner, Name: name}
|
user := User{Owner: owner, Name: name}
|
||||||
existed, err := adapter.Engine.Get(&user)
|
existed, err := adapter.Engine.Get(&user)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -234,6 +234,17 @@ class LoginPage extends React.Component {
|
|||||||
style={{width: "250px"}}
|
style={{width: "250px"}}
|
||||||
size="large"
|
size="large"
|
||||||
>
|
>
|
||||||
|
<Form.Item
|
||||||
|
style={{height: 0, visibility: "hidden"}}
|
||||||
|
name="application"
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: true,
|
||||||
|
message: 'Please input your application!',
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
</Form.Item>
|
||||||
<Form.Item
|
<Form.Item
|
||||||
style={{height: 0, visibility: "hidden"}}
|
style={{height: 0, visibility: "hidden"}}
|
||||||
name="organization"
|
name="organization"
|
||||||
|
Reference in New Issue
Block a user