mirror of
https://gitee.com/dromara/MaxKey.git
synced 2026-05-14 12:32:09 +08:00
onetimepwd login
This commit is contained in:
@@ -32,6 +32,7 @@ import org.maxkey.configuration.ApplicationConfig;
|
||||
import org.maxkey.entity.Institutions;
|
||||
import org.maxkey.entity.UserInfo;
|
||||
import org.maxkey.password.onetimepwd.AbstractOtpAuthn;
|
||||
import org.maxkey.password.onetimepwd.OtpAuthnService;
|
||||
import org.maxkey.persistence.service.UserInfoService;
|
||||
import org.maxkey.web.WebConstants;
|
||||
import org.maxkey.web.WebContext;
|
||||
@@ -82,9 +83,9 @@ public class LoginEndpoint {
|
||||
@Qualifier("tfaOtpAuthn")
|
||||
protected AbstractOtpAuthn tfaOtpAuthn;
|
||||
|
||||
//@Autowired
|
||||
//@Qualifier("smsOtpAuthn")
|
||||
protected AbstractOtpAuthn smsOtpAuthn;
|
||||
@Autowired
|
||||
@Qualifier("otpAuthnService")
|
||||
protected OtpAuthnService otpAuthnService;
|
||||
|
||||
Pattern mobileRegex = Pattern.compile(
|
||||
"^(13[4,5,6,7,8,9]|15[0,8,9,1,7]|188|187)\\\\d{8}$");
|
||||
@@ -168,10 +169,10 @@ public class LoginEndpoint {
|
||||
|
||||
@RequestMapping("/login/sendsms/{mobile}")
|
||||
@ResponseBody
|
||||
public String produceOtp(@PathVariable("mobile") String mobile) {
|
||||
public String produceOtp(@PathVariable("mobile") String mobile,HttpServletRequest request) {
|
||||
UserInfo queryUserInfo=userInfoService.findByEmailMobile(mobile);
|
||||
if(queryUserInfo!=null) {
|
||||
smsOtpAuthn.produce(queryUserInfo);
|
||||
otpAuthnService.getByInstId(WebContext.getInst(request)).produce(queryUserInfo);
|
||||
return "ok";
|
||||
}
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
var currentSwitchTab="normalLogin";
|
||||
function doLoginSubmit(){
|
||||
currentSwitchTab = $(".switch_tab_current").attr("id") ;
|
||||
$.cookie("mxk_login_username", $("#"+currentSwitchTab+"Form input[name=username]").val(), { expires: 7 });
|
||||
$("#"+currentSwitchTab+"SubmitButton").click();
|
||||
$.cookie("mxk_login_switch_tab", currentSwitchTab, { expires: 7 });
|
||||
|
||||
Reference in New Issue
Block a user