|
|
|
@ -1,45 +1,40 @@
|
|
|
|
|
package com.luoo.user.controller;
|
|
|
|
|
|
|
|
|
|
import java.io.ByteArrayOutputStream;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
|
|
|
|
import annotation.GlobalInterceptor;
|
|
|
|
|
import annotation.VerifyParam;
|
|
|
|
|
import api.Result;
|
|
|
|
|
import api.StatusCode;
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
|
|
import com.luoo.user.dto.UserNameLoginDto;
|
|
|
|
|
import com.luoo.user.dto.request.*;
|
|
|
|
|
import com.luoo.user.service.WeChatAouth2Service;
|
|
|
|
|
import com.luoo.user.util.IOSTokenUtils;
|
|
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
|
|
|
|
import constants.Constants;
|
|
|
|
|
import controller.BaseController;
|
|
|
|
|
|
|
|
|
|
import com.luoo.user.dto.response.CountryCodeDTO;
|
|
|
|
|
import com.luoo.user.dto.response.CreateImageCode;
|
|
|
|
|
import com.luoo.user.pojo.UserInfo;
|
|
|
|
|
import com.luoo.user.service.UserInfoService;
|
|
|
|
|
import com.luoo.user.util.NickNameUtil;
|
|
|
|
|
|
|
|
|
|
import annotation.GlobalInterceptor;
|
|
|
|
|
import annotation.VerifyParam;
|
|
|
|
|
import api.Result;
|
|
|
|
|
import api.StatusCode;
|
|
|
|
|
import com.luoo.user.service.WeChatAouth2Service;
|
|
|
|
|
import com.luoo.user.util.IOSTokenUtils;
|
|
|
|
|
import constants.Constants;
|
|
|
|
|
import controller.BaseController;
|
|
|
|
|
import enums.RequestFrequencyTypeEnum;
|
|
|
|
|
import enums.VerifyRegexEnum;
|
|
|
|
|
import io.swagger.annotations.Api;
|
|
|
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
|
|
|
import io.swagger.annotations.ApiImplicitParams;
|
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
|
|
import util.IdWorker;
|
|
|
|
|
import org.apache.commons.lang.StringUtils;
|
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
import util.JwtUtil;
|
|
|
|
|
import util.StringTools;
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
import java.io.ByteArrayOutputStream;
|
|
|
|
|
import java.io.IOException;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.concurrent.TimeUnit;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* 控制器层
|
|
|
|
|
*
|
|
|
|
@ -364,13 +359,13 @@ public class LoginController extends BaseController {
|
|
|
|
|
/**
|
|
|
|
|
* 通过用户名/密码登录
|
|
|
|
|
*
|
|
|
|
|
* @param userName 用户名
|
|
|
|
|
* @param password 密码
|
|
|
|
|
* @return 登录结果
|
|
|
|
|
*/
|
|
|
|
|
@ApiOperation(value = "通过用户名/密码登录")
|
|
|
|
|
@PostMapping("/login/{userName}/{password}")
|
|
|
|
|
public Result loginByUserName(@PathVariable String userName, @PathVariable String password) {
|
|
|
|
|
@PostMapping("/login/username")
|
|
|
|
|
public Result loginByUserName(@Validated @RequestBody UserNameLoginDto userNameLoginDto) {
|
|
|
|
|
String userName = userNameLoginDto.getUserName();
|
|
|
|
|
String password = userNameLoginDto.getPassword();
|
|
|
|
|
UserInfo userInfo = userInfoService.findByUserNameAndPassword(userName, password);
|
|
|
|
|
if (userInfo !=null) {
|
|
|
|
|
//生成token
|
|
|
|
@ -385,4 +380,11 @@ public class LoginController extends BaseController {
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "修改密码")
|
|
|
|
|
@PostMapping("/changePassword")
|
|
|
|
|
public Result<Void> changePassword(@Validated @RequestBody UserNameLoginDto changePasswordDto) {
|
|
|
|
|
userInfoService.changePassword(changePasswordDto.getUserName(), changePasswordDto.getPassword());
|
|
|
|
|
return Result.success();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|