Commit 4b32a839 by huangjinxin

fix:用户登陆添加手机号,邮箱登陆,取消用户密码明文传输

1 parent 8b445147
......@@ -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);
}
......@@ -101,7 +101,7 @@ public class UserService {
UserOrgDao userOrgDao;
public Result<UserLoginDTO> userLogin(String account, String password) {
UserEntity user = userDao.findByAccountAndPassword(account, SecureUtil.md5(password));
UserEntity user = userDao.findByLoginnameAndPass(account, password);
log.info("{}/{} login", account, password);
if (null == user) {
return Result.failure("鉴权失败");
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!