Remember login type (#392)

Merge branch 'master' into 372-remember-login-type

Remember login type

Co-authored-by: 6543 <6543@noreply.gitea.io>
Reviewed-on: https://gitea.com/gitnex/GitNex/pulls/392
Reviewed-by: 6543 <6543@noreply.gitea.io>
This commit is contained in:
M M Arif 2020-04-12 19:04:02 +00:00
parent 14bca1f4c4
commit e709aba3c2
2 changed files with 28 additions and 1 deletions

View File

@ -111,6 +111,29 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
info_button.setOnClickListener(infoListener);
if(tinyDb.getBoolean("loginType")) { // username/password
loginMethod.check(R.id.loginUsernamePassword);
loginUidET.setVisibility(View.VISIBLE);
loginPassword.setVisibility(View.VISIBLE);
otpCode.setVisibility(View.VISIBLE);
otpInfo.setVisibility(View.VISIBLE);
loginTokenCode.setVisibility(View.GONE);
}
else {
loginMethod.check(R.id.loginToken);
loginUidET.setVisibility(View.GONE);
loginPassword.setVisibility(View.GONE);
otpCode.setVisibility(View.GONE);
otpInfo.setVisibility(View.GONE);
loginTokenCode.setVisibility(View.VISIBLE);
}
loginMethod.setOnCheckedChangeListener((group, checkedId) -> {
if(checkedId == R.id.loginToken) {
@ -221,6 +244,8 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
if(loginMethodType == R.id.loginUsernamePassword) {
tinyDb.putBoolean("loginType", true);
if(instanceUrl.contains("@")) {
String[] urlForHttpAuth = instanceUrl.split("@");
@ -322,6 +347,8 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
}
else {
tinyDb.putBoolean("loginType", false);
String instanceHost;
if(AppUtil.httpCheck(instanceUrl)) {

View File

@ -100,7 +100,7 @@
<string name="emptyFieldPassword">Password is required</string>
<string name="checkNetConnection">Cannot access network, please check your Internet connection</string>
<string name="netConnectionIsBack">Yay, Internet connection is back</string>
<string name="netConnectionIsBack">Yay, We have Internet connection!</string>
<string name="repoNameErrorEmpty">Repository name is empty</string>
<string name="repoNameErrorInvalid">Repository name is not valid. [a&#8211;z A&#8211;Z 0&#8211;9 &#8211; _]</string>