mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-09 01:13:41 +08:00
Compare commits
1 Commits
v1.852.0
...
revert-361
Author | SHA1 | Date | |
---|---|---|---|
a79a2e7e55 |
@ -986,18 +986,6 @@ func (c *ApiController) Login() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if authForm.Language != "" {
|
|
||||||
user := c.getCurrentUser()
|
|
||||||
if user != nil {
|
|
||||||
user.Language = authForm.Language
|
|
||||||
_, err = object.UpdateUser(user.GetId(), user, []string{"language"}, user.IsAdmin)
|
|
||||||
if err != nil {
|
|
||||||
c.ResponseError(err.Error())
|
|
||||||
return
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
c.Data["json"] = resp
|
c.Data["json"] = resp
|
||||||
c.ServeJSON()
|
c.ServeJSON()
|
||||||
}
|
}
|
||||||
|
@ -34,7 +34,6 @@ type AuthForm struct {
|
|||||||
Phone string `json:"phone"`
|
Phone string `json:"phone"`
|
||||||
Affiliation string `json:"affiliation"`
|
Affiliation string `json:"affiliation"`
|
||||||
IdCard string `json:"idCard"`
|
IdCard string `json:"idCard"`
|
||||||
Language string `json:"language"`
|
|
||||||
Region string `json:"region"`
|
Region string `json:"region"`
|
||||||
InvitationCode string `json:"invitationCode"`
|
InvitationCode string `json:"invitationCode"`
|
||||||
|
|
||||||
|
@ -61,7 +61,6 @@ class LoginPage extends React.Component {
|
|||||||
isTermsOfUseVisible: false,
|
isTermsOfUseVisible: false,
|
||||||
termsOfUseContent: "",
|
termsOfUseContent: "",
|
||||||
orgChoiceMode: new URLSearchParams(props.location?.search).get("orgChoiceMode") ?? null,
|
orgChoiceMode: new URLSearchParams(props.location?.search).get("orgChoiceMode") ?? null,
|
||||||
userLang: null,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
if (this.state.type === "cas" && props.match?.params.casApplicationName !== undefined) {
|
if (this.state.type === "cas" && props.match?.params.casApplicationName !== undefined) {
|
||||||
@ -416,7 +415,6 @@ class LoginPage extends React.Component {
|
|||||||
|
|
||||||
login(values) {
|
login(values) {
|
||||||
// here we are supposed to determine whether Casdoor is working as an OAuth server or CAS server
|
// here we are supposed to determine whether Casdoor is working as an OAuth server or CAS server
|
||||||
values["language"] = this.state.userLang ?? "";
|
|
||||||
if (this.state.type === "cas") {
|
if (this.state.type === "cas") {
|
||||||
// CAS
|
// CAS
|
||||||
const casParams = Util.getCasParameters();
|
const casParams = Util.getCasParameters();
|
||||||
@ -568,7 +566,7 @@ class LoginPage extends React.Component {
|
|||||||
return (
|
return (
|
||||||
<div key={resultItemKey} className="login-languages">
|
<div key={resultItemKey} className="login-languages">
|
||||||
<div dangerouslySetInnerHTML={{__html: ("<style>" + signinItem.customCss?.replaceAll("<style>", "").replaceAll("</style>", "") + "</style>")}} />
|
<div dangerouslySetInnerHTML={{__html: ("<style>" + signinItem.customCss?.replaceAll("<style>", "").replaceAll("</style>", "") + "</style>")}} />
|
||||||
<LanguageSelect languages={application.organizationObj.languages} onClick={key => {this.setState({userLang: key});}} />
|
<LanguageSelect languages={application.organizationObj.languages} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
} else if (signinItem.name === "Signin methods") {
|
} else if (signinItem.name === "Signin methods") {
|
||||||
@ -807,6 +805,7 @@ class LoginPage extends React.Component {
|
|||||||
<Form
|
<Form
|
||||||
name="normal_login"
|
name="normal_login"
|
||||||
initialValues={{
|
initialValues={{
|
||||||
|
|
||||||
organization: application.organization,
|
organization: application.organization,
|
||||||
application: application.name,
|
application: application.name,
|
||||||
autoSignin: true,
|
autoSignin: true,
|
||||||
|
@ -30,7 +30,6 @@ class LanguageSelect extends React.Component {
|
|||||||
this.state = {
|
this.state = {
|
||||||
classes: props,
|
classes: props,
|
||||||
languages: props.languages ?? Setting.Countries.map(item => item.key),
|
languages: props.languages ?? Setting.Countries.map(item => item.key),
|
||||||
onClick: props.onClick,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
Setting.Countries.forEach((country) => {
|
Setting.Countries.forEach((country) => {
|
||||||
@ -51,9 +50,6 @@ class LanguageSelect extends React.Component {
|
|||||||
render() {
|
render() {
|
||||||
const languageItems = this.getOrganizationLanguages(this.state.languages);
|
const languageItems = this.getOrganizationLanguages(this.state.languages);
|
||||||
const onClick = (e) => {
|
const onClick = (e) => {
|
||||||
if (typeof this.state.onClick === "function") {
|
|
||||||
this.state.onClick(e.key);
|
|
||||||
}
|
|
||||||
Setting.setLanguage(e.key);
|
Setting.setLanguage(e.key);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user