mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-15 18:33:50 +08:00
feat: add organization's PasswordObfuscator to obfuscate login API's password (#3260)
* feat: add PasswordObfuscator to the login API * fix: change key error message * fix: remove unnecessary change * fix: fix one * fix: fix two * fix: fix three * fix: fix five * fix: disable organization update when key is invalid * fix: fix six * fix: use Form.Item to control key * fix: update obfuscator.js * Update obfuscator.go * Update obfuscator.go * Update auth.go * fix: remove real-time key monitoring --------- Co-authored-by: Yang Luo <hsluoyz@qq.com>
This commit is contained in:
@ -19,6 +19,7 @@ import {withRouter} from "react-router-dom";
|
||||
import * as UserWebauthnBackend from "../backend/UserWebauthnBackend";
|
||||
import OrganizationSelect from "../common/select/OrganizationSelect";
|
||||
import * as Conf from "../Conf";
|
||||
import * as Obfuscator from "./Obfuscator";
|
||||
import * as AuthBackend from "./AuthBackend";
|
||||
import * as OrganizationBackend from "../backend/OrganizationBackend";
|
||||
import * as ApplicationBackend from "../backend/ApplicationBackend";
|
||||
@ -379,6 +380,14 @@ class LoginPage extends React.Component {
|
||||
return;
|
||||
}
|
||||
if (this.state.loginMethod === "password" || this.state.loginMethod === "ldap") {
|
||||
const organization = this.getApplicationObj()?.organizationObj;
|
||||
const [passwordCipher, errorMessage] = Obfuscator.encryptByPasswordObfuscator(organization?.passwordObfuscatorType, organization?.passwordObfuscatorKey, values["password"]);
|
||||
if (errorMessage.length > 0) {
|
||||
Setting.showMessage("error", errorMessage);
|
||||
return;
|
||||
} else {
|
||||
values["password"] = passwordCipher;
|
||||
}
|
||||
if (this.state.enableCaptchaModal === CaptchaRule.Always) {
|
||||
this.setState({
|
||||
openCaptchaModal: true,
|
||||
|
Reference in New Issue
Block a user