From 94b969c4280ae4ae0b202fa5f759925de6338bfc Mon Sep 17 00:00:00 2001 From: Thomas Date: Sat, 12 Sep 2020 18:05:55 +0200 Subject: [PATCH] Fix issue case sensitive issue --- .../app/fedilab/fedilabtube/LoginActivity.java | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/app/fedilab/fedilabtube/LoginActivity.java b/app/src/main/java/app/fedilab/fedilabtube/LoginActivity.java index ba87e3b..139eee8 100644 --- a/app/src/main/java/app/fedilab/fedilabtube/LoginActivity.java +++ b/app/src/main/java/app/fedilab/fedilabtube/LoginActivity.java @@ -234,8 +234,21 @@ public class LoginActivity extends AppCompatActivity { String responseLogin = new HttpsConnection(LoginActivity.this).post("https://" + finalInstance + oauthUrl, 30, parameters, null); proceedLogin(responseLogin, host); } catch (final Exception e) { - parameters.remove("username"); - parameters.put("username", login_uid.getText().toString().trim().toLowerCase()); + parameters.clear(); + parameters.put(Helper.CLIENT_ID, sharedpreferences.getString(Helper.CLIENT_ID, null)); + parameters.put(Helper.CLIENT_SECRET, sharedpreferences.getString(Helper.CLIENT_SECRET, null)); + parameters.put("grant_type", "password"); + try { + parameters.put("username", URLEncoder.encode(login_uid.getText().toString().toLowerCase().trim(), "UTF-8")); + } catch (UnsupportedEncodingException e2) { + parameters.put("username", login_uid.getText().toString().toLowerCase().trim()); + } + try { + parameters.put("password", URLEncoder.encode(login_passwd.getText().toString(), "UTF-8")); + } catch (UnsupportedEncodingException e2) { + parameters.put("password", login_passwd.getText().toString()); + } + parameters.put("scope", "user"); try { String responseLogin = new HttpsConnection(LoginActivity.this).post("https://" + finalInstance + oauthUrl, 30, parameters, null); proceedLogin(responseLogin, host);