-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move login client out of the data-client (#5476)
- Loading branch information
Showing
23 changed files
with
195 additions
and
234 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
36 changes: 0 additions & 36 deletions
36
app/src/main/java/fr/free/nrw/commons/auth/LogoutClient.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
45 changes: 45 additions & 0 deletions
45
app/src/main/java/fr/free/nrw/commons/auth/login/LoginInterface.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
package fr.free.nrw.commons.auth.login | ||
|
||
import io.reactivex.Observable | ||
import org.wikipedia.dataclient.Service | ||
import org.wikipedia.dataclient.mwapi.MwQueryResponse | ||
import retrofit2.Call | ||
import retrofit2.http.Field | ||
import retrofit2.http.FormUrlEncoded | ||
import retrofit2.http.GET | ||
import retrofit2.http.Headers | ||
import retrofit2.http.POST | ||
import retrofit2.http.Query | ||
|
||
interface LoginInterface { | ||
@Headers("Cache-Control: no-cache") | ||
@GET(Service.MW_API_PREFIX + "action=query&meta=tokens&type=login") | ||
fun getLoginToken(): Call<MwQueryResponse?> | ||
|
||
@Headers("Cache-Control: no-cache") | ||
@FormUrlEncoded | ||
@POST(Service.MW_API_PREFIX + "action=clientlogin&rememberMe=") | ||
fun postLogIn( | ||
@Field("username") user: String?, | ||
@Field("password") pass: String?, | ||
@Field("logintoken") token: String?, | ||
@Field("uselang") userLanguage: String?, | ||
@Field("loginreturnurl") url: String? | ||
): Call<LoginClient.LoginResponse?> | ||
|
||
@Headers("Cache-Control: no-cache") | ||
@FormUrlEncoded | ||
@POST(Service.MW_API_PREFIX + "action=clientlogin&rememberMe=") | ||
fun postLogIn( | ||
@Field("username") user: String?, | ||
@Field("password") pass: String?, | ||
@Field("retype") retypedPass: String?, | ||
@Field("OATHToken") twoFactorCode: String?, | ||
@Field("logintoken") token: String?, | ||
@Field("uselang") userLanguage: String?, | ||
@Field("logincontinue") loginContinue: Boolean | ||
): Call<LoginClient.LoginResponse?> | ||
|
||
@GET(Service.MW_API_PREFIX + "action=query&meta=userinfo&list=users&usprop=groups|cancreate") | ||
fun getUserInfo(@Query("ususers") userName: String): Observable<MwQueryResponse?> | ||
} |
2 changes: 1 addition & 1 deletion
2
...org/wikipedia/login/LoginOAuthResult.java → .../commons/auth/login/LoginOAuthResult.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...pedia/login/LoginResetPasswordResult.java → .../auth/login/LoginResetPasswordResult.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...java/org/wikipedia/login/LoginResult.java → ...e/nrw/commons/auth/login/LoginResult.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.