diff --git a/object/application.go b/object/application.go index 397a8abe..596cb6e9 100644 --- a/object/application.go +++ b/object/application.go @@ -24,11 +24,12 @@ type Application struct { Name string `xorm:"varchar(100) notnull pk" json:"name"` CreatedTime string `xorm:"varchar(100)" json:"createdTime"` - DisplayName string `xorm:"varchar(100)" json:"displayName"` - Logo string `xorm:"varchar(100)" json:"logo"` - Organization string `xorm:"varchar(100)" json:"organization"` - Providers []string `xorm:"varchar(100)" json:"providers"` - ProviderObjs []*Provider `xorm:"-" json:"providerObjs"` + DisplayName string `xorm:"varchar(100)" json:"displayName"` + Logo string `xorm:"varchar(100)" json:"logo"` + Organization string `xorm:"varchar(100)" json:"organization"` + EnablePassword bool `json:"enablePassword"` + Providers []string `xorm:"varchar(100)" json:"providers"` + ProviderObjs []*Provider `xorm:"-" json:"providerObjs"` } func GetApplications(owner string) []*Application { diff --git a/web/src/ApplicationEditPage.js b/web/src/ApplicationEditPage.js index f4f7e2a4..d65ebf6c 100644 --- a/web/src/ApplicationEditPage.js +++ b/web/src/ApplicationEditPage.js @@ -13,7 +13,7 @@ // limitations under the License. import React from "react"; -import {Button, Card, Col, Input, Row, Select} from 'antd'; +import {Button, Card, Col, Input, Row, Select, Switch} from 'antd'; import {LinkOutlined} from "@ant-design/icons"; import * as ApplicationBackend from "./backend/ApplicationBackend"; import * as Setting from "./Setting"; @@ -152,6 +152,16 @@ class ApplicationEditPage extends React.Component { + + + Enable Password: + + + { + {this.updateApplicationField('enablePassword', checked);})} /> + } + + Providers: diff --git a/web/src/ApplicationListPage.js b/web/src/ApplicationListPage.js index f57e6075..f95ba7de 100644 --- a/web/src/ApplicationListPage.js +++ b/web/src/ApplicationListPage.js @@ -48,6 +48,7 @@ class ApplicationListPage extends React.Component { createdTime: moment().format(), displayName: `New Application - ${this.state.applications.length}`, logo: "https://cdn.jsdelivr.net/gh/casbin/static/img/logo@2x.png", + EnablePassword: true, providers: [], } } diff --git a/web/src/Face.js b/web/src/Face.js index 74e6ba0f..b54128b8 100644 --- a/web/src/Face.js +++ b/web/src/Face.js @@ -87,6 +87,7 @@ class Face extends React.Component { } placeholder="username" + disabled={!this.getApplicationObj().enablePassword} /> } type="password" placeholder="password" + disabled={!this.getApplicationObj().enablePassword} /> - Auto login + + Auto login + Forgot password? @@ -113,6 +117,7 @@ class Face extends React.Component { type="primary" htmlType="submit" style={{width: "100%"}} + disabled={!this.getApplicationObj().enablePassword} > Login