|
@@ -17,6 +17,14 @@ import (
|
|
|
"go.uber.org/zap"
|
|
|
)
|
|
|
|
|
|
+// 框架自带的登录无加密 返回公钥
|
|
|
+
|
|
|
+func (b *BaseApi) ReturnPublicKey(c *gin.Context) {
|
|
|
+ rsa := utils.RSA{}
|
|
|
+ publicKey := rsa.ReturnPublicKey()
|
|
|
+ response.OkWithData(gin.H{"publicKey": publicKey}, c)
|
|
|
+}
|
|
|
+
|
|
|
// Login
|
|
|
// @Tags Base
|
|
|
// @Summary 用户登录
|
|
@@ -49,6 +57,10 @@ func (b *BaseApi) Login(c *gin.Context) {
|
|
|
|
|
|
var oc bool = openCaptcha == 0 || openCaptcha < interfaceToInt(v)
|
|
|
|
|
|
+ //解密
|
|
|
+ rsa := utils.RSA{}
|
|
|
+ l.Password = rsa.Encryption(l.Password)
|
|
|
+
|
|
|
if !oc || (l.CaptchaId != "" && l.Captcha != "" && store.Verify(l.CaptchaId, l.Captcha, true)) {
|
|
|
u := &system.SysUser{Username: l.Username, Password: l.Password}
|
|
|
user, err := userService.Login(u)
|