mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-03 12:30:19 +08:00
Return code for /api/login
This commit is contained in:
@ -51,13 +51,6 @@ export function logout() {
|
||||
}).then(res => res.json());
|
||||
}
|
||||
|
||||
export function getOAuthCode(clientId, responseType, redirectUri, scope, state) {
|
||||
return fetch(`${authConfig.serverUrl}/api/oauth/code?clientId=${clientId}&responseType=${responseType}&redirectUri=${redirectUri}&scope=${scope}&state=${state}`, {
|
||||
method: 'GET',
|
||||
credentials: 'include',
|
||||
}).then(res => res.json());
|
||||
}
|
||||
|
||||
export function getApplication(owner, name) {
|
||||
return fetch(`${authConfig.serverUrl}/api/get-application?id=${owner}/${encodeURIComponent(name)}`, {
|
||||
method: "GET",
|
||||
|
@ -86,12 +86,17 @@ class Face extends React.Component {
|
||||
}
|
||||
|
||||
onFinish(values) {
|
||||
values.type = this.state.type;
|
||||
AuthBackend.login(values)
|
||||
.then((res) => {
|
||||
if (res.status === 'ok') {
|
||||
this.props.onLoggedIn();
|
||||
Util.showMessage("success", `Logged in successfully`);
|
||||
Util.goToLink("/");
|
||||
if (this.state.type === "login") {
|
||||
this.props.onLoggedIn();
|
||||
Util.showMessage("success", `Logged in successfully`);
|
||||
Util.goToLink("/");
|
||||
} else if (this.state.type === "code") {
|
||||
Util.showMessage("success", `Authorization code: ${res.data}`);
|
||||
}
|
||||
} else {
|
||||
Util.showMessage("error", `Log in failed:${res.msg}`);
|
||||
}
|
||||
|
Reference in New Issue
Block a user