登录接口(临时)
parent
56a59edc72
commit
104554c1c5
|
|
@ -97,6 +97,21 @@ public class SysLoginController {
|
|||
return ajax;
|
||||
}
|
||||
|
||||
@ApiOperation(value = "用户名密码登录(临时)")
|
||||
@PostMapping("/loginByUname0")
|
||||
public AjaxResult login(@Validated @RequestBody LoginByUsername0VO loginBody) {
|
||||
AjaxResult ajax = AjaxResult.success();
|
||||
// 生成令牌
|
||||
LoginCredential credential = LoginCredential.builder()
|
||||
.loginType(ELoginType.USERNAME)
|
||||
.username(loginBody.getUsername())
|
||||
.password(loginBody.getPassword())
|
||||
.build();
|
||||
String token = loginService.login(credential);
|
||||
ajax.put(Constants.TOKEN, token);
|
||||
return ajax;
|
||||
}
|
||||
|
||||
@ApiOperation(value = "短信验证码登录")
|
||||
@PostMapping("/loginBySms")
|
||||
public AjaxResult loginBySms(@Validated @RequestBody LoginBySmsCodeVO loginBody) {
|
||||
|
|
|
|||
|
|
@ -0,0 +1,29 @@
|
|||
package com.ruoyi.web.controller.system.vo;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.validation.constraints.NotEmpty;
|
||||
|
||||
/**
|
||||
* @author liangyq
|
||||
* @date 2025-06-05 15:41
|
||||
*/
|
||||
@ApiModel
|
||||
@Data
|
||||
public class LoginByUsername0VO {
|
||||
/**
|
||||
* 用户名
|
||||
*/
|
||||
@NotEmpty(message = "用户名不能为空")
|
||||
@ApiModelProperty(value = "用户名", required = true)
|
||||
private String username;
|
||||
|
||||
/**
|
||||
* 用户密码
|
||||
*/
|
||||
@NotEmpty(message = "用户密码不能为空")
|
||||
@ApiModelProperty(value = "用户密码", required = true)
|
||||
private String password;
|
||||
}
|
||||
|
|
@ -111,7 +111,7 @@ public class SecurityConfig
|
|||
.authorizeHttpRequests((requests) -> {
|
||||
permitAllUrl.getUrls().forEach(url -> requests.antMatchers(url).permitAll());
|
||||
// 对于登录login 注册register 验证码captchaImage 允许匿名访问
|
||||
requests.antMatchers("/rest/v1/login/loginByUname", "/rest/v1/login/loginBySms",
|
||||
requests.antMatchers("/rest/v1/login/loginByUname", "/rest/v1/login/loginByUname0", "/rest/v1/login/loginBySms",
|
||||
"/rest/v1/login/sendSmsVerificationCode", "/rest/v1/reg/registerStore", "/rest/v1/reg/registerSeller", "/rest/v1/reg/registerAgent",
|
||||
"/rest/v1/reg/sendSmsVerificationCode", "/rest/v1/reg/isPhoneNumberRegistered", "/rest/v1/captcha/image",
|
||||
"/rest/v1/login/getBrowserId", "/rest/v1/login/getTokenByBrowserId", "/rest/v1/login/changePassword").permitAll()
|
||||
|
|
|
|||
Loading…
Reference in New Issue