新增验证码
This commit is contained in:
@@ -3,6 +3,7 @@ package com.aiosman.riderpro.data
|
||||
import com.aiosman.riderpro.AppState
|
||||
import com.aiosman.riderpro.data.api.ApiClient
|
||||
import com.aiosman.riderpro.data.api.AppConfig
|
||||
import com.aiosman.riderpro.data.api.CaptchaInfo
|
||||
import com.aiosman.riderpro.data.api.ChangePasswordRequestBody
|
||||
import com.aiosman.riderpro.data.api.GoogleRegisterRequestBody
|
||||
import com.aiosman.riderpro.data.api.LoginUserRequestBody
|
||||
@@ -266,8 +267,13 @@ interface AccountService {
|
||||
* 使用用户名密码登录
|
||||
* @param loginName 用户名
|
||||
* @param password 密码
|
||||
* @param captchaInfo 验证码信息
|
||||
*/
|
||||
suspend fun loginUserWithPassword(loginName: String, password: String): UserAuth
|
||||
suspend fun loginUserWithPassword(
|
||||
loginName: String,
|
||||
password: String,
|
||||
captchaInfo: CaptchaInfo? = null
|
||||
): UserAuth
|
||||
|
||||
/**
|
||||
* 使用google登录
|
||||
@@ -383,8 +389,16 @@ class AccountServiceImpl : AccountService {
|
||||
return UserAuth(body.id)
|
||||
}
|
||||
|
||||
override suspend fun loginUserWithPassword(loginName: String, password: String): UserAuth {
|
||||
val resp = ApiClient.api.login(LoginUserRequestBody(loginName, password))
|
||||
override suspend fun loginUserWithPassword(
|
||||
loginName: String,
|
||||
password: String,
|
||||
captchaInfo: CaptchaInfo?
|
||||
): UserAuth {
|
||||
val resp = ApiClient.api.login(LoginUserRequestBody(
|
||||
username = loginName,
|
||||
password = password,
|
||||
captcha = captchaInfo,
|
||||
))
|
||||
if (!resp.isSuccessful) {
|
||||
parseErrorResponse(resp.errorBody())?.let {
|
||||
throw it.toServiceException()
|
||||
|
||||
Reference in New Issue
Block a user