226 Commits

Author SHA1 Message Date
DacongDA
12acb24dbc
feat: add transaction pages (#2761) 2024-03-02 10:41:16 +08:00
DacongDA
23c2ba3a2b
feat: support ssh key/pem file in DB syncer (#2727)
* feat: support connect database with ssh tunnel in syncer

* feat: improve i18n translate

* feat: improve code format and i18n
2024-02-21 17:27:37 +08:00
DacongDA
c4a307b9ec
feat: add built-in "Records" pages back (#2720) 2024-02-20 13:28:29 +08:00
Yang Luo
75699c4a26 feat: improve code in getObject() 2024-02-13 23:50:21 +08:00
dacongda
167c1b0f1b
feat: fix bug in WeChat OA login (#2674)
* fix: fix the problem of Wechat Official Account login

* fix: fix code format problem

* fix: add error display and fix the code format problem

* fix: i18n problem and code format
2024-02-05 21:38:12 +08:00
HGZ-20
b7be1943fa
feat: Add Invitation Code to Generate Invitation Link (#2666)
Add auto-population of invitation fields in the registration page based on the invitation code in the link
2024-02-02 21:12:56 +08:00
dacongda
ce0d45a70b
feat: support SAML POST binding (#2661)
* fix: support saml http post binding

* fix: support saml http post binding

* fix: support saml post binding sp
2024-02-01 17:28:56 +08:00
Yang Luo
ba9d6e5d78 Fix Swagger API version 2024-01-16 00:09:28 +08:00
Yang Luo
78066da208 Improve setCorsHeaders() for "include" mode 2024-01-13 23:46:05 +08:00
Yang Luo
2fb79e4092 Add invitation pages 2023-12-31 21:38:36 +08:00
Yang Luo
27adeb4620 Refactor initAPI() 2023-12-30 14:28:45 +08:00
Yang Luo
482eb61168 feat: improve StaticFilter() 2023-12-05 18:33:06 +08:00
Yang Luo
811999b6cc feat: fix error handling in CheckPassword() related functions 2023-11-20 21:49:19 +08:00
Yang Luo
e9b7d1266f Fix API typo: /get-global-certs 2023-11-13 14:22:40 +08:00
Yang Luo
140737b2f6 Fix some bugs in Apple OAuth login path 2023-10-31 23:10:36 +08:00
Yang Luo
2398e69012 Improve fastAutoSignin() 2023-10-31 16:54:30 +08:00
Yang Luo
cf10738f45 Fix typo in AddUserKeys() 2023-10-31 13:31:12 +08:00
Yang Luo
6ef2b51782 Support fastAutoSignin by backend redirection 2023-10-27 00:44:50 +08:00
Yang Luo
a10548fe73 Fix org admin's enforcer policy APIs 2023-10-26 23:31:36 +08:00
Yang Luo
1055d7781b Improve error handling in AutoSigninFilter 2023-10-15 12:43:36 +08:00
Yang Luo
43d849086f Fix 127.0.0.1 bug in isHostIntranet() 2023-10-13 23:29:37 +08:00
haiwu
440d87d70c feat: support SCIM protocol (#2393)
* 111

* feat: support scim/Users GET and POST request

* feat: support scim/Users DELETE/PATCH/PUT request

* feat: better support scim/Users PATCH request

* feat: fix scim/Users logic

* feat: gofumpt

* feat: fix bug in scim/Users

* feat: fix typo

---------

Co-authored-by: hsluoyz <hsluoyz@qq.com>
2023-10-12 00:13:16 +08:00
Yang Luo
070aa8a65f Show 404 error for index.html not found 2023-10-10 22:57:39 +08:00
Yang Luo
0096e47351 feat: fix 403 error in CorsFilter 2023-10-10 18:39:25 +08:00
Yang Luo
e3558894c3 Add isHostIntranet to CORS filter 2023-10-08 19:29:19 +08:00
Yang Luo
2fd2d88d20 Return 403 in filter's responseError() 2023-10-05 00:12:02 +08:00
Yang Luo
6a9d1e0fe5 Add frontendBaseDir 2023-10-04 12:19:56 +08:00
Yang Luo
620383cf33 Allow CORS for https://localhost 2023-09-30 09:11:47 +08:00
Yang Luo
de6cd380eb Set OPTIONS status in setCorsHeaders() 2023-09-30 01:13:29 +08:00
Yang Luo
1461268a51 Allow redirect URL for casdoor-app 2023-09-27 22:37:57 +08:00
Yang Luo
5c89705d9e feat: allow CORS for 127.0.0.1 2023-09-27 14:10:59 +08:00
Yang Luo
03a281cb5d Improve CorsFilter code 2023-09-26 14:51:38 +08:00
Yang Luo
a8e541159b Allow localhost in CorsFilter 2023-09-26 00:03:26 +08:00
Yang Luo
577bf91d25 Refactor out setCorsHeaders() 2023-09-26 00:02:31 +08:00
UsherFall
7f298efebc feat: fix Apple OAuth issue (#2338)
* feat: fix sign in with apple bug

* fix username
2023-09-18 17:04:03 +08:00
Yaodong Yu
a12ba7fb85
feat: allow CORS for UserInfo API in OIDC (#2313) 2023-09-13 18:11:13 +08:00
Yang Luo
ea1414dfd0 Fix typo 2023-09-13 00:19:32 +08:00
Yang Luo
411a85c7ab Remove useless GetMaxLenStr() 2023-09-09 15:40:35 +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>
2023-09-02 00:06:04 +08:00
Yang Luo
0b859197da Fix CAS "/proxyValidate" API 2023-09-01 21:47:26 +08:00
Yang Luo
ea7718d7b7 Use Casvisor for records 2023-08-20 00:44:01 +08:00
UsherFall
914128a78a
fix: Support Telegram Notification provider (#2225)
* fear: support telegram provider

* fix: fix telegram logo

* fix: fix telegram bot package

* Update telegram.go

* Update notification.go

---------

Co-authored-by: hsluoyz <hsluoyz@qq.com>
2023-08-19 12:33:00 +08:00
8ff0cfd6ec feat: support dashboard in homepage (#2207)
* feat: support dashboard

* feat: support dashboard
2023-08-14 15:31:29 +08:00
Yang Luo
01e58158b7 feat: Remove useless code 2023-08-08 19:16:55 +08:00
Yang Luo
2fb9674171 Fix file not exist panic in StaticFilter() 2023-07-30 19:03:21 +08:00
Yang Luo
f879170663 Remove AI related code 2023-07-30 14:39:27 +08:00
haiwu
eefa1e6df4
fix: fix paypal payment provider and refactor payment code (#2159)
* feat: support paypal payment provider

* feat: support paypal flow

* feat: use owner replace org for payment

* feat: update paypal logic

* feat: gofumpt

* feat: update payment

* fix: fix notify

* feat: delete log
2023-07-30 11:54:42 +08:00
Yaodong Yu
026fb207b3
fix: remove model in adapter page (#2161) 2023-07-29 23:42:08 +08:00
Yaodong Yu
ea10f8e615
feat: make hard-coded authz adapter editable, rename adapter to ormer (#2149)
* refactor: rename casbinAdapter to casdoorAdapter

* feat: add initEnforcer

* fix: router

* refactor: make hard-coded code configurable

* fix: data type

* feat: support sqlite3

* feat: disable delete and edit name for built in resources

* feat: optimize code

* fix: init

* fix: e2e

* fix: remove datasourcename

* fix: revert rename

* refactor: change all ORM's Adatper to Ormer

* refactor: name
2023-07-29 15:07:04 +08:00
Yang Luo
6c628d7893 Fix static path not changed bug in makeGzipResponse() 2023-07-29 12:23:48 +08:00