1926 Commits

Author SHA1 Message Date
Yang Luo
b0aaf09ef1 Add 7 new i18n languages 2023-09-02 18:49:43 +08:00
Yang Luo
7e2f67c49a Fix i18n error 2023-09-02 18:33:19 +08:00
Yang Luo
e584a6a111 Support using "?allowEmpty=1" to bypass empty displayName check in update-user API 2023-09-02 11:59:07 +08:00
YunShu
6700d2e244
fix: show error when frontend HTML entry does not exist (#2289)
* fix: add response when web file not found

The error flow is as follows:

Assuming my directory structure is as follows:

```tree
├── GitHub
│   ├── casdoor  # code repository
              ├── casdoor # compiled binary file
```

Execute the program in the `GitHub` directory:

```bash
./casdoor/casdoor
```

The working directory at this time is `GitHub`.

According to the code:

```go
func StaticFilter(ctx *context.Context) {
	urlPath := ctx.Request.URL.Path

   /// omitted

	path := "web/build"
	if urlPath == "/" {
		path += "/index.html"
	} else {
		path += urlPath
	}

	if !util.FileExist(path) {
		path = "web/build/index.html"
	}
	if !util.FileExist(path) {
		return
	}

    /// omitted
}
```

If the user accesses `/`, according to this code, the returned value is actually `web/build/index.html`. But the current directory is GitHub, and there is no `web/build/index.html` file. According to the following code, it will directly return:

```go
	if !util.FileExist(path) {
		return
	}
```

Then in `main.go`:

```go
	beego.InsertFilter("*", beego.BeforeRouter, routers.StaticFilter)
	beego.InsertFilter("*", beego.BeforeRouter, routers.AutoSigninFilter)
	beego.InsertFilter("*", beego.BeforeRouter, routers.CorsFilter)
	beego.InsertFilter("*", beego.BeforeRouter, routers.ApiFilter)
	beego.InsertFilter("*", beego.BeforeRouter, routers.PrometheusFilter)
	beego.InsertFilter("*", beego.BeforeRouter, routers.RecordMessage)
```

The introduction of `beego.InsertFilter` is as follows:

```
func InsertFilter(pattern string, pos int, filter FilterFunc, params ...bool) *App

InsertFilter adds a FilterFunc with pattern condition and action constant. The pos means action constant including beego.BeforeStatic, beego.BeforeRouter, beego.BeforeExec, beego.AfterExec and beego.FinishRouter. The bool params is for setting the returnOnOutput value (false allows multiple filters to execute)
```

When the `params` parameter is `false`, it runs multiple filters. The default is `true`.

So normally, if

```go
beego.InsertFilter("*", beego.BeforeRouter, routers.StaticFilter)
```

response something, the following filters will not be executed. But because the file does not exist, the function directly returns, causing the subsequent filters to continue executing. When it reaches

```go
beego.InsertFilter("*", beego.BeforeRouter, routers.ApiFilter)
```

it will start to check permissions:

```
subOwner = anonymous, subName = anonymous, method = GET, urlPath = /login, obj.Owner = , obj.Name = , result = deny
```

Then it will report this error:

```json
{
    "status": "error",
    "msg": "Unauthorized operation",
    "data": null,
    "data2": null
}
```

The solution should be:

```go
func StaticFilter(ctx *context.Context) {
	urlPath := ctx.Request.URL.Path

   /// omitted

	path := "web/build"
	if urlPath == "/" {
		path += "/index.html"
	} else {
		path += urlPath
	}

	if !util.FileExist(path) {
		// todo: response error: page not found
		return
	}

    /// omitted
}
```

* Update static_filter.go

---------

Co-authored-by: hsluoyz <hsluoyz@qq.com>
v1.406.2
2023-09-02 00:06:04 +08:00
Cattī Crūdēlēs
0c5c308071
fix: sendCasAuthenticationResponseErr when pgtUrlObj if not valid url (#2287)
* fix: sendCasAuthenticationResponseErr when pgtUrlObj if not valid url

check pgtUrlObj.Scheme first will cause panic if url.Parse returns error.

* Update cas.go

---------

Co-authored-by: hsluoyz <hsluoyz@qq.com>
v1.406.1
2023-09-01 22:26:57 +08:00
Yang Luo
0b859197da Fix CAS "/proxyValidate" API 2023-09-01 21:47:26 +08:00
Yang Luo
3078409343 Add CertPublicKey to Application 2023-09-01 21:16:51 +08:00
Tower He
bbf2db2e00 feat: support to use a different db schema for pg (#2281) v1.406.0 2023-09-01 18:02:13 +08:00
Yang Luo
0c7b911ce7 Fix enforcer edit page logic 2023-09-01 01:30:50 +08:00
Yang Luo
2cc55715ac Add app.conf existence check 2023-09-01 01:25:45 +08:00
Yang Luo
c829bf1769 Fix DummyPaymentProvider's return URL 2023-09-01 01:25:15 +08:00
Yang Luo
ec956c12ca Fix Email duplicated issue in update-user 2023-08-31 23:44:40 +08:00
Tower He
d3d4646c56
feat: fix can not create db when using pg with a dbname in DSN (#2280)
* fix: can not create db when using pg with a dbname in DSN

* Update ormer.go

---------

Co-authored-by: hsluoyz <hsluoyz@qq.com>
v1.405.0
2023-08-31 18:05:38 +08:00
Yang Luo
669ac7c618 Don't encrypt user pass when user.PasswordType is non-empty when adding users 2023-08-31 17:49:36 +08:00
Yang Luo
6715efd781 Fix enforcer edit page 2023-08-31 17:32:36 +08:00
haiwu
953be4a7b6
feat: support subscription periods (yearly/monthly) (#2265)
* feat: support year/month subscription

* feat: add GetPrice() for plan

* feat: add GetDuration

* feat: gofumpt

* feat: add subscription mode for pricing

* feat: restrict auto create product operation

* fix: format code

* feat: add period for plan,remove period from pricing

* feat: format code

* feat: remove space

* feat: remove period in signup page
v1.404.0
2023-08-30 17:13:45 +08:00
Yang Luo
943cc43427 Fix payment list and product edit actions 2023-08-28 21:01:23 +08:00
Yang Luo
1e5ce7a045 Fix crash in syncUsersNoError() 2023-08-28 01:51:06 +08:00
Baihhh
7a85b74573
fix: fix tour disabled state (#2264)
* fix: distinguish between pages that can tour or not

* Update OpenTour.js

---------

Co-authored-by: hsluoyz <hsluoyz@qq.com>
v1.403.1
2023-08-27 23:18:14 +08:00
Yang Luo
7e349c1768 feat: fix crash bug in getSteps() v1.403.0 2023-08-27 21:58:58 +08:00
Baihhh
b19be2df88
fix: change the id to key in syncer (#2263) v1.402.1 2023-08-27 20:57:27 +08:00
Yang Luo
fc3866db1c Use XORM grammar in syncer 2023-08-27 18:15:23 +08:00
Yang Luo
bf2bb31e41 Add sslMode for syncer 2023-08-27 17:07:19 +08:00
Baihhh
ec8bd6f01d feat: add tour for list pages (#2243) v1.402.0 2023-08-27 16:40:31 +08:00
Yang Luo
98722fd681 Fix crash in app list page for normal user 2023-08-27 11:31:48 +08:00
Yang Luo
221c55aa93 Fix yarn build cmd 2023-08-27 11:17:18 +08:00
Yang Luo
988b26b3c2 Return error for RunSyncer() 2023-08-27 02:22:37 +08:00
Yang Luo
7e3c361ce7 Add all webhook events 2023-08-26 23:50:24 +08:00
Yang Luo
a637707e77 Fix null bug in IsAdminOrSelf() 2023-08-26 10:39:46 +08:00
Yaodong Yu
7970edeaa7
feat: password and invitation code verification rules (#2258) v1.401.0 2023-08-25 21:16:21 +08:00
haiwu
9da2f0775f
fix: fix bug in Pricing (#2255) v1.400.1 2023-08-25 19:27:46 +08:00
Yang Luo
739a9bcd0d feat: add CasvisorUrl v1.400.0 2023-08-25 11:56:12 +08:00
Yang Luo
fb0949b9ed Fix docker cannot get version bug 2023-08-25 11:49:47 +08:00
Yang Luo
27ed901167 Restrict sysinfo page to global admin 2023-08-25 11:20:11 +08:00
Yang Luo
ceab662b88 Remove dup swagger page 2023-08-25 11:09:59 +08:00
haiwu
05b2f00057
feat: support Pricings flow (#2250)
* feat: fix price display

* feat: support subscription

* feat: fix select-plan-> signup -> buy-plan -> login flow

* feat: support paid-user to login and jump to the pricing page

* feat: support more subscription state

* feat: add payment providers for plan

* feat: format code

* feat: gofumpt

* feat: redirect to buy-plan-result page when user have pending subscription

* feat: response err when pricing don't exit

* Update PricingListPage.js

* Update ProductBuyPage.js

* Update LoginPage.js

---------

Co-authored-by: hsluoyz <hsluoyz@qq.com>
v1.399.0
2023-08-24 23:20:50 +08:00
Yang Luo
8073dfa88c Remove tmpFiles folder usage 2023-08-24 22:03:36 +08:00
Yang Luo
1eeeb64a0c Add checkModel() for UserGroupEnforcer 2023-08-24 18:22:23 +08:00
Yaodong Yu
f5e0461cae
feat: add invitation code for signup feature (#2249)
* feat: add invitation code for signup feature

* feat: add invitation code for signup feature
v1.398.0
2023-08-24 13:42:17 +08:00
Andrey
a0c5eb241f
feat: add fields to syncer (PreferredMfaType, TotpSecret, SignupApplication) #2239 (#2245) v1.397.0 2023-08-23 21:40:00 +08:00
Lars Lehtonen
4d8edcc446
fix: dropped controllers err (#2244)
Signed-off-by: Lars Lehtonen <lars.lehtonen@gmail.com>
2023-08-23 21:37:51 +08:00
Yaodong Yu
2b23c04f49
fix: add SignupApplication and type for user synced from LDAP (#2240) v1.396.1 2023-08-21 22:52:35 +08:00
Cattī Crūdēlēs
e60ee52d91
feat: replace satori/go.uuid with google/uuid (#2238) v1.396.0 2023-08-21 13:58:15 +08:00
UsherFall
c54b54ca19
fix: Adjust custom http to notification provider (#2237)
* feat: Adjust custom http to notification provider

* fix go linter

* update ProviderEditPage

* update ProviderEditPage
v1.395.1
2023-08-20 21:04:30 +08:00
Yaodong Yu
f0e097e138
feat: fix home page (#2236)
* fix: home page

* fix: home page
v1.395.0
2023-08-20 00:58:39 +08:00
Yang Luo
25ec1bdfa8 Fix bug in getUserOrganization() 2023-08-20 00:53:51 +08:00
Yang Luo
ea7718d7b7 Use Casvisor for records 2023-08-20 00:44:01 +08:00
Yang Luo
463fa8b636 Add ormer_session.go 2023-08-19 18:41:08 +08:00
Yang Luo
11895902f4 Move getCreateDatabaseFlag() to ormer 2023-08-19 16:44:34 +08:00
Yang Luo
15269d3315 Refactor out conf_quota.go 2023-08-19 16:39:21 +08:00