mirror of
https://codeberg.org/gitnex/GitNex.git
synced 2024-12-16 15:48:13 +08:00
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:
parent
14bca1f4c4
commit
e709aba3c2
@ -111,6 +111,29 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
|
|||||||
|
|
||||||
info_button.setOnClickListener(infoListener);
|
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) -> {
|
loginMethod.setOnCheckedChangeListener((group, checkedId) -> {
|
||||||
|
|
||||||
if(checkedId == R.id.loginToken) {
|
if(checkedId == R.id.loginToken) {
|
||||||
@ -221,6 +244,8 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
|
|||||||
|
|
||||||
if(loginMethodType == R.id.loginUsernamePassword) {
|
if(loginMethodType == R.id.loginUsernamePassword) {
|
||||||
|
|
||||||
|
tinyDb.putBoolean("loginType", true);
|
||||||
|
|
||||||
if(instanceUrl.contains("@")) {
|
if(instanceUrl.contains("@")) {
|
||||||
|
|
||||||
String[] urlForHttpAuth = instanceUrl.split("@");
|
String[] urlForHttpAuth = instanceUrl.split("@");
|
||||||
@ -322,6 +347,8 @@ public class LoginActivity extends BaseActivity implements View.OnClickListener
|
|||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|
||||||
|
tinyDb.putBoolean("loginType", false);
|
||||||
|
|
||||||
String instanceHost;
|
String instanceHost;
|
||||||
if(AppUtil.httpCheck(instanceUrl)) {
|
if(AppUtil.httpCheck(instanceUrl)) {
|
||||||
|
|
||||||
|
@ -100,7 +100,7 @@
|
|||||||
<string name="emptyFieldPassword">Password is required</string>
|
<string name="emptyFieldPassword">Password is required</string>
|
||||||
|
|
||||||
<string name="checkNetConnection">Cannot access network, please check your Internet connection</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="repoNameErrorEmpty">Repository name is empty</string>
|
||||||
<string name="repoNameErrorInvalid">Repository name is not valid. [a–z A–Z 0–9 – _]</string>
|
<string name="repoNameErrorInvalid">Repository name is not valid. [a–z A–Z 0–9 – _]</string>
|
||||||
|
Loading…
Reference in New Issue
Block a user