mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-14 16:13:24 +08:00
Compare commits
12 Commits
Author | SHA1 | Date | |
---|---|---|---|
c48306d117 | |||
6efec6b4b5 | |||
2daf26aa88 | |||
21c151bcf8 | |||
b6b0b7d318 | |||
0ecc1d599f | |||
3456fc6695 | |||
c302dc7b8e | |||
d24ddd4f1c | |||
572616d390 | |||
2187310dbc | |||
26345bb21b |
@ -20,6 +20,7 @@ import (
|
||||
"strings"
|
||||
|
||||
"github.com/beego/beego/utils/pagination"
|
||||
"github.com/casdoor/casdoor/conf"
|
||||
"github.com/casdoor/casdoor/object"
|
||||
"github.com/casdoor/casdoor/util"
|
||||
)
|
||||
@ -293,6 +294,11 @@ func (c *ApiController) UpdateUser() {
|
||||
return
|
||||
}
|
||||
|
||||
isUsernameLowered := conf.GetConfigBool("isUsernameLowered")
|
||||
if isUsernameLowered {
|
||||
user.Name = strings.ToLower(user.Name)
|
||||
}
|
||||
|
||||
isAdmin := c.IsAdmin()
|
||||
if pass, err := object.CheckPermissionForUpdateUser(oldUser, &user, isAdmin, c.GetAcceptLanguage()); !pass {
|
||||
c.ResponseError(err)
|
||||
|
6
go.mod
6
go.mod
@ -9,12 +9,12 @@ require (
|
||||
github.com/beego/beego v1.12.12
|
||||
github.com/beevik/etree v1.1.0
|
||||
github.com/casbin/casbin/v2 v2.77.2
|
||||
github.com/casdoor/go-sms-sender v0.20.0
|
||||
github.com/casdoor/go-sms-sender v0.23.0
|
||||
github.com/casdoor/gomail/v2 v2.0.1
|
||||
github.com/casdoor/notify v0.45.0
|
||||
github.com/casdoor/oss v1.6.0
|
||||
github.com/casdoor/xorm-adapter/v3 v3.1.0
|
||||
github.com/casvisor/casvisor-go-sdk v1.3.0
|
||||
github.com/casvisor/casvisor-go-sdk v1.4.0
|
||||
github.com/dchest/captcha v0.0.0-20200903113550-03f5f0333e1f
|
||||
github.com/denisenkom/go-mssqldb v0.9.0
|
||||
github.com/elazarl/go-bindata-assetfs v1.0.1 // indirect
|
||||
@ -45,7 +45,7 @@ require (
|
||||
github.com/robfig/cron/v3 v3.0.1
|
||||
github.com/russellhaering/gosaml2 v0.9.0
|
||||
github.com/russellhaering/goxmldsig v1.2.0
|
||||
github.com/sendgrid/sendgrid-go v3.14.0+incompatible // indirect
|
||||
github.com/sendgrid/sendgrid-go v3.14.0+incompatible
|
||||
github.com/shiena/ansicolor v0.0.0-20200904210342-c7312218db18 // indirect
|
||||
github.com/shirou/gopsutil v3.21.11+incompatible
|
||||
github.com/siddontang/go-log v0.0.0-20190221022429-1e957dd83bed
|
||||
|
10
go.sum
10
go.sum
@ -1003,6 +1003,8 @@ github.com/apache/arrow/go/v10 v10.0.1/go.mod h1:YvhnlEePVnBS4+0z3fhPfUy7W1Ikj0I
|
||||
github.com/apache/arrow/go/v11 v11.0.0/go.mod h1:Eg5OsL5H+e299f7u5ssuXsuHQVEGC4xei5aX110hRiI=
|
||||
github.com/apache/arrow/go/v12 v12.0.0/go.mod h1:d+tV/eHZZ7Dz7RPrFKtPK02tpr+c9/PEd/zm8mDS9Vg=
|
||||
github.com/apache/thrift v0.16.0/go.mod h1:PHK3hniurgQaNMZYaCLEqXKsYK8upmhPbmdP2FXSqgU=
|
||||
github.com/apistd/uni-go-sdk v0.0.2 h1:7kqETCOz/rz8AQU55XGzxDFGoFeMgeZL5fGwvxKBZrc=
|
||||
github.com/apistd/uni-go-sdk v0.0.2/go.mod h1:eIqYos4IbHgE/rB75r05ypNLahooEMJCrbjXq322b74=
|
||||
github.com/appleboy/go-fcm v0.1.5/go.mod h1:MSxZ4LqGRsnywOjnlXJXMqbjZrG4vf+0oHitfC9HRH0=
|
||||
github.com/armon/circbuf v0.0.0-20150827004946-bbbad097214e/go.mod h1:3U/XgcO3hCbHZ8TKRvWD2dDTCfh9M9ya+I9JpbB7O8o=
|
||||
github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8=
|
||||
@ -1083,8 +1085,8 @@ github.com/casbin/casbin/v2 v2.77.2 h1:yQinn/w9x8AswiwqwtrXz93VU48R1aYTXdHEx4RI3
|
||||
github.com/casbin/casbin/v2 v2.77.2/go.mod h1:mzGx0hYW9/ksOSpw3wNjk3NRAroq5VMFYUQ6G43iGPk=
|
||||
github.com/casdoor/go-reddit/v2 v2.1.0 h1:kIbfdJ7AA7H0uTQ8s0q4GGZqSS5V9wVE74RrXyD9XPs=
|
||||
github.com/casdoor/go-reddit/v2 v2.1.0/go.mod h1:eagkvwlZ4Hcsuc/uQsLHYEulz5jN65SVSwV/AIE7zsc=
|
||||
github.com/casdoor/go-sms-sender v0.20.0 h1:yLbCakV04DzzehhgBklOrSeCFjMwpfKBeemz9b+Y8OM=
|
||||
github.com/casdoor/go-sms-sender v0.20.0/go.mod h1:cQs7qqohMJBgIVZebOCB8ko09naG1vzFJEH59VNIscs=
|
||||
github.com/casdoor/go-sms-sender v0.23.0 h1:N8+By4JNwyilEcx7cp0QGOepafefM88VwV+o3UEFZio=
|
||||
github.com/casdoor/go-sms-sender v0.23.0/go.mod h1:bOm4H8/YfJmEHjBatEVQFOnAf0OOn1B0Wi5B7zDhws0=
|
||||
github.com/casdoor/gomail/v2 v2.0.1 h1:J+FG6x80s9e5lBHUn8Sv0Y56mud34KiWih5YdmudR/w=
|
||||
github.com/casdoor/gomail/v2 v2.0.1/go.mod h1:VnGPslEAtpix5FjHisR/WKB1qvZDBaujbikxDe9d+2Q=
|
||||
github.com/casdoor/notify v0.45.0 h1:OlaFvcQFjGOgA4mRx07M8AH1gvb5xNo21mcqrVGlLgk=
|
||||
@ -1093,8 +1095,8 @@ github.com/casdoor/oss v1.6.0 h1:IOWrGLJ+VO82qS796eaRnzFPPA1Sn3cotYTi7O/VIlQ=
|
||||
github.com/casdoor/oss v1.6.0/go.mod h1:rJAWA0hLhtu94t6IRpotLUkXO1NWMASirywQYaGizJE=
|
||||
github.com/casdoor/xorm-adapter/v3 v3.1.0 h1:NodWayRtSLVSeCvL9H3Hc61k0G17KhV9IymTCNfh3kk=
|
||||
github.com/casdoor/xorm-adapter/v3 v3.1.0/go.mod h1:4WTcUw+bTgBylGHeGHzTtBvuTXRS23dtwzFLl9tsgFM=
|
||||
github.com/casvisor/casvisor-go-sdk v1.3.0 h1:HVgm2g3lWpNX2wBNidzR743QY4O5kAjLUJ9tS2juO8g=
|
||||
github.com/casvisor/casvisor-go-sdk v1.3.0/go.mod h1:frnNtH5GA0wxzAQLyZxxfL0RSsSub9GQPi2Ybe86ocE=
|
||||
github.com/casvisor/casvisor-go-sdk v1.4.0 h1:hbZEGGJ1cwdHFAxeXrMoNw6yha6Oyg2F0qQhBNCN/dg=
|
||||
github.com/casvisor/casvisor-go-sdk v1.4.0/go.mod h1:frnNtH5GA0wxzAQLyZxxfL0RSsSub9GQPi2Ybe86ocE=
|
||||
github.com/cenkalti/backoff/v4 v4.1.1/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw=
|
||||
github.com/cenkalti/backoff/v4 v4.1.2/go.mod h1:scbssz8iZGpm3xbr14ovlUdkxfGXNInqkPWOWmG2CLw=
|
||||
github.com/cenkalti/backoff/v4 v4.1.3 h1:cFAlzYUlVYDysBEH2T5hyJZMh3+5+WCBvSnK6Q8UtC4=
|
||||
|
@ -46,6 +46,7 @@ type SigninItem struct {
|
||||
Name string `json:"name"`
|
||||
Visible bool `json:"visible"`
|
||||
Label string `json:"label"`
|
||||
CustomCss string `json:"customCss"`
|
||||
Placeholder string `json:"placeholder"`
|
||||
Rule string `json:"rule"`
|
||||
IsCustom bool `json:"isCustom"`
|
||||
@ -209,7 +210,7 @@ func extendApplicationWithSigninItems(application *Application) (err error) {
|
||||
signinItem := &SigninItem{
|
||||
Name: "Back button",
|
||||
Visible: true,
|
||||
Label: ".back-button {\n top: 65px;\n left: 15px;\n position: absolute;\n}\n.back-inner-button{}",
|
||||
CustomCss: ".back-button {\n top: 65px;\n left: 15px;\n position: absolute;\n}\n.back-inner-button{}",
|
||||
Placeholder: "",
|
||||
Rule: "None",
|
||||
}
|
||||
@ -217,7 +218,7 @@ func extendApplicationWithSigninItems(application *Application) (err error) {
|
||||
signinItem = &SigninItem{
|
||||
Name: "Languages",
|
||||
Visible: true,
|
||||
Label: ".login-languages {\n top: 55px;\n right: 5px;\n position: absolute;\n}",
|
||||
CustomCss: ".login-languages {\n top: 55px;\n right: 5px;\n position: absolute;\n}",
|
||||
Placeholder: "",
|
||||
Rule: "None",
|
||||
}
|
||||
@ -225,7 +226,7 @@ func extendApplicationWithSigninItems(application *Application) (err error) {
|
||||
signinItem = &SigninItem{
|
||||
Name: "Logo",
|
||||
Visible: true,
|
||||
Label: ".login-logo-box {}",
|
||||
CustomCss: ".login-logo-box {}",
|
||||
Placeholder: "",
|
||||
Rule: "None",
|
||||
}
|
||||
@ -233,7 +234,7 @@ func extendApplicationWithSigninItems(application *Application) (err error) {
|
||||
signinItem = &SigninItem{
|
||||
Name: "Signin methods",
|
||||
Visible: true,
|
||||
Label: ".signin-methods {}",
|
||||
CustomCss: ".signin-methods {}",
|
||||
Placeholder: "",
|
||||
Rule: "None",
|
||||
}
|
||||
@ -241,7 +242,7 @@ func extendApplicationWithSigninItems(application *Application) (err error) {
|
||||
signinItem = &SigninItem{
|
||||
Name: "Username",
|
||||
Visible: true,
|
||||
Label: ".login-username {}\n.login-username-input{}",
|
||||
CustomCss: ".login-username {}\n.login-username-input{}",
|
||||
Placeholder: "",
|
||||
Rule: "None",
|
||||
}
|
||||
@ -249,7 +250,7 @@ func extendApplicationWithSigninItems(application *Application) (err error) {
|
||||
signinItem = &SigninItem{
|
||||
Name: "Password",
|
||||
Visible: true,
|
||||
Label: ".login-password {}\n.login-password-input{}",
|
||||
CustomCss: ".login-password {}\n.login-password-input{}",
|
||||
Placeholder: "",
|
||||
Rule: "None",
|
||||
}
|
||||
@ -257,7 +258,7 @@ func extendApplicationWithSigninItems(application *Application) (err error) {
|
||||
signinItem = &SigninItem{
|
||||
Name: "Agreement",
|
||||
Visible: true,
|
||||
Label: ".login-agreement {}",
|
||||
CustomCss: ".login-agreement {}",
|
||||
Placeholder: "",
|
||||
Rule: "None",
|
||||
}
|
||||
@ -265,7 +266,7 @@ func extendApplicationWithSigninItems(application *Application) (err error) {
|
||||
signinItem = &SigninItem{
|
||||
Name: "Forgot password?",
|
||||
Visible: true,
|
||||
Label: ".login-forget-password {\n display: inline-flex;\n justify-content: space-between;\n width: 320px;\n margin-bottom: 25px;\n}",
|
||||
CustomCss: ".login-forget-password {\n display: inline-flex;\n justify-content: space-between;\n width: 320px;\n margin-bottom: 25px;\n}",
|
||||
Placeholder: "",
|
||||
Rule: "None",
|
||||
}
|
||||
@ -273,7 +274,7 @@ func extendApplicationWithSigninItems(application *Application) (err error) {
|
||||
signinItem = &SigninItem{
|
||||
Name: "Login button",
|
||||
Visible: true,
|
||||
Label: ".login-button-box {\n margin-bottom: 5px;\n}\n.login-button {\n width: 100%;\n}",
|
||||
CustomCss: ".login-button-box {\n margin-bottom: 5px;\n}\n.login-button {\n width: 100%;\n}",
|
||||
Placeholder: "",
|
||||
Rule: "None",
|
||||
}
|
||||
@ -281,7 +282,7 @@ func extendApplicationWithSigninItems(application *Application) (err error) {
|
||||
signinItem = &SigninItem{
|
||||
Name: "Signup link",
|
||||
Visible: true,
|
||||
Label: ".login-signup-link {\n margin-bottom: 24px;\n display: flex;\n justify-content: end;\n}",
|
||||
CustomCss: ".login-signup-link {\n margin-bottom: 24px;\n display: flex;\n justify-content: end;\n}",
|
||||
Placeholder: "",
|
||||
Rule: "None",
|
||||
}
|
||||
@ -289,12 +290,18 @@ func extendApplicationWithSigninItems(application *Application) (err error) {
|
||||
signinItem = &SigninItem{
|
||||
Name: "Providers",
|
||||
Visible: true,
|
||||
Label: ".provider-img {\n width: 30px;\n margin: 5px;\n}\n.provider-big-img {\n margin-bottom: 10px;\n}",
|
||||
CustomCss: ".provider-img {\n width: 30px;\n margin: 5px;\n}\n.provider-big-img {\n margin-bottom: 10px;\n}",
|
||||
Placeholder: "",
|
||||
Rule: "None",
|
||||
}
|
||||
application.SigninItems = append(application.SigninItems, signinItem)
|
||||
}
|
||||
for idx, item := range application.SigninItems {
|
||||
if item.Label != "" && item.CustomCss == "" {
|
||||
application.SigninItems[idx].CustomCss = item.Label
|
||||
application.SigninItems[idx].Label = ""
|
||||
}
|
||||
}
|
||||
return
|
||||
}
|
||||
|
||||
@ -670,11 +677,7 @@ func AddApplication(application *Application) (bool, error) {
|
||||
return affected != 0, nil
|
||||
}
|
||||
|
||||
func DeleteApplication(application *Application) (bool, error) {
|
||||
if application.Name == "app-built-in" {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
func deleteApplication(application *Application) (bool, error) {
|
||||
affected, err := ormer.Engine.ID(core.PK{application.Owner, application.Name}).Delete(&Application{})
|
||||
if err != nil {
|
||||
return false, err
|
||||
@ -683,6 +686,14 @@ func DeleteApplication(application *Application) (bool, error) {
|
||||
return affected != 0, nil
|
||||
}
|
||||
|
||||
func DeleteApplication(application *Application) (bool, error) {
|
||||
if application.Name == "app-built-in" {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
return deleteApplication(application)
|
||||
}
|
||||
|
||||
func (application *Application) GetId() string {
|
||||
return fmt.Sprintf("%s/%s", application.Owner, application.Name)
|
||||
}
|
||||
|
@ -154,6 +154,15 @@ func AddGroups(groups []*Group) (bool, error) {
|
||||
return affected != 0, nil
|
||||
}
|
||||
|
||||
func deleteGroup(group *Group) (bool, error) {
|
||||
affected, err := ormer.Engine.ID(core.PK{group.Owner, group.Name}).Delete(&Group{})
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
return affected != 0, nil
|
||||
}
|
||||
|
||||
func DeleteGroup(group *Group) (bool, error) {
|
||||
_, err := ormer.Engine.Get(group)
|
||||
if err != nil {
|
||||
@ -172,12 +181,7 @@ func DeleteGroup(group *Group) (bool, error) {
|
||||
return false, errors.New("group has users")
|
||||
}
|
||||
|
||||
affected, err := ormer.Engine.ID(core.PK{group.Owner, group.Name}).Delete(&Group{})
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
return affected != 0, nil
|
||||
return deleteGroup(group)
|
||||
}
|
||||
|
||||
func checkGroupName(name string) error {
|
||||
|
@ -266,7 +266,7 @@ func initDefinedOrganization(organization *Organization) {
|
||||
}
|
||||
|
||||
if existed != nil {
|
||||
affected, err := DeleteOrganization(organization)
|
||||
affected, err := deleteOrganization(organization)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@ -290,7 +290,7 @@ func initDefinedApplication(application *Application) {
|
||||
}
|
||||
|
||||
if existed != nil {
|
||||
affected, err := DeleteApplication(application)
|
||||
affected, err := deleteApplication(application)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@ -311,7 +311,7 @@ func initDefinedUser(user *User) {
|
||||
panic(err)
|
||||
}
|
||||
if existed != nil {
|
||||
affected, err := DeleteUser(user)
|
||||
affected, err := deleteUser(user)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@ -423,7 +423,7 @@ func initDefinedPermission(permission *Permission) {
|
||||
}
|
||||
|
||||
if existed != nil {
|
||||
affected, err := DeletePermission(permission)
|
||||
affected, err := deletePermission(permission)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@ -511,7 +511,7 @@ func initDefinedRole(role *Role) {
|
||||
}
|
||||
|
||||
if existed != nil {
|
||||
affected, err := DeleteRole(role)
|
||||
affected, err := deleteRole(role)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@ -598,7 +598,7 @@ func initDefinedGroup(group *Group) {
|
||||
panic(err)
|
||||
}
|
||||
if existed != nil {
|
||||
affected, err := DeleteGroup(group)
|
||||
affected, err := deleteGroup(group)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@ -666,7 +666,7 @@ func initDefinedPlan(plan *Plan) {
|
||||
panic(err)
|
||||
}
|
||||
if !affected {
|
||||
panic("Fail to delete enforcer")
|
||||
panic("Fail to delete plan")
|
||||
}
|
||||
}
|
||||
plan.CreatedTime = util.GetCurrentTime()
|
||||
@ -677,7 +677,7 @@ func initDefinedPlan(plan *Plan) {
|
||||
}
|
||||
|
||||
func initDefinedPricing(pricing *Pricing) {
|
||||
existed, err := getPlan(pricing.Owner, pricing.Name)
|
||||
existed, err := getPricing(pricing.Owner, pricing.Name)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@ -719,6 +719,7 @@ func initDefinedInvitation(invitation *Invitation) {
|
||||
}
|
||||
|
||||
func initDefinedRecord(record *casvisorsdk.Record) {
|
||||
record.Id = 0
|
||||
record.CreatedTime = util.GetCurrentTime()
|
||||
_ = AddRecord(record)
|
||||
}
|
||||
|
@ -241,11 +241,7 @@ func AddOrganization(organization *Organization) (bool, error) {
|
||||
return affected != 0, nil
|
||||
}
|
||||
|
||||
func DeleteOrganization(organization *Organization) (bool, error) {
|
||||
if organization.Name == "built-in" {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
func deleteOrganization(organization *Organization) (bool, error) {
|
||||
affected, err := ormer.Engine.ID(core.PK{organization.Owner, organization.Name}).Delete(&Organization{})
|
||||
if err != nil {
|
||||
return false, err
|
||||
@ -254,6 +250,14 @@ func DeleteOrganization(organization *Organization) (bool, error) {
|
||||
return affected != 0, nil
|
||||
}
|
||||
|
||||
func DeleteOrganization(organization *Organization) (bool, error) {
|
||||
if organization.Name == "built-in" {
|
||||
return false, nil
|
||||
}
|
||||
|
||||
return deleteOrganization(organization)
|
||||
}
|
||||
|
||||
func GetOrganizationByUser(user *User) (*Organization, error) {
|
||||
if user == nil {
|
||||
return nil, nil
|
||||
|
@ -286,13 +286,22 @@ func AddPermissionsInBatch(permissions []*Permission) (bool, error) {
|
||||
return affected, nil
|
||||
}
|
||||
|
||||
func DeletePermission(permission *Permission) (bool, error) {
|
||||
func deletePermission(permission *Permission) (bool, error) {
|
||||
affected, err := ormer.Engine.ID(core.PK{permission.Owner, permission.Name}).Delete(&Permission{})
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
if affected != 0 {
|
||||
return affected != 0, nil
|
||||
}
|
||||
|
||||
func DeletePermission(permission *Permission) (bool, error) {
|
||||
affected, err := deletePermission(permission)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
if affected {
|
||||
err = removeGroupingPolicies(permission)
|
||||
if err != nil {
|
||||
return false, err
|
||||
@ -314,7 +323,7 @@ func DeletePermission(permission *Permission) (bool, error) {
|
||||
}
|
||||
}
|
||||
|
||||
return affected != 0, nil
|
||||
return affected, nil
|
||||
}
|
||||
|
||||
func getPermissionsByUser(userId string) ([]*Permission, error) {
|
||||
|
@ -133,7 +133,7 @@ func AddPlan(plan *Plan) (bool, error) {
|
||||
}
|
||||
|
||||
func DeletePlan(plan *Plan) (bool, error) {
|
||||
affected, err := ormer.Engine.ID(core.PK{plan.Owner, plan.Name}).Delete(plan)
|
||||
affected, err := ormer.Engine.ID(core.PK{plan.Owner, plan.Name}).Delete(Plan{})
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
@ -140,7 +140,7 @@ func AddPricing(pricing *Pricing) (bool, error) {
|
||||
}
|
||||
|
||||
func DeletePricing(pricing *Pricing) (bool, error) {
|
||||
affected, err := ormer.Engine.ID(core.PK{pricing.Owner, pricing.Name}).Delete(pricing)
|
||||
affected, err := ormer.Engine.ID(core.PK{pricing.Owner, pricing.Name}).Delete(Pricing{})
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
@ -21,7 +21,7 @@ type ProviderItem struct {
|
||||
CanSignUp bool `json:"canSignUp"`
|
||||
CanSignIn bool `json:"canSignIn"`
|
||||
CanUnlink bool `json:"canUnlink"`
|
||||
CountryCodes []string `json:"countryCode"`
|
||||
CountryCodes []string `json:"countryCodes"`
|
||||
Prompted bool `json:"prompted"`
|
||||
SignupGroup string `json:"signupGroup"`
|
||||
Rule string `json:"rule"`
|
||||
|
@ -90,12 +90,18 @@ func NewRecord(ctx *context.Context) (*casvisorsdk.Record, error) {
|
||||
Action: action,
|
||||
Language: languageCode,
|
||||
Object: object,
|
||||
StatusCode: 200,
|
||||
Response: fmt.Sprintf("{status:\"%s\", msg:\"%s\"}", resp.Status, resp.Msg),
|
||||
IsTriggered: false,
|
||||
}
|
||||
return &record, nil
|
||||
}
|
||||
|
||||
func addRecord(record *casvisorsdk.Record) (int64, error) {
|
||||
affected, err := ormer.Engine.Insert(record)
|
||||
return affected, err
|
||||
}
|
||||
|
||||
func AddRecord(record *casvisorsdk.Record) bool {
|
||||
if logPostOnly {
|
||||
if record.Method == "GET" {
|
||||
@ -108,7 +114,6 @@ func AddRecord(record *casvisorsdk.Record) bool {
|
||||
}
|
||||
|
||||
record.Owner = record.Organization
|
||||
|
||||
record.Object = maskPassword(record.Object)
|
||||
|
||||
errWebhook := SendWebhooks(record)
|
||||
@ -119,7 +124,7 @@ func AddRecord(record *casvisorsdk.Record) bool {
|
||||
}
|
||||
|
||||
if casvisorsdk.GetClient() == nil {
|
||||
affected, err := ormer.Engine.Insert(record)
|
||||
affected, err := addRecord(record)
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
@ -224,6 +229,40 @@ func getFilteredWebhooks(webhooks []*Webhook, organization string, action string
|
||||
return res
|
||||
}
|
||||
|
||||
func addWebhookRecord(webhook *Webhook, record *casvisorsdk.Record, statusCode int, respBody string, sendError error) error {
|
||||
if statusCode == 200 {
|
||||
return nil
|
||||
}
|
||||
|
||||
if len(respBody) > 300 {
|
||||
respBody = respBody[0:300]
|
||||
}
|
||||
|
||||
webhookRecord := &casvisorsdk.Record{
|
||||
Owner: record.Owner,
|
||||
Name: util.GenerateId(),
|
||||
CreatedTime: util.GetCurrentTime(),
|
||||
Organization: record.Organization,
|
||||
User: record.User,
|
||||
|
||||
Method: webhook.Method,
|
||||
Action: "send-webhook",
|
||||
RequestUri: webhook.Url,
|
||||
StatusCode: statusCode,
|
||||
Response: respBody,
|
||||
Language: record.Language,
|
||||
IsTriggered: false,
|
||||
}
|
||||
|
||||
if sendError != nil {
|
||||
webhookRecord.Response = sendError.Error()
|
||||
}
|
||||
|
||||
_, err := addRecord(webhookRecord)
|
||||
|
||||
return err
|
||||
}
|
||||
|
||||
func SendWebhooks(record *casvisorsdk.Record) error {
|
||||
webhooks, err := getWebhooksByOrganization("")
|
||||
if err != nil {
|
||||
@ -248,11 +287,16 @@ func SendWebhooks(record *casvisorsdk.Record) error {
|
||||
}
|
||||
}
|
||||
|
||||
err = sendWebhook(webhook, record, user)
|
||||
statusCode, respBody, err := sendWebhook(webhook, record, user)
|
||||
if err != nil {
|
||||
errs = append(errs, err)
|
||||
continue
|
||||
}
|
||||
|
||||
err = addWebhookRecord(webhook, record, statusCode, respBody, err)
|
||||
if err != nil {
|
||||
errs = append(errs, err)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if len(errs) > 0 {
|
||||
|
@ -238,6 +238,15 @@ func AddRolesInBatch(roles []*Role) bool {
|
||||
return affected
|
||||
}
|
||||
|
||||
func deleteRole(role *Role) (bool, error) {
|
||||
affected, err := ormer.Engine.ID(core.PK{role.Owner, role.Name}).Delete(&Role{})
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
return affected != 0, nil
|
||||
}
|
||||
|
||||
func DeleteRole(role *Role) (bool, error) {
|
||||
roleId := role.GetId()
|
||||
permissions, err := GetPermissionsByRole(roleId)
|
||||
@ -253,12 +262,7 @@ func DeleteRole(role *Role) (bool, error) {
|
||||
}
|
||||
}
|
||||
|
||||
affected, err := ormer.Engine.ID(core.PK{role.Owner, role.Name}).Delete(&Role{})
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
return affected != 0, nil
|
||||
return deleteRole(role)
|
||||
}
|
||||
|
||||
func (role *Role) GetId() string {
|
||||
|
@ -48,7 +48,7 @@ func SendSms(provider *Provider, content string, phoneNumbers ...string) error {
|
||||
if provider.AppId != "" {
|
||||
phoneNumbers = append([]string{provider.AppId}, phoneNumbers...)
|
||||
}
|
||||
} else if provider.Type == sender.Aliyun {
|
||||
} else if provider.Type == sender.Aliyun || provider.Type == sender.SendCloud {
|
||||
for i, number := range phoneNumbers {
|
||||
phoneNumbers[i] = strings.TrimPrefix(number, "+86")
|
||||
}
|
||||
|
@ -155,7 +155,8 @@ func GetMaskedSyncers(syncers []*Syncer, errs ...error) ([]*Syncer, error) {
|
||||
|
||||
func UpdateSyncer(id string, syncer *Syncer) (bool, error) {
|
||||
owner, name := util.GetOwnerAndNameFromId(id)
|
||||
if s, err := getSyncer(owner, name); err != nil {
|
||||
s, err := getSyncer(owner, name)
|
||||
if err != nil {
|
||||
return false, err
|
||||
} else if s == nil {
|
||||
return false, nil
|
||||
@ -163,7 +164,7 @@ func UpdateSyncer(id string, syncer *Syncer) (bool, error) {
|
||||
|
||||
session := ormer.Engine.ID(core.PK{owner, name}).AllCols()
|
||||
if syncer.Password == "***" {
|
||||
session.Omit("password")
|
||||
syncer.Password = s.Password
|
||||
}
|
||||
affected, err := session.Update(syncer)
|
||||
if err != nil {
|
||||
|
@ -142,9 +142,11 @@ func (syncer *Syncer) syncUsers() error {
|
||||
}
|
||||
}
|
||||
|
||||
_, err = AddUsersInBatch(newUsers)
|
||||
if err != nil {
|
||||
return err
|
||||
if len(newUsers) != 0 {
|
||||
_, err = AddUsersInBatch(newUsers)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
}
|
||||
|
||||
if !syncer.IsReadOnly {
|
||||
|
@ -877,6 +877,7 @@ func AddUsers(users []*User) (bool, error) {
|
||||
}
|
||||
}
|
||||
|
||||
user.Name = strings.TrimSpace(user.Name)
|
||||
if isUsernameLowered {
|
||||
user.Name = strings.ToLower(user.Name)
|
||||
}
|
||||
@ -919,6 +920,15 @@ func AddUsersInBatch(users []*User) (bool, error) {
|
||||
return affected, nil
|
||||
}
|
||||
|
||||
func deleteUser(user *User) (bool, error) {
|
||||
affected, err := ormer.Engine.ID(core.PK{user.Owner, user.Name}).Delete(&User{})
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
return affected != 0, nil
|
||||
}
|
||||
|
||||
func DeleteUser(user *User) (bool, error) {
|
||||
// Forced offline the user first
|
||||
_, err := DeleteSession(util.GetSessionId(user.Owner, user.Name, CasdoorApplication))
|
||||
@ -926,12 +936,7 @@ func DeleteUser(user *User) (bool, error) {
|
||||
return false, err
|
||||
}
|
||||
|
||||
affected, err := ormer.Engine.ID(core.PK{user.Owner, user.Name}).Delete(&User{})
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
|
||||
return affected != 0, nil
|
||||
return deleteUser(user)
|
||||
}
|
||||
|
||||
func GetUserInfo(user *User, scope string, aud string, host string) (*Userinfo, error) {
|
||||
|
@ -21,12 +21,11 @@ import (
|
||||
"regexp"
|
||||
"strings"
|
||||
|
||||
"github.com/casdoor/casdoor/conf"
|
||||
"github.com/casdoor/casdoor/i18n"
|
||||
|
||||
jsoniter "github.com/json-iterator/go"
|
||||
|
||||
"github.com/casdoor/casdoor/idp"
|
||||
"github.com/casdoor/casdoor/util"
|
||||
jsoniter "github.com/json-iterator/go"
|
||||
"github.com/xorm-io/core"
|
||||
)
|
||||
|
||||
@ -57,6 +56,13 @@ func HasUserByField(organizationName string, field string, value string) bool {
|
||||
}
|
||||
|
||||
func GetUserByFields(organization string, field string) (*User, error) {
|
||||
isUsernameLowered := conf.GetConfigBool("isUsernameLowered")
|
||||
if isUsernameLowered {
|
||||
field = strings.ToLower(field)
|
||||
}
|
||||
|
||||
field = strings.TrimSpace(field)
|
||||
|
||||
// check username
|
||||
user, err := GetUserByField(organization, "name", field)
|
||||
if err != nil || user != nil {
|
||||
|
@ -15,6 +15,7 @@
|
||||
package object
|
||||
|
||||
import (
|
||||
"io"
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
@ -22,7 +23,7 @@ import (
|
||||
"github.com/casvisor/casvisor-go-sdk/casvisorsdk"
|
||||
)
|
||||
|
||||
func sendWebhook(webhook *Webhook, record *casvisorsdk.Record, extendedUser *User) error {
|
||||
func sendWebhook(webhook *Webhook, record *casvisorsdk.Record, extendedUser *User) (int, string, error) {
|
||||
client := &http.Client{}
|
||||
|
||||
type RecordEx struct {
|
||||
@ -38,7 +39,7 @@ func sendWebhook(webhook *Webhook, record *casvisorsdk.Record, extendedUser *Use
|
||||
|
||||
req, err := http.NewRequest(webhook.Method, webhook.Url, body)
|
||||
if err != nil {
|
||||
return err
|
||||
return 0, "", err
|
||||
}
|
||||
|
||||
req.Header.Set("Content-Type", webhook.ContentType)
|
||||
@ -47,6 +48,15 @@ func sendWebhook(webhook *Webhook, record *casvisorsdk.Record, extendedUser *Use
|
||||
req.Header.Set(header.Name, header.Value)
|
||||
}
|
||||
|
||||
_, err = client.Do(req)
|
||||
return err
|
||||
resp, err := client.Do(req)
|
||||
if err != nil {
|
||||
return 0, "", err
|
||||
}
|
||||
|
||||
defer resp.Body.Close()
|
||||
bodyBytes, err := io.ReadAll(resp.Body)
|
||||
if err != nil {
|
||||
return 0, "", err
|
||||
}
|
||||
return resp.StatusCode, string(bodyBytes), err
|
||||
}
|
||||
|
@ -209,6 +209,8 @@ class ProviderEditPage extends React.Component {
|
||||
return Setting.getLabel(i18next.t("provider:Public key"), i18next.t("provider:Public key - Tooltip"));
|
||||
} else if (provider.type === "Msg91 SMS" || provider.type === "Infobip SMS" || provider.type === "OSON SMS") {
|
||||
return Setting.getLabel(i18next.t("provider:Sender Id"), i18next.t("provider:Sender Id - Tooltip"));
|
||||
} else if (provider.type === "SendCloud SMS") {
|
||||
return "SMS_USER";
|
||||
} else {
|
||||
return Setting.getLabel(i18next.t("provider:Client ID"), i18next.t("provider:Client ID - Tooltip"));
|
||||
}
|
||||
@ -260,6 +262,8 @@ class ProviderEditPage extends React.Component {
|
||||
return Setting.getLabel(i18next.t("provider:Auth Key"), i18next.t("provider:Auth Key - Tooltip"));
|
||||
} else if (provider.type === "Infobip SMS") {
|
||||
return Setting.getLabel(i18next.t("provider:Api Key"), i18next.t("provider:Api Key - Tooltip"));
|
||||
} else if (provider.type === "SendCloud SMS") {
|
||||
return "SMS_KEY";
|
||||
} else {
|
||||
return Setting.getLabel(i18next.t("provider:Client secret"), i18next.t("provider:Client secret - Tooltip"));
|
||||
}
|
||||
@ -1089,7 +1093,7 @@ class ProviderEditPage extends React.Component {
|
||||
</React.Fragment>
|
||||
) : this.state.provider.category === "SMS" ? (
|
||||
<React.Fragment>
|
||||
{["Custom HTTP SMS", "Twilio SMS", "Amazon SNS", "Azure ACS", "Msg91 SMS", "Infobip SMS"].includes(this.state.provider.type) ?
|
||||
{["Custom HTTP SMS", "Twilio SMS", "Amazon SNS", "Azure ACS", "Msg91 SMS", "Infobip SMS", "SendCloud SMS"].includes(this.state.provider.type) ?
|
||||
null :
|
||||
(<Row style={{marginTop: "20px"}} >
|
||||
<Col style={{marginTop: "5px"}} span={(Setting.isMobile()) ? 22 : 2}>
|
||||
|
@ -151,6 +151,14 @@ class RecordListPage extends BaseListPage {
|
||||
sorter: true,
|
||||
...this.getColumnSearchProps("language"),
|
||||
},
|
||||
{
|
||||
title: i18next.t("record:Status code"),
|
||||
dataIndex: "statusCode",
|
||||
key: "statusCode",
|
||||
width: "90px",
|
||||
sorter: true,
|
||||
...this.getColumnSearchProps("statusCode"),
|
||||
},
|
||||
{
|
||||
title: i18next.t("record:Response"),
|
||||
dataIndex: "response",
|
||||
|
@ -139,6 +139,10 @@ export const OtherProviderInfo = {
|
||||
logo: `${StaticBaseUrl}/img/social_twilio.svg`,
|
||||
url: "https://www.twilio.com/messaging",
|
||||
},
|
||||
"SendCloud SMS": {
|
||||
logo: `${StaticBaseUrl}/img/sms_sendcloud.png`,
|
||||
url: "https://www.sendcloud.net/",
|
||||
},
|
||||
"SmsBao SMS": {
|
||||
logo: `${StaticBaseUrl}/img/social_smsbao.png`,
|
||||
url: "https://www.smsbao.com/",
|
||||
@ -1039,6 +1043,7 @@ export function getProviderTypeOptions(category) {
|
||||
{id: "Huawei Cloud SMS", name: "Huawei Cloud SMS"},
|
||||
{id: "UCloud SMS", name: "UCloud SMS"},
|
||||
{id: "Twilio SMS", name: "Twilio SMS"},
|
||||
{id: "SendCloud SMS", name: "SendCloud SMS"},
|
||||
{id: "SmsBao SMS", name: "SmsBao SMS"},
|
||||
{id: "SUBMAIL SMS", name: "SUBMAIL SMS"},
|
||||
{id: "Msg91 SMS", name: "Msg91 SMS"},
|
||||
|
@ -532,7 +532,7 @@ class LoginPage extends React.Component {
|
||||
if (signinItem.name === "Logo") {
|
||||
return (
|
||||
<div className="login-logo-box">
|
||||
<div dangerouslySetInnerHTML={{__html: ("<style>" + signinItem.label?.replaceAll("<style>", "").replaceAll("</style>", "") + "</style>")}} />
|
||||
<div dangerouslySetInnerHTML={{__html: ("<style>" + signinItem.customCss?.replaceAll("<style>", "").replaceAll("</style>", "") + "</style>")}} />
|
||||
{
|
||||
Setting.renderHelmet(application)
|
||||
}
|
||||
@ -544,7 +544,7 @@ class LoginPage extends React.Component {
|
||||
} else if (signinItem.name === "Back button") {
|
||||
return (
|
||||
<div className="back-button">
|
||||
<div dangerouslySetInnerHTML={{__html: ("<style>" + signinItem.label?.replaceAll("<style>", "").replaceAll("</style>", "") + "</style>")}} />
|
||||
<div dangerouslySetInnerHTML={{__html: ("<style>" + signinItem.customCss?.replaceAll("<style>", "").replaceAll("</style>", "") + "</style>")}} />
|
||||
{
|
||||
this.renderBackButton()
|
||||
}
|
||||
@ -562,14 +562,14 @@ class LoginPage extends React.Component {
|
||||
|
||||
return (
|
||||
<div className="login-languages">
|
||||
<div dangerouslySetInnerHTML={{__html: ("<style>" + signinItem.label?.replaceAll("<style>", "").replaceAll("</style>", "") + "</style>")}} />
|
||||
<div dangerouslySetInnerHTML={{__html: ("<style>" + signinItem.customCss?.replaceAll("<style>", "").replaceAll("</style>", "") + "</style>")}} />
|
||||
<LanguageSelect languages={application.organizationObj.languages} />
|
||||
</div>
|
||||
);
|
||||
} else if (signinItem.name === "Signin methods") {
|
||||
return (
|
||||
<div>
|
||||
<div dangerouslySetInnerHTML={{__html: ("<style>" + signinItem.label?.replaceAll("<style>", "").replaceAll("</style>", "") + "</style>")}} />
|
||||
<div dangerouslySetInnerHTML={{__html: ("<style>" + signinItem.customCss?.replaceAll("<style>", "").replaceAll("</style>", "") + "</style>")}} />
|
||||
{this.renderMethodChoiceBox()}
|
||||
</div>
|
||||
)
|
||||
@ -577,10 +577,11 @@ class LoginPage extends React.Component {
|
||||
} else if (signinItem.name === "Username") {
|
||||
return (
|
||||
<div>
|
||||
<div dangerouslySetInnerHTML={{__html: ("<style>" + signinItem.label?.replaceAll("<style>", "").replaceAll("</style>", "") + "</style>")}} />
|
||||
<div dangerouslySetInnerHTML={{__html: ("<style>" + signinItem.customCss?.replaceAll("<style>", "").replaceAll("</style>", "") + "</style>")}} />
|
||||
<Form.Item
|
||||
name="username"
|
||||
className="login-username"
|
||||
label={signinItem.label ? signinItem.label : null}
|
||||
rules={[
|
||||
{
|
||||
required: true,
|
||||
@ -653,14 +654,14 @@ class LoginPage extends React.Component {
|
||||
} else if (signinItem.name === "Password") {
|
||||
return (
|
||||
<div>
|
||||
<div dangerouslySetInnerHTML={{__html: ("<style>" + signinItem.label?.replaceAll("<style>", "").replaceAll("</style>", "") + "</style>")}} />
|
||||
{this.renderPasswordOrCodeInput()}
|
||||
<div dangerouslySetInnerHTML={{__html: ("<style>" + signinItem.customCss?.replaceAll("<style>", "").replaceAll("</style>", "") + "</style>")}} />
|
||||
{this.renderPasswordOrCodeInput(signinItem)}
|
||||
</div>
|
||||
);
|
||||
} else if (signinItem.name === "Forgot password?") {
|
||||
return (
|
||||
<div>
|
||||
<div dangerouslySetInnerHTML={{__html: ("<style>" + signinItem.label?.replaceAll("<style>", "").replaceAll("</style>", "") + "</style>")}} />
|
||||
<div dangerouslySetInnerHTML={{__html: ("<style>" + signinItem.customCss?.replaceAll("<style>", "").replaceAll("</style>", "") + "</style>")}} />
|
||||
<div className="login-forget-password">
|
||||
<Form.Item name="autoSignin" valuePropName="checked" noStyle>
|
||||
<Checkbox style={{float: "left"}}>
|
||||
@ -668,7 +669,7 @@ class LoginPage extends React.Component {
|
||||
</Checkbox>
|
||||
</Form.Item>
|
||||
{
|
||||
signinItem.visible ? Setting.renderForgetLink(application, i18next.t("login:Forgot password?")) : null
|
||||
signinItem.visible ? Setting.renderForgetLink(application, signinItem.label ? signinItem.label : i18next.t("login:Forgot password?")) : null
|
||||
}
|
||||
</div>
|
||||
</div>
|
||||
@ -678,7 +679,7 @@ class LoginPage extends React.Component {
|
||||
} else if (signinItem.name === "Login button") {
|
||||
return (
|
||||
<Form.Item className="login-button-box">
|
||||
<div dangerouslySetInnerHTML={{__html: ("<style>" + signinItem.label?.replaceAll("<style>", "").replaceAll("</style>", "") + "</style>")}} />
|
||||
<div dangerouslySetInnerHTML={{__html: ("<style>" + signinItem.customCss?.replaceAll("<style>", "").replaceAll("</style>", "") + "</style>")}} />
|
||||
<Button
|
||||
type="primary"
|
||||
htmlType="submit"
|
||||
@ -687,7 +688,7 @@ class LoginPage extends React.Component {
|
||||
{
|
||||
this.state.loginMethod === "webAuthn" ? i18next.t("login:Sign in with WebAuthn") :
|
||||
this.state.loginMethod === "faceId" ? i18next.t("login:Sign in with Face ID") :
|
||||
i18next.t("login:Sign In")
|
||||
signinItem.label ? signinItem.label : i18next.t("login:Sign In")
|
||||
}
|
||||
</Button>
|
||||
{
|
||||
@ -722,7 +723,7 @@ class LoginPage extends React.Component {
|
||||
|
||||
return (
|
||||
<div>
|
||||
<div dangerouslySetInnerHTML={{__html: ("<style>" + signinItem.label?.replaceAll("<style>", "").replaceAll("</style>", "") + "</style>")}} />
|
||||
<div dangerouslySetInnerHTML={{__html: ("<style>" + signinItem.customCss?.replaceAll("<style>", "").replaceAll("</style>", "") + "</style>")}} />
|
||||
<Form.Item>
|
||||
{
|
||||
application.providers.filter(providerItem => this.isProviderVisible(providerItem)).map(providerItem => {
|
||||
@ -737,13 +738,13 @@ class LoginPage extends React.Component {
|
||||
);
|
||||
} else if (signinItem.name.startsWith("Text ") || signinItem?.isCustom) {
|
||||
return (
|
||||
<div dangerouslySetInnerHTML={{__html: signinItem.label}} />
|
||||
<div dangerouslySetInnerHTML={{__html: signinItem.customCss}} />
|
||||
);
|
||||
} else if (signinItem.name === "Signup link") {
|
||||
return (
|
||||
<div style={{width: "100%"}} className="login-signup-link">
|
||||
<div dangerouslySetInnerHTML={{__html: ("<style>" + signinItem.label?.replaceAll("<style>", "").replaceAll("</style>", "") + "</style>")}} />
|
||||
{this.renderFooter(application)}
|
||||
<div dangerouslySetInnerHTML={{__html: ("<style>" + signinItem.customCss?.replaceAll("<style>", "").replaceAll("</style>", "") + "</style>")}} />
|
||||
{this.renderFooter(application, signinItem)}
|
||||
</div>
|
||||
);
|
||||
}
|
||||
@ -896,17 +897,20 @@ class LoginPage extends React.Component {
|
||||
/>;
|
||||
}
|
||||
|
||||
renderFooter(application) {
|
||||
renderFooter(application, signinItem) {
|
||||
return (
|
||||
<div>
|
||||
{
|
||||
!application.enableSignUp ? null : (
|
||||
<React.Fragment>
|
||||
{i18next.t("login:No account?")}
|
||||
{
|
||||
Setting.renderSignupLink(application, i18next.t("login:sign up now"))
|
||||
}
|
||||
</React.Fragment>
|
||||
signinItem.label ? Setting.renderSignupLink(application, signinItem.label) :
|
||||
(
|
||||
<React.Fragment>
|
||||
{i18next.t("login:No account?")}
|
||||
{
|
||||
Setting.renderSignupLink(application, i18next.t("login:sign up now"))
|
||||
}
|
||||
</React.Fragment>
|
||||
)
|
||||
)
|
||||
}
|
||||
</div>
|
||||
@ -1022,7 +1026,7 @@ class LoginPage extends React.Component {
|
||||
});
|
||||
}
|
||||
|
||||
renderPasswordOrCodeInput() {
|
||||
renderPasswordOrCodeInput(signinItem) {
|
||||
const application = this.getApplicationObj();
|
||||
if (this.state.loginMethod === "password" || this.state.loginMethod === "ldap") {
|
||||
return (
|
||||
@ -1031,6 +1035,7 @@ class LoginPage extends React.Component {
|
||||
<Form.Item
|
||||
name="password"
|
||||
className="login-password"
|
||||
label={signinItem.label ? signinItem.label : null}
|
||||
rules={[{required: true, message: i18next.t("login:Please input your password!")}]}
|
||||
>
|
||||
<Input.Password
|
||||
|
@ -389,6 +389,14 @@ class SignupPage extends React.Component {
|
||||
return Promise.reject(i18next.t("signup:The input is not valid Email!"));
|
||||
}
|
||||
|
||||
if (signupItem.regex) {
|
||||
const reg = new RegExp(signupItem.regex);
|
||||
if (!reg.test(this.state.email)) {
|
||||
this.setState({validEmail: false});
|
||||
return Promise.reject(i18next.t("signup:The input Email doesn't match the signup item regex!"));
|
||||
}
|
||||
}
|
||||
|
||||
this.setState({validEmail: true});
|
||||
return Promise.resolve();
|
||||
},
|
||||
|
@ -897,7 +897,8 @@
|
||||
"record": {
|
||||
"Is triggered": "Is triggered",
|
||||
"Object": "Object",
|
||||
"Response": "Response"
|
||||
"Response": "Response",
|
||||
"Status code": "Status code"
|
||||
},
|
||||
"resource": {
|
||||
"Copy Link": "Copy Link",
|
||||
@ -1171,6 +1172,7 @@
|
||||
"input password": "input password"
|
||||
},
|
||||
"verification": {
|
||||
"Is used": "Is used",
|
||||
"Receiver": "Receiver"
|
||||
},
|
||||
"webhook": {
|
||||
|
@ -897,7 +897,8 @@
|
||||
"record": {
|
||||
"Is triggered": "Is triggered",
|
||||
"Object": "Object",
|
||||
"Response": "Response"
|
||||
"Response": "Response",
|
||||
"Status code": "Status code"
|
||||
},
|
||||
"resource": {
|
||||
"Copy Link": "Kopiere den Link",
|
||||
@ -1171,6 +1172,7 @@
|
||||
"input password": "Eingabe des Passworts"
|
||||
},
|
||||
"verification": {
|
||||
"Is used": "Is used",
|
||||
"Receiver": "Receiver"
|
||||
},
|
||||
"webhook": {
|
||||
|
@ -897,7 +897,8 @@
|
||||
"record": {
|
||||
"Is triggered": "Is triggered",
|
||||
"Object": "Object",
|
||||
"Response": "Response"
|
||||
"Response": "Response",
|
||||
"Status code": "Status code"
|
||||
},
|
||||
"resource": {
|
||||
"Copy Link": "Copy Link",
|
||||
@ -1171,6 +1172,7 @@
|
||||
"input password": "input password"
|
||||
},
|
||||
"verification": {
|
||||
"Is used": "Is used",
|
||||
"Receiver": "Receiver"
|
||||
},
|
||||
"webhook": {
|
||||
|
@ -897,7 +897,8 @@
|
||||
"record": {
|
||||
"Is triggered": "Is triggered",
|
||||
"Object": "Object",
|
||||
"Response": "Response"
|
||||
"Response": "Response",
|
||||
"Status code": "Status code"
|
||||
},
|
||||
"resource": {
|
||||
"Copy Link": "Copiar enlace",
|
||||
@ -1171,6 +1172,7 @@
|
||||
"input password": "Ingresar contraseña"
|
||||
},
|
||||
"verification": {
|
||||
"Is used": "Is used",
|
||||
"Receiver": "Receiver"
|
||||
},
|
||||
"webhook": {
|
||||
|
@ -897,7 +897,8 @@
|
||||
"record": {
|
||||
"Is triggered": "Is triggered",
|
||||
"Object": "Object",
|
||||
"Response": "Response"
|
||||
"Response": "Response",
|
||||
"Status code": "Status code"
|
||||
},
|
||||
"resource": {
|
||||
"Copy Link": "Copy Link",
|
||||
@ -1171,6 +1172,7 @@
|
||||
"input password": "input password"
|
||||
},
|
||||
"verification": {
|
||||
"Is used": "Is used",
|
||||
"Receiver": "Receiver"
|
||||
},
|
||||
"webhook": {
|
||||
|
@ -897,7 +897,8 @@
|
||||
"record": {
|
||||
"Is triggered": "Is triggered",
|
||||
"Object": "Object",
|
||||
"Response": "Response"
|
||||
"Response": "Response",
|
||||
"Status code": "Status code"
|
||||
},
|
||||
"resource": {
|
||||
"Copy Link": "Copy Link",
|
||||
@ -1171,6 +1172,7 @@
|
||||
"input password": "input password"
|
||||
},
|
||||
"verification": {
|
||||
"Is used": "Is used",
|
||||
"Receiver": "Receiver"
|
||||
},
|
||||
"webhook": {
|
||||
|
@ -897,7 +897,8 @@
|
||||
"record": {
|
||||
"Is triggered": "Is triggered",
|
||||
"Object": "Object",
|
||||
"Response": "Response"
|
||||
"Response": "Response",
|
||||
"Status code": "Status code"
|
||||
},
|
||||
"resource": {
|
||||
"Copy Link": "Copier le lien",
|
||||
@ -1171,6 +1172,7 @@
|
||||
"input password": "saisir le mot de passe"
|
||||
},
|
||||
"verification": {
|
||||
"Is used": "Is used",
|
||||
"Receiver": "Receiver"
|
||||
},
|
||||
"webhook": {
|
||||
|
@ -897,7 +897,8 @@
|
||||
"record": {
|
||||
"Is triggered": "Is triggered",
|
||||
"Object": "Object",
|
||||
"Response": "Response"
|
||||
"Response": "Response",
|
||||
"Status code": "Status code"
|
||||
},
|
||||
"resource": {
|
||||
"Copy Link": "Copy Link",
|
||||
@ -1171,6 +1172,7 @@
|
||||
"input password": "input password"
|
||||
},
|
||||
"verification": {
|
||||
"Is used": "Is used",
|
||||
"Receiver": "Receiver"
|
||||
},
|
||||
"webhook": {
|
||||
|
@ -897,7 +897,8 @@
|
||||
"record": {
|
||||
"Is triggered": "Is triggered",
|
||||
"Object": "Object",
|
||||
"Response": "Response"
|
||||
"Response": "Response",
|
||||
"Status code": "Status code"
|
||||
},
|
||||
"resource": {
|
||||
"Copy Link": "Salin Tautan",
|
||||
@ -1171,6 +1172,7 @@
|
||||
"input password": "masukkan kata sandi"
|
||||
},
|
||||
"verification": {
|
||||
"Is used": "Is used",
|
||||
"Receiver": "Receiver"
|
||||
},
|
||||
"webhook": {
|
||||
|
@ -897,7 +897,8 @@
|
||||
"record": {
|
||||
"Is triggered": "Is triggered",
|
||||
"Object": "Object",
|
||||
"Response": "Response"
|
||||
"Response": "Response",
|
||||
"Status code": "Status code"
|
||||
},
|
||||
"resource": {
|
||||
"Copy Link": "Copy Link",
|
||||
@ -1171,6 +1172,7 @@
|
||||
"input password": "input password"
|
||||
},
|
||||
"verification": {
|
||||
"Is used": "Is used",
|
||||
"Receiver": "Receiver"
|
||||
},
|
||||
"webhook": {
|
||||
|
@ -897,7 +897,8 @@
|
||||
"record": {
|
||||
"Is triggered": "Is triggered",
|
||||
"Object": "Object",
|
||||
"Response": "Response"
|
||||
"Response": "Response",
|
||||
"Status code": "Status code"
|
||||
},
|
||||
"resource": {
|
||||
"Copy Link": "コピー リンク",
|
||||
@ -1171,6 +1172,7 @@
|
||||
"input password": "パスワードを入力してください"
|
||||
},
|
||||
"verification": {
|
||||
"Is used": "Is used",
|
||||
"Receiver": "Receiver"
|
||||
},
|
||||
"webhook": {
|
||||
|
@ -897,7 +897,8 @@
|
||||
"record": {
|
||||
"Is triggered": "Is triggered",
|
||||
"Object": "Object",
|
||||
"Response": "Response"
|
||||
"Response": "Response",
|
||||
"Status code": "Status code"
|
||||
},
|
||||
"resource": {
|
||||
"Copy Link": "Copy Link",
|
||||
@ -1171,6 +1172,7 @@
|
||||
"input password": "input password"
|
||||
},
|
||||
"verification": {
|
||||
"Is used": "Is used",
|
||||
"Receiver": "Receiver"
|
||||
},
|
||||
"webhook": {
|
||||
|
@ -897,7 +897,8 @@
|
||||
"record": {
|
||||
"Is triggered": "Is triggered",
|
||||
"Object": "Object",
|
||||
"Response": "Response"
|
||||
"Response": "Response",
|
||||
"Status code": "Status code"
|
||||
},
|
||||
"resource": {
|
||||
"Copy Link": "링크 복사하기",
|
||||
@ -1171,6 +1172,7 @@
|
||||
"input password": "비밀번호를 입력해주세요"
|
||||
},
|
||||
"verification": {
|
||||
"Is used": "Is used",
|
||||
"Receiver": "Receiver"
|
||||
},
|
||||
"webhook": {
|
||||
|
@ -897,7 +897,8 @@
|
||||
"record": {
|
||||
"Is triggered": "Is triggered",
|
||||
"Object": "Object",
|
||||
"Response": "Response"
|
||||
"Response": "Response",
|
||||
"Status code": "Status code"
|
||||
},
|
||||
"resource": {
|
||||
"Copy Link": "Copy Link",
|
||||
@ -1171,6 +1172,7 @@
|
||||
"input password": "input password"
|
||||
},
|
||||
"verification": {
|
||||
"Is used": "Is used",
|
||||
"Receiver": "Receiver"
|
||||
},
|
||||
"webhook": {
|
||||
|
@ -897,7 +897,8 @@
|
||||
"record": {
|
||||
"Is triggered": "Is triggered",
|
||||
"Object": "Object",
|
||||
"Response": "Response"
|
||||
"Response": "Response",
|
||||
"Status code": "Status code"
|
||||
},
|
||||
"resource": {
|
||||
"Copy Link": "Copy Link",
|
||||
@ -1171,6 +1172,7 @@
|
||||
"input password": "input password"
|
||||
},
|
||||
"verification": {
|
||||
"Is used": "Is used",
|
||||
"Receiver": "Receiver"
|
||||
},
|
||||
"webhook": {
|
||||
|
@ -897,7 +897,8 @@
|
||||
"record": {
|
||||
"Is triggered": "Is triggered",
|
||||
"Object": "Object",
|
||||
"Response": "Response"
|
||||
"Response": "Response",
|
||||
"Status code": "Status code"
|
||||
},
|
||||
"resource": {
|
||||
"Copy Link": "Copy Link",
|
||||
@ -1171,6 +1172,7 @@
|
||||
"input password": "input password"
|
||||
},
|
||||
"verification": {
|
||||
"Is used": "Is used",
|
||||
"Receiver": "Receiver"
|
||||
},
|
||||
"webhook": {
|
||||
|
@ -897,7 +897,8 @@
|
||||
"record": {
|
||||
"Is triggered": "Is triggered",
|
||||
"Object": "Object",
|
||||
"Response": "Response"
|
||||
"Response": "Response",
|
||||
"Status code": "Status code"
|
||||
},
|
||||
"resource": {
|
||||
"Copy Link": "Copiar Link",
|
||||
@ -1171,6 +1172,7 @@
|
||||
"input password": "Digite a senha"
|
||||
},
|
||||
"verification": {
|
||||
"Is used": "Is used",
|
||||
"Receiver": "Receiver"
|
||||
},
|
||||
"webhook": {
|
||||
|
@ -897,7 +897,8 @@
|
||||
"record": {
|
||||
"Is triggered": "Is triggered",
|
||||
"Object": "Object",
|
||||
"Response": "Response"
|
||||
"Response": "Response",
|
||||
"Status code": "Status code"
|
||||
},
|
||||
"resource": {
|
||||
"Copy Link": "Копировать ссылку",
|
||||
@ -1171,6 +1172,7 @@
|
||||
"input password": "введите пароль"
|
||||
},
|
||||
"verification": {
|
||||
"Is used": "Is used",
|
||||
"Receiver": "Receiver"
|
||||
},
|
||||
"webhook": {
|
||||
|
@ -897,7 +897,8 @@
|
||||
"record": {
|
||||
"Is triggered": "Is triggered",
|
||||
"Object": "Object",
|
||||
"Response": "Response"
|
||||
"Response": "Response",
|
||||
"Status code": "Status code"
|
||||
},
|
||||
"resource": {
|
||||
"Copy Link": "Copy Link",
|
||||
@ -1171,6 +1172,7 @@
|
||||
"input password": "input password"
|
||||
},
|
||||
"verification": {
|
||||
"Is used": "Is used",
|
||||
"Receiver": "Receiver"
|
||||
},
|
||||
"webhook": {
|
||||
|
@ -897,7 +897,8 @@
|
||||
"record": {
|
||||
"Is triggered": "Is triggered",
|
||||
"Object": "Object",
|
||||
"Response": "Response"
|
||||
"Response": "Response",
|
||||
"Status code": "Status code"
|
||||
},
|
||||
"resource": {
|
||||
"Copy Link": "Copy Link",
|
||||
@ -1171,6 +1172,7 @@
|
||||
"input password": "şifreyi girin"
|
||||
},
|
||||
"verification": {
|
||||
"Is used": "Is used",
|
||||
"Receiver": "Receiver"
|
||||
},
|
||||
"webhook": {
|
||||
|
@ -80,6 +80,7 @@
|
||||
"Only signup": "Тільки реєстрація",
|
||||
"Org choice mode": "Режим вибору організації",
|
||||
"Org choice mode - Tooltip": "Режим вибору організації – підказка",
|
||||
"Please enable \\\"Signin session\\\" first before enabling \\\"Auto signin\\\"": "Please enable \\\"Signin session\\\" first before enabling \\\"Auto signin\\\"",
|
||||
"Please input your application!": "Будь ласка, введіть свою заявку!",
|
||||
"Please input your organization!": "Будь ласка, введіть вашу організацію!",
|
||||
"Please select a HTML file": "Виберіть файл HTML",
|
||||
@ -229,6 +230,7 @@
|
||||
"Email": "Електронна пошта",
|
||||
"Email - Tooltip": "Дійсна електронна пошта",
|
||||
"Email only": "Лише електронна пошта",
|
||||
"Email or Phone": "Email or Phone",
|
||||
"Enable": "Увімкнути",
|
||||
"Enable dark logo": "Увімкнути темний логотип",
|
||||
"Enable dark logo - Tooltip": "Увімкнути темний логотип",
|
||||
@ -311,6 +313,7 @@
|
||||
"Phone": "Телефон",
|
||||
"Phone - Tooltip": "Номер телефону",
|
||||
"Phone only": "Тільки телефон",
|
||||
"Phone or Email": "Phone or Email",
|
||||
"Plan": "План",
|
||||
"Plan - Tooltip": "План – підказка",
|
||||
"Plans": "Плани",
|
||||
@ -391,6 +394,7 @@
|
||||
"User type": "Тип користувача",
|
||||
"User type - Tooltip": "Теги, до яких належить користувач, за умовчанням \"звичайний користувач\"",
|
||||
"Users": "Користувачі",
|
||||
"Users - Tooltip": "Users - Tooltip",
|
||||
"Users under all organizations": "Користувачі в усіх організаціях",
|
||||
"Verifications": "Перевірки",
|
||||
"Webhooks": "Веб-хуки",
|
||||
@ -473,7 +477,6 @@
|
||||
"LDAP username, Email or phone": "Ім’я користувача LDAP, електронна пошта або телефон",
|
||||
"Loading": "Завантаження",
|
||||
"Logging out...": "Вихід...",
|
||||
"Login button": "Кнопка входу",
|
||||
"MetaMask plugin not detected": "Плагін MetaMask не виявлено",
|
||||
"Model loading failure": "Помилка завантаження моделі",
|
||||
"No account?": "Немає облікового запису?",
|
||||
@ -498,6 +501,7 @@
|
||||
"Sign in with Face ID": "Увійдіть за допомогою Face ID",
|
||||
"Sign in with WebAuthn": "Увійдіть за допомогою WebAuthn",
|
||||
"Sign in with {type}": "Увійдіть за допомогою {type}",
|
||||
"Signin button": "Signin button",
|
||||
"Signing in...": "Вхід...",
|
||||
"Successfully logged in with WebAuthn credentials": "Успішно ввійшли за допомогою облікових даних WebAuthn",
|
||||
"The camera is currently in use by another webpage": "Камера зараз використовується іншою веб-сторінкою",
|
||||
@ -893,7 +897,8 @@
|
||||
"record": {
|
||||
"Is triggered": "Спрацьовує",
|
||||
"Object": "Об'єкт",
|
||||
"Response": "Відповідь"
|
||||
"Response": "Відповідь",
|
||||
"Status code": "Status code"
|
||||
},
|
||||
"resource": {
|
||||
"Copy Link": "Копіювати посилання",
|
||||
@ -941,6 +946,7 @@
|
||||
"Please select your country code!": "Виберіть код країни!",
|
||||
"Please select your country/region!": "Виберіть свою країну/регіон!",
|
||||
"Regex": "Регулярний вираз",
|
||||
"Signup button": "Signup button",
|
||||
"Terms of Use": "Умови використання",
|
||||
"Terms of Use - Tooltip": "Умови використання, з якими користувачі повинні ознайомитися та погодитися під час реєстрації",
|
||||
"Text 1": "Текст 1",
|
||||
@ -1162,9 +1168,11 @@
|
||||
"Values": "Цінності",
|
||||
"Verification code sent": "Код підтвердження надіслано",
|
||||
"WebAuthn credentials": "Облікові дані WebAuthn",
|
||||
"You have changed the username, please save your change first before modifying the password": "You have changed the username, please save your change first before modifying the password",
|
||||
"input password": "введіть пароль"
|
||||
},
|
||||
"verification": {
|
||||
"Is used": "Is used",
|
||||
"Receiver": "Приймач"
|
||||
},
|
||||
"webhook": {
|
||||
|
@ -897,7 +897,8 @@
|
||||
"record": {
|
||||
"Is triggered": "Is triggered",
|
||||
"Object": "Object",
|
||||
"Response": "Response"
|
||||
"Response": "Response",
|
||||
"Status code": "Status code"
|
||||
},
|
||||
"resource": {
|
||||
"Copy Link": "Sao chép liên kết",
|
||||
@ -1171,6 +1172,7 @@
|
||||
"input password": "Nhập mật khẩu"
|
||||
},
|
||||
"verification": {
|
||||
"Is used": "Is used",
|
||||
"Receiver": "Receiver"
|
||||
},
|
||||
"webhook": {
|
||||
|
@ -897,7 +897,8 @@
|
||||
"record": {
|
||||
"Is triggered": "是否触发",
|
||||
"Object": "实体",
|
||||
"Response": "响应"
|
||||
"Response": "响应",
|
||||
"Status code": "状态码"
|
||||
},
|
||||
"resource": {
|
||||
"Copy Link": "复制链接",
|
||||
@ -1171,6 +1172,7 @@
|
||||
"input password": "输入密码"
|
||||
},
|
||||
"verification": {
|
||||
"Is used": "已使用",
|
||||
"Receiver": "接收者"
|
||||
},
|
||||
"webhook": {
|
||||
|
@ -134,7 +134,7 @@ class SigninTable extends React.Component {
|
||||
value={getItemDisplayName(text)}
|
||||
onChange={value => {
|
||||
this.updateField(table, index, "name", value);
|
||||
this.updateField(table, index, "label", SigninTableDefaultCssMap[value]);
|
||||
this.updateField(table, index, "customCss", SigninTableDefaultCssMap[value]);
|
||||
}} >
|
||||
{
|
||||
Setting.getDeduplicatedArray(items, table, "name").map((item, index) => <Option key={index} value={item.name}>{item.displayName}</Option>)
|
||||
@ -166,7 +166,7 @@ class SigninTable extends React.Component {
|
||||
},
|
||||
},
|
||||
{
|
||||
title: i18next.t("signup:Label HTML"),
|
||||
title: i18next.t("signup:Label"),
|
||||
dataIndex: "label",
|
||||
key: "label",
|
||||
width: "200px",
|
||||
@ -188,14 +188,18 @@ class SigninTable extends React.Component {
|
||||
}} />
|
||||
</Popover>
|
||||
);
|
||||
} else if (["Username", "Password", "Signup link", "Forgot password?", "Login button"].includes(record.name)) {
|
||||
return <Input value={text} style={{marginBottom: "10px"}} onChange={e => {
|
||||
this.updateField(table, index, "label", e.target.value);
|
||||
}} />;
|
||||
}
|
||||
return null;
|
||||
},
|
||||
},
|
||||
{
|
||||
title: i18next.t("application:Custom CSS"),
|
||||
dataIndex: "label",
|
||||
key: "label",
|
||||
dataIndex: "customCss",
|
||||
key: "customCss",
|
||||
width: "200px",
|
||||
render: (text, record, index) => {
|
||||
if (!record.name.startsWith("Text ") && !record?.isCustom) {
|
||||
@ -205,13 +209,13 @@ class SigninTable extends React.Component {
|
||||
<CodeMirror value={text?.replaceAll("<style>", "").replaceAll("</style>", "")}
|
||||
options={{mode: "css", theme: "material-darker"}}
|
||||
onBeforeChange={(editor, data, value) => {
|
||||
this.updateField(table, index, "label", value);
|
||||
this.updateField(table, index, "customCss", value);
|
||||
}}
|
||||
/>
|
||||
</div>
|
||||
} title={i18next.t("application:CSS style")} trigger="click">
|
||||
<Input value={text?.replaceAll("<style>", "").replaceAll("</style>", "")} onChange={e => {
|
||||
this.updateField(table, index, "label", e.target.value);
|
||||
this.updateField(table, index, "customCss", e.target.value);
|
||||
}} />
|
||||
</Popover>
|
||||
);
|
||||
|
Reference in New Issue
Block a user