mirror of
https://github.com/casdoor/casdoor.git
synced 2025-07-03 12:30:19 +08:00
feat: fix missing MFA session issue (#2667)
This commit is contained in:
@ -35,10 +35,7 @@ type SmsMfa struct {
|
|||||||
func (mfa *SmsMfa) Initiate(ctx *context.Context, userId string) (*MfaProps, error) {
|
func (mfa *SmsMfa) Initiate(ctx *context.Context, userId string) (*MfaProps, error) {
|
||||||
recoveryCode := uuid.NewString()
|
recoveryCode := uuid.NewString()
|
||||||
|
|
||||||
err := ctx.Input.CruSession.Set(MfaRecoveryCodesSession, []string{recoveryCode})
|
ctx.Output.Session(MfaRecoveryCodesSession, []string{recoveryCode})
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
mfaProps := MfaProps{
|
mfaProps := MfaProps{
|
||||||
MfaType: mfa.Config.MfaType,
|
MfaType: mfa.Config.MfaType,
|
||||||
|
@ -55,16 +55,10 @@ func (mfa *TotpMfa) Initiate(ctx *context.Context, userId string) (*MfaProps, er
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
err = ctx.Input.CruSession.Set(MfaTotpSecretSession, key.Secret())
|
ctx.Output.Session(MfaTotpSecretSession, key.Secret())
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
recoveryCode := uuid.NewString()
|
recoveryCode := uuid.NewString()
|
||||||
err = ctx.Input.CruSession.Set(MfaRecoveryCodesSession, []string{recoveryCode})
|
ctx.Output.Session(MfaRecoveryCodesSession, []string{recoveryCode})
|
||||||
if err != nil {
|
|
||||||
return nil, err
|
|
||||||
}
|
|
||||||
|
|
||||||
mfaProps := MfaProps{
|
mfaProps := MfaProps{
|
||||||
MfaType: mfa.Config.MfaType,
|
MfaType: mfa.Config.MfaType,
|
||||||
|
@ -735,7 +735,9 @@ class App extends Component {
|
|||||||
account={this.state.account}
|
account={this.state.account}
|
||||||
theme={this.state.themeData}
|
theme={this.state.themeData}
|
||||||
onLoginSuccess={(redirectUrl) => {
|
onLoginSuccess={(redirectUrl) => {
|
||||||
localStorage.setItem("mfaRedirectUrl", redirectUrl);
|
if (redirectUrl) {
|
||||||
|
localStorage.setItem("mfaRedirectUrl", redirectUrl);
|
||||||
|
}
|
||||||
this.getAccount();
|
this.getAccount();
|
||||||
}}
|
}}
|
||||||
onUpdateAccount={(account) => this.onUpdateAccount(account)}
|
onUpdateAccount={(account) => this.onUpdateAccount(account)}
|
||||||
|
Reference in New Issue
Block a user