Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
yangxiujun
/
paidan_demo
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 4b32a839
authored
Oct 12, 2023
by
huangjinxin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fix:用户登陆添加手机号,邮箱登陆,取消用户密码明文传输
1 parent
8b445147
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
1 deletions
project-user/src/main/java/com/dituhui/pea/user/dao/UserDao.java
project-user/src/main/java/com/dituhui/pea/user/service/UserService.java
project-user/src/main/java/com/dituhui/pea/user/dao/UserDao.java
View file @
4b32a83
...
...
@@ -4,9 +4,11 @@ import java.util.List;
import
org.springframework.data.jpa.repository.JpaRepository
;
import
org.springframework.data.jpa.repository.JpaSpecificationExecutor
;
import
org.springframework.data.jpa.repository.Query
;
import
org.springframework.data.repository.CrudRepository
;
import
com.dituhui.pea.user.entity.UserEntity
;
import
org.springframework.data.repository.query.Param
;
/**
* 用户表(User)表数据库访问层
...
...
@@ -80,4 +82,14 @@ public interface UserDao extends JpaRepository<UserEntity, String>, JpaSpecifica
*/
List
<
UserEntity
>
findByIdIn
(
List
<
String
>
userIds
);
/**
* 登录验证
* @param loginname 登录名(手机号、邮箱、用户名)
* @param password 密码
* @return
*/
@Query
(
"select t from UserEntity t where (t.account=:loginname or t.email=:loginname or t.phone=:loginname) and t.password=:password"
)
public
UserEntity
findByLoginnameAndPass
(
@Param
(
"loginname"
)
String
loginname
,
@Param
(
"password"
)
String
password
);
}
project-user/src/main/java/com/dituhui/pea/user/service/UserService.java
View file @
4b32a83
...
...
@@ -101,7 +101,7 @@ public class UserService {
UserOrgDao
userOrgDao
;
public
Result
<
UserLoginDTO
>
userLogin
(
String
account
,
String
password
)
{
UserEntity
user
=
userDao
.
findBy
AccountAndPassword
(
account
,
SecureUtil
.
md5
(
password
)
);
UserEntity
user
=
userDao
.
findBy
LoginnameAndPass
(
account
,
password
);
log
.
info
(
"{}/{} login"
,
account
,
password
);
if
(
null
==
user
)
{
return
Result
.
failure
(
"鉴权失败"
);
...
...
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment