mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-16 04:43:50 +08:00
Compare commits
2 Commits
Author | SHA1 | Date | |
---|---|---|---|
4f124ff140 | |||
d5f802ec7d |
@ -38,6 +38,7 @@ type RequestForm struct {
|
|||||||
Email string `json:"email"`
|
Email string `json:"email"`
|
||||||
Phone string `json:"phone"`
|
Phone string `json:"phone"`
|
||||||
Affiliation string `json:"affiliation"`
|
Affiliation string `json:"affiliation"`
|
||||||
|
IdCard string `json:"idCard"`
|
||||||
Region string `json:"region"`
|
Region string `json:"region"`
|
||||||
|
|
||||||
Application string `json:"application"`
|
Application string `json:"application"`
|
||||||
@ -151,6 +152,7 @@ func (c *ApiController) Signup() {
|
|||||||
Phone: form.Phone,
|
Phone: form.Phone,
|
||||||
Address: []string{},
|
Address: []string{},
|
||||||
Affiliation: form.Affiliation,
|
Affiliation: form.Affiliation,
|
||||||
|
IdCard: form.IdCard,
|
||||||
Region: form.Region,
|
Region: form.Region,
|
||||||
Score: getInitScore(),
|
Score: getInitScore(),
|
||||||
IsAdmin: false,
|
IsAdmin: false,
|
||||||
|
@ -46,11 +46,12 @@ type Token struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type TokenWrapper struct {
|
type TokenWrapper struct {
|
||||||
AccessToken string `json:"access_token"`
|
AccessToken string `json:"access_token"`
|
||||||
IdToken string `json:"id_token"`
|
IdToken string `json:"id_token"`
|
||||||
TokenType string `json:"token_type"`
|
RefreshToken string `json:"refresh_token"`
|
||||||
ExpiresIn int `json:"expires_in"`
|
TokenType string `json:"token_type"`
|
||||||
Scope string `json:"scope"`
|
ExpiresIn int `json:"expires_in"`
|
||||||
|
Scope string `json:"scope"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetTokenCount(owner, field, value string) int {
|
func GetTokenCount(owner, field, value string) int {
|
||||||
@ -190,6 +191,12 @@ func GetOAuthCode(userId string, clientId string, responseType string, redirectU
|
|||||||
Code: "",
|
Code: "",
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if user.IsForbidden {
|
||||||
|
return &Code{
|
||||||
|
Message: "error: the user is forbidden to sign in, please contact the administrator",
|
||||||
|
Code: "",
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
msg, application := CheckOAuthLogin(clientId, responseType, redirectUri, scope, state)
|
msg, application := CheckOAuthLogin(clientId, responseType, redirectUri, scope, state)
|
||||||
if msg != "" {
|
if msg != "" {
|
||||||
@ -284,11 +291,12 @@ func GetOAuthToken(grantType string, clientId string, clientSecret string, code
|
|||||||
}
|
}
|
||||||
|
|
||||||
tokenWrapper := &TokenWrapper{
|
tokenWrapper := &TokenWrapper{
|
||||||
AccessToken: token.AccessToken,
|
AccessToken: token.AccessToken,
|
||||||
IdToken: token.AccessToken,
|
IdToken: token.AccessToken,
|
||||||
TokenType: token.TokenType,
|
RefreshToken: token.RefreshToken,
|
||||||
ExpiresIn: token.ExpiresIn,
|
TokenType: token.TokenType,
|
||||||
Scope: token.Scope,
|
ExpiresIn: token.ExpiresIn,
|
||||||
|
Scope: token.Scope,
|
||||||
}
|
}
|
||||||
|
|
||||||
return tokenWrapper
|
return tokenWrapper
|
||||||
@ -339,6 +347,12 @@ func RefreshToken(grantType string, refreshToken string, scope string, clientId
|
|||||||
}
|
}
|
||||||
// generate a new token
|
// generate a new token
|
||||||
user := getUser(application.Owner, token.User)
|
user := getUser(application.Owner, token.User)
|
||||||
|
if user.IsForbidden {
|
||||||
|
return &Code{
|
||||||
|
Message: "error: the user is forbidden to sign in, please contact the administrator",
|
||||||
|
Code: "",
|
||||||
|
}
|
||||||
|
}
|
||||||
newAccessToken, newRefreshToken, err := generateJwtToken(application, user, "")
|
newAccessToken, newRefreshToken, err := generateJwtToken(application, user, "")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
|
@ -74,6 +74,7 @@ class SignupTable extends React.Component {
|
|||||||
{id: 'Display name', name: 'Display name'},
|
{id: 'Display name', name: 'Display name'},
|
||||||
{id: 'Affiliation', name: 'Affiliation'},
|
{id: 'Affiliation', name: 'Affiliation'},
|
||||||
{id: 'Country/Region', name: 'Country/Region'},
|
{id: 'Country/Region', name: 'Country/Region'},
|
||||||
|
{id: 'ID card', name: 'ID card'},
|
||||||
{id: 'Email', name: 'Email'},
|
{id: 'Email', name: 'Email'},
|
||||||
{id: 'Password', name: 'Password'},
|
{id: 'Password', name: 'Password'},
|
||||||
{id: 'Confirm password', name: 'Confirm password'},
|
{id: 'Confirm password', name: 'Confirm password'},
|
||||||
|
@ -225,6 +225,28 @@ class SignupPage extends React.Component {
|
|||||||
<Input />
|
<Input />
|
||||||
</Form.Item>
|
</Form.Item>
|
||||||
)
|
)
|
||||||
|
} else if (signupItem.name === "ID card") {
|
||||||
|
return (
|
||||||
|
<Form.Item
|
||||||
|
name="idCard"
|
||||||
|
key="idCard"
|
||||||
|
label={i18next.t("user:ID card")}
|
||||||
|
rules={[
|
||||||
|
{
|
||||||
|
required: required,
|
||||||
|
message: i18next.t("signup:Please input your ID card number!"),
|
||||||
|
whitespace: true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
required: required,
|
||||||
|
pattern: new RegExp(/^[1-9]\d{5}(18|19|20)\d{2}((0[1-9])|(10|11|12))(([0-2][1-9])|10|20|30|31)\d{3}[0-9X]$/, "g"),
|
||||||
|
message: i18next.t("signup:Please input the correct ID card number!"),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
>
|
||||||
|
<Input />
|
||||||
|
</Form.Item>
|
||||||
|
)
|
||||||
} else if (signupItem.name === "Country/Region") {
|
} else if (signupItem.name === "Country/Region") {
|
||||||
return (
|
return (
|
||||||
<Form.Item
|
<Form.Item
|
||||||
|
@ -309,7 +309,9 @@
|
|||||||
"Please accept the agreement!": "Please accept the agreement!",
|
"Please accept the agreement!": "Please accept the agreement!",
|
||||||
"Please click the below button to sign in": "Please click the below button to sign in",
|
"Please click the below button to sign in": "Please click the below button to sign in",
|
||||||
"Please confirm your password!": "Please confirm your password!",
|
"Please confirm your password!": "Please confirm your password!",
|
||||||
|
"Please input the correct ID card number!": "Please input the correct ID card number!",
|
||||||
"Please input your Email!": "Please input your Email!",
|
"Please input your Email!": "Please input your Email!",
|
||||||
|
"Please input your ID card number!": "Please input your ID card number!",
|
||||||
"Please input your address!": "Please input your address!",
|
"Please input your address!": "Please input your address!",
|
||||||
"Please input your affiliation!": "Please input your affiliation!",
|
"Please input your affiliation!": "Please input your affiliation!",
|
||||||
"Please input your display name!": "Please input your display name!",
|
"Please input your display name!": "Please input your display name!",
|
||||||
@ -375,6 +377,7 @@
|
|||||||
"Empty input!": "Empty input!",
|
"Empty input!": "Empty input!",
|
||||||
"Homepage": "Homepage",
|
"Homepage": "Homepage",
|
||||||
"Homepage - Tooltip": "Homepage - Tooltip",
|
"Homepage - Tooltip": "Homepage - Tooltip",
|
||||||
|
"ID card": "ID card",
|
||||||
"Input your email": "Input your email",
|
"Input your email": "Input your email",
|
||||||
"Input your phone number": "Input your phone number",
|
"Input your phone number": "Input your phone number",
|
||||||
"Is admin": "Is admin",
|
"Is admin": "Is admin",
|
||||||
|
@ -309,7 +309,9 @@
|
|||||||
"Please accept the agreement!": "Please accept the agreement!",
|
"Please accept the agreement!": "Please accept the agreement!",
|
||||||
"Please click the below button to sign in": "Please click the below button to sign in",
|
"Please click the below button to sign in": "Please click the below button to sign in",
|
||||||
"Please confirm your password!": "Please confirm your password!",
|
"Please confirm your password!": "Please confirm your password!",
|
||||||
|
"Please input the correct ID card number!": "Please input the correct ID card number!",
|
||||||
"Please input your Email!": "Please input your Email!",
|
"Please input your Email!": "Please input your Email!",
|
||||||
|
"Please input your ID card number!": "Please input your ID card number!",
|
||||||
"Please input your address!": "Please input your address!",
|
"Please input your address!": "Please input your address!",
|
||||||
"Please input your affiliation!": "Please input your affiliation!",
|
"Please input your affiliation!": "Please input your affiliation!",
|
||||||
"Please input your display name!": "Please input your display name!",
|
"Please input your display name!": "Please input your display name!",
|
||||||
@ -375,6 +377,7 @@
|
|||||||
"Empty input!": "Empty input!",
|
"Empty input!": "Empty input!",
|
||||||
"Homepage": "Homepage",
|
"Homepage": "Homepage",
|
||||||
"Homepage - Tooltip": "Homepage - Tooltip",
|
"Homepage - Tooltip": "Homepage - Tooltip",
|
||||||
|
"ID card": "ID card",
|
||||||
"Input your email": "Input your email",
|
"Input your email": "Input your email",
|
||||||
"Input your phone number": "Input your phone number",
|
"Input your phone number": "Input your phone number",
|
||||||
"Is admin": "Is admin",
|
"Is admin": "Is admin",
|
||||||
|
@ -309,7 +309,9 @@
|
|||||||
"Please accept the agreement!": "Please accept the agreement!",
|
"Please accept the agreement!": "Please accept the agreement!",
|
||||||
"Please click the below button to sign in": "Please click the below button to sign in",
|
"Please click the below button to sign in": "Please click the below button to sign in",
|
||||||
"Please confirm your password!": "Please confirm your password!",
|
"Please confirm your password!": "Please confirm your password!",
|
||||||
|
"Please input the correct ID card number!": "Please input the correct ID card number!",
|
||||||
"Please input your Email!": "Please input your Email!",
|
"Please input your Email!": "Please input your Email!",
|
||||||
|
"Please input your ID card number!": "Please input your ID card number!",
|
||||||
"Please input your address!": "Please input your address!",
|
"Please input your address!": "Please input your address!",
|
||||||
"Please input your affiliation!": "Please input your affiliation!",
|
"Please input your affiliation!": "Please input your affiliation!",
|
||||||
"Please input your display name!": "Please input your display name!",
|
"Please input your display name!": "Please input your display name!",
|
||||||
@ -375,6 +377,7 @@
|
|||||||
"Empty input!": "Empty input!",
|
"Empty input!": "Empty input!",
|
||||||
"Homepage": "Homepage",
|
"Homepage": "Homepage",
|
||||||
"Homepage - Tooltip": "Homepage - Tooltip",
|
"Homepage - Tooltip": "Homepage - Tooltip",
|
||||||
|
"ID card": "ID card",
|
||||||
"Input your email": "Input your email",
|
"Input your email": "Input your email",
|
||||||
"Input your phone number": "Input your phone number",
|
"Input your phone number": "Input your phone number",
|
||||||
"Is admin": "Is admin",
|
"Is admin": "Is admin",
|
||||||
|
@ -309,7 +309,9 @@
|
|||||||
"Please accept the agreement!": "Please accept the agreement!",
|
"Please accept the agreement!": "Please accept the agreement!",
|
||||||
"Please click the below button to sign in": "Please click the below button to sign in",
|
"Please click the below button to sign in": "Please click the below button to sign in",
|
||||||
"Please confirm your password!": "Please confirm your password!",
|
"Please confirm your password!": "Please confirm your password!",
|
||||||
|
"Please input the correct ID card number!": "Please input the correct ID card number!",
|
||||||
"Please input your Email!": "Please input your Email!",
|
"Please input your Email!": "Please input your Email!",
|
||||||
|
"Please input your ID card number!": "Please input your ID card number!",
|
||||||
"Please input your address!": "Please input your address!",
|
"Please input your address!": "Please input your address!",
|
||||||
"Please input your affiliation!": "Please input your affiliation!",
|
"Please input your affiliation!": "Please input your affiliation!",
|
||||||
"Please input your display name!": "Please input your display name!",
|
"Please input your display name!": "Please input your display name!",
|
||||||
@ -375,6 +377,7 @@
|
|||||||
"Empty input!": "Empty input!",
|
"Empty input!": "Empty input!",
|
||||||
"Homepage": "Homepage",
|
"Homepage": "Homepage",
|
||||||
"Homepage - Tooltip": "Homepage - Tooltip",
|
"Homepage - Tooltip": "Homepage - Tooltip",
|
||||||
|
"ID card": "ID card",
|
||||||
"Input your email": "Input your email",
|
"Input your email": "Input your email",
|
||||||
"Input your phone number": "Input your phone number",
|
"Input your phone number": "Input your phone number",
|
||||||
"Is admin": "Is admin",
|
"Is admin": "Is admin",
|
||||||
|
@ -309,7 +309,9 @@
|
|||||||
"Please accept the agreement!": "Please accept the agreement!",
|
"Please accept the agreement!": "Please accept the agreement!",
|
||||||
"Please click the below button to sign in": "Please click the below button to sign in",
|
"Please click the below button to sign in": "Please click the below button to sign in",
|
||||||
"Please confirm your password!": "Please confirm your password!",
|
"Please confirm your password!": "Please confirm your password!",
|
||||||
|
"Please input the correct ID card number!": "Please input the correct ID card number!",
|
||||||
"Please input your Email!": "Please input your Email!",
|
"Please input your Email!": "Please input your Email!",
|
||||||
|
"Please input your ID card number!": "Please input your ID card number!",
|
||||||
"Please input your address!": "Please input your address!",
|
"Please input your address!": "Please input your address!",
|
||||||
"Please input your affiliation!": "Please input your affiliation!",
|
"Please input your affiliation!": "Please input your affiliation!",
|
||||||
"Please input your display name!": "Please input your display name!",
|
"Please input your display name!": "Please input your display name!",
|
||||||
@ -375,6 +377,7 @@
|
|||||||
"Empty input!": "Empty input!",
|
"Empty input!": "Empty input!",
|
||||||
"Homepage": "Homepage",
|
"Homepage": "Homepage",
|
||||||
"Homepage - Tooltip": "Homepage - Tooltip",
|
"Homepage - Tooltip": "Homepage - Tooltip",
|
||||||
|
"ID card": "ID card",
|
||||||
"Input your email": "Input your email",
|
"Input your email": "Input your email",
|
||||||
"Input your phone number": "Input your phone number",
|
"Input your phone number": "Input your phone number",
|
||||||
"Is admin": "Is admin",
|
"Is admin": "Is admin",
|
||||||
|
@ -309,7 +309,9 @@
|
|||||||
"Please accept the agreement!": "Please accept the agreement!",
|
"Please accept the agreement!": "Please accept the agreement!",
|
||||||
"Please click the below button to sign in": "Please click the below button to sign in",
|
"Please click the below button to sign in": "Please click the below button to sign in",
|
||||||
"Please confirm your password!": "Please confirm your password!",
|
"Please confirm your password!": "Please confirm your password!",
|
||||||
|
"Please input the correct ID card number!": "Please input the correct ID card number!",
|
||||||
"Please input your Email!": "Please input your Email!",
|
"Please input your Email!": "Please input your Email!",
|
||||||
|
"Please input your ID card number!": "Please input your ID card number!",
|
||||||
"Please input your address!": "Please input your address!",
|
"Please input your address!": "Please input your address!",
|
||||||
"Please input your affiliation!": "Please input your affiliation!",
|
"Please input your affiliation!": "Please input your affiliation!",
|
||||||
"Please input your display name!": "Please input your display name!",
|
"Please input your display name!": "Please input your display name!",
|
||||||
@ -375,6 +377,7 @@
|
|||||||
"Empty input!": "Empty input!",
|
"Empty input!": "Empty input!",
|
||||||
"Homepage": "Homepage",
|
"Homepage": "Homepage",
|
||||||
"Homepage - Tooltip": "Homepage - Tooltip",
|
"Homepage - Tooltip": "Homepage - Tooltip",
|
||||||
|
"ID card": "ID card",
|
||||||
"Input your email": "Input your email",
|
"Input your email": "Input your email",
|
||||||
"Input your phone number": "Input your phone number",
|
"Input your phone number": "Input your phone number",
|
||||||
"Is admin": "Is admin",
|
"Is admin": "Is admin",
|
||||||
|
@ -309,7 +309,9 @@
|
|||||||
"Please accept the agreement!": "请先同意用户协议!",
|
"Please accept the agreement!": "请先同意用户协议!",
|
||||||
"Please click the below button to sign in": "请点击下方按钮登录",
|
"Please click the below button to sign in": "请点击下方按钮登录",
|
||||||
"Please confirm your password!": "请再次确认您的密码!",
|
"Please confirm your password!": "请再次确认您的密码!",
|
||||||
|
"Please input the correct ID card number!": "请输入正确的身份证号!",
|
||||||
"Please input your Email!": "请输入您的电子邮箱!",
|
"Please input your Email!": "请输入您的电子邮箱!",
|
||||||
|
"Please input your ID card number!": "请输入您的身份证号!",
|
||||||
"Please input your address!": "请输入您的地址!",
|
"Please input your address!": "请输入您的地址!",
|
||||||
"Please input your affiliation!": "请输入您所在的工作单位!",
|
"Please input your affiliation!": "请输入您所在的工作单位!",
|
||||||
"Please input your display name!": "请输入您的显示名称!",
|
"Please input your display name!": "请输入您的显示名称!",
|
||||||
@ -375,6 +377,7 @@
|
|||||||
"Empty input!": "输入为空!",
|
"Empty input!": "输入为空!",
|
||||||
"Homepage": "个人主页",
|
"Homepage": "个人主页",
|
||||||
"Homepage - Tooltip": "个人主页链接",
|
"Homepage - Tooltip": "个人主页链接",
|
||||||
|
"ID card": "身份证号",
|
||||||
"Input your email": "请输入邮箱",
|
"Input your email": "请输入邮箱",
|
||||||
"Input your phone number": "输入手机号",
|
"Input your phone number": "输入手机号",
|
||||||
"Is admin": "是管理员",
|
"Is admin": "是管理员",
|
||||||
|
Reference in New Issue
Block a user