mirror of
https://github.com/casdoor/casdoor.git
synced 2025-09-09 04:52:57 +08:00
feat: add the username parameter in SAML or OAuth2 (#4161)
This commit is contained in:
@@ -47,6 +47,7 @@ class LoginPage extends React.Component {
|
|||||||
constructor(props) {
|
constructor(props) {
|
||||||
super(props);
|
super(props);
|
||||||
this.captchaRef = React.createRef();
|
this.captchaRef = React.createRef();
|
||||||
|
const urlParams = new URLSearchParams(this.props.location?.search);
|
||||||
this.state = {
|
this.state = {
|
||||||
classes: props,
|
classes: props,
|
||||||
type: props.type,
|
type: props.type,
|
||||||
@@ -70,6 +71,7 @@ class LoginPage extends React.Component {
|
|||||||
loginLoading: false,
|
loginLoading: false,
|
||||||
userCode: props.userCode ?? (props.match?.params?.userCode ?? null),
|
userCode: props.userCode ?? (props.match?.params?.userCode ?? null),
|
||||||
userCodeStatus: "",
|
userCodeStatus: "",
|
||||||
|
prefilledUsername: urlParams.get("username") || urlParams.get("login_hint"),
|
||||||
};
|
};
|
||||||
|
|
||||||
if (this.state.type === "cas" && props.match?.params.casApplicationName !== undefined) {
|
if (this.state.type === "cas" && props.match?.params.casApplicationName !== undefined) {
|
||||||
@@ -1011,7 +1013,7 @@ class LoginPage extends React.Component {
|
|||||||
organization: application.organization,
|
organization: application.organization,
|
||||||
application: application.name,
|
application: application.name,
|
||||||
autoSignin: !application?.signinItems.map(signinItem => signinItem.name === "Forgot password?" && signinItem.rule === "Auto sign in - False")?.includes(true),
|
autoSignin: !application?.signinItems.map(signinItem => signinItem.name === "Forgot password?" && signinItem.rule === "Auto sign in - False")?.includes(true),
|
||||||
username: Conf.ShowGithubCorner ? "admin" : "",
|
username: this.state.prefilledUsername || (Conf.ShowGithubCorner ? "admin" : ""),
|
||||||
password: Conf.ShowGithubCorner ? "123" : "",
|
password: Conf.ShowGithubCorner ? "123" : "",
|
||||||
}}
|
}}
|
||||||
onFinish={(values) => {
|
onFinish={(values) => {
|
||||||
|
Reference in New Issue
Block a user