mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-02 03:00:18 +08:00
feat: implement the enforcement for new invitation page (#2628)
Added new invitation code implementation
This commit is contained in:
@ -183,6 +183,8 @@ type User struct {
|
||||
MfaPhoneEnabled bool `json:"mfaPhoneEnabled"`
|
||||
MfaEmailEnabled bool `json:"mfaEmailEnabled"`
|
||||
MultiFactorAuths []*MfaProps `xorm:"-" json:"multiFactorAuths,omitempty"`
|
||||
Invitation string `xorm:"varchar(100) index" json:"invitation"`
|
||||
InvitationCode string `xorm:"varchar(100) index" json:"invitationCode"`
|
||||
|
||||
Ldap string `xorm:"ldap varchar(100)" json:"ldap"`
|
||||
Properties map[string]string `json:"properties"`
|
||||
@ -496,6 +498,24 @@ func GetUserByUserIdOnly(userId string) (*User, error) {
|
||||
}
|
||||
}
|
||||
|
||||
func GetUserByInvitationCode(owner string, invitationCode string) (*User, error) {
|
||||
if owner == "" || invitationCode == "" {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
user := User{Owner: owner, InvitationCode: invitationCode}
|
||||
existed, err := ormer.Engine.Get(&user)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
if existed {
|
||||
return &user, nil
|
||||
} else {
|
||||
return nil, nil
|
||||
}
|
||||
}
|
||||
|
||||
func GetUserByAccessKey(accessKey string) (*User, error) {
|
||||
if accessKey == "" {
|
||||
return nil, nil
|
||||
|
Reference in New Issue
Block a user