mirror of
https://github.com/tencentmusic/supersonic.git
synced 2025-12-10 19:51:00 +00:00
[fix][auth]Fix user registration and resetPassword issue.
This commit is contained in:
@@ -12,4 +12,7 @@ public class UserReq {
|
||||
|
||||
@NotBlank(message = "password can not be null")
|
||||
private String password;
|
||||
|
||||
@NotBlank(message = "password can not be null")
|
||||
private String newPassword;
|
||||
}
|
||||
|
||||
@@ -1,7 +1,13 @@
|
||||
package com.tencent.supersonic.auth.authentication.persistence.dataobject;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
|
||||
@TableName("s2_user")
|
||||
public class UserDO {
|
||||
/** */
|
||||
|
||||
@TableId(type = IdType.AUTO)
|
||||
private Long id;
|
||||
|
||||
/** */
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.tencent.supersonic.auth.authentication.persistence.mapper;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
import com.tencent.supersonic.auth.authentication.persistence.dataobject.UserDO;
|
||||
import com.tencent.supersonic.auth.authentication.persistence.dataobject.UserDOExample;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
@@ -7,12 +9,8 @@ import org.apache.ibatis.annotations.Mapper;
|
||||
import java.util.List;
|
||||
|
||||
@Mapper
|
||||
public interface UserDOMapper {
|
||||
public interface UserDOMapper extends BaseMapper<UserDO> {
|
||||
|
||||
/** @mbg.generated */
|
||||
int insert(UserDO record);
|
||||
|
||||
/** @mbg.generated */
|
||||
List<UserDO> selectByExample(UserDOExample example);
|
||||
|
||||
void updateByPrimaryKey(UserDO userDO);
|
||||
|
||||
@@ -72,6 +72,13 @@ public class UserController {
|
||||
return userService.login(userCmd, request);
|
||||
}
|
||||
|
||||
@PostMapping("/resetPassword")
|
||||
public void resetPassword(@RequestBody UserReq userCmd, HttpServletRequest request,
|
||||
HttpServletResponse response) {
|
||||
User user = userService.getCurrentUser(request, response);
|
||||
userService.resetPassword(user.getName(), userCmd.getPassword(), userCmd.getNewPassword());
|
||||
}
|
||||
|
||||
@PostMapping("/generateToken")
|
||||
public UserToken generateToken(@RequestBody UserTokenReq userTokenReq,
|
||||
HttpServletRequest request, HttpServletResponse response) {
|
||||
|
||||
@@ -59,14 +59,6 @@
|
||||
limit #{limitStart} , #{limitEnd}
|
||||
</if>
|
||||
</select>
|
||||
<insert id="insert" parameterType="com.tencent.supersonic.auth.authentication.persistence.dataobject.UserDO">
|
||||
insert into s2_user (id, name, password, salt,
|
||||
display_name, email, is_admin
|
||||
)
|
||||
values (#{id,jdbcType=BIGINT}, #{name,jdbcType=VARCHAR}, #{password,jdbcType=VARCHAR}, #{salt,jdbcType=VARCHAR},
|
||||
#{displayName,jdbcType=VARCHAR}, #{email,jdbcType=VARCHAR}, #{isAdmin,jdbcType=INTEGER}
|
||||
)
|
||||
</insert>
|
||||
<insert id="insertSelective" parameterType="com.tencent.supersonic.auth.authentication.persistence.dataobject.UserDO">
|
||||
insert into s2_user
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
|
||||
Reference in New Issue
Block a user