mirror of
https://github.com/immich-app/immich
synced 2025-11-07 17:27:20 +00:00
feat(mobile): Removed stay logged in checkbox and made it enabled by default (#1550)
* removed stay logged in checkbox and made it enabled by default * adds padding to login button * removed all isSaveLogin * fix: logout would re-login with previous credential upon app restart --------- Co-authored-by: Alex <alex.tran1502@gmail.com>
This commit is contained in:
parent
f38c7a4b7e
commit
16183791f3
5 changed files with 14 additions and 77 deletions
|
|
@ -29,7 +29,6 @@ class LoginForm extends HookConsumerWidget {
|
|||
useTextEditingController.fromValue(TextEditingValue.empty);
|
||||
final apiService = ref.watch(apiServiceProvider);
|
||||
final serverEndpointFocusNode = useFocusNode();
|
||||
final isSaveLoginInfo = useState<bool>(false);
|
||||
final isLoading = useState<bool>(false);
|
||||
final isOauthEnable = useState<bool>(false);
|
||||
final oAuthButtonLabel = useState<String>('OAuth');
|
||||
|
|
@ -75,7 +74,6 @@ class LoginForm extends HookConsumerWidget {
|
|||
usernameController.text = loginInfo.email;
|
||||
passwordController.text = loginInfo.password;
|
||||
serverEndpointController.text = loginInfo.serverUrl;
|
||||
isSaveLoginInfo.value = loginInfo.isSaveLogin;
|
||||
}
|
||||
|
||||
getServeLoginConfig();
|
||||
|
|
@ -88,7 +86,6 @@ class LoginForm extends HookConsumerWidget {
|
|||
usernameController.text = 'testuser@email.com';
|
||||
passwordController.text = 'password';
|
||||
serverEndpointController.text = 'http://10.1.15.216:2283/api';
|
||||
isSaveLoginInfo.value = true;
|
||||
}
|
||||
|
||||
return Center(
|
||||
|
|
@ -124,30 +121,6 @@ class LoginForm extends HookConsumerWidget {
|
|||
controller: serverEndpointController,
|
||||
focusNode: serverEndpointFocusNode,
|
||||
),
|
||||
CheckboxListTile(
|
||||
activeColor: Theme.of(context).primaryColor,
|
||||
contentPadding: const EdgeInsets.symmetric(horizontal: 8),
|
||||
dense: true,
|
||||
side: const BorderSide(color: Colors.grey, width: 1.5),
|
||||
shape: RoundedRectangleBorder(
|
||||
borderRadius: BorderRadius.circular(5),
|
||||
),
|
||||
enableFeedback: true,
|
||||
title: const Text(
|
||||
"login_form_save_login",
|
||||
style: TextStyle(
|
||||
fontSize: 16,
|
||||
fontWeight: FontWeight.bold,
|
||||
color: Colors.grey,
|
||||
),
|
||||
).tr(),
|
||||
value: isSaveLoginInfo.value,
|
||||
onChanged: (switchValue) {
|
||||
if (switchValue != null) {
|
||||
isSaveLoginInfo.value = switchValue;
|
||||
}
|
||||
},
|
||||
),
|
||||
if (isLoading.value)
|
||||
const SizedBox(
|
||||
width: 24,
|
||||
|
|
@ -161,11 +134,11 @@ class LoginForm extends HookConsumerWidget {
|
|||
crossAxisAlignment: CrossAxisAlignment.stretch,
|
||||
mainAxisAlignment: MainAxisAlignment.center,
|
||||
children: [
|
||||
const SizedBox(height: 18),
|
||||
LoginButton(
|
||||
emailController: usernameController,
|
||||
passwordController: passwordController,
|
||||
serverEndpointController: serverEndpointController,
|
||||
isSavedLoginInfo: isSaveLoginInfo.value,
|
||||
),
|
||||
if (isOauthEnable.value) ...[
|
||||
Padding(
|
||||
|
|
@ -181,7 +154,6 @@ class LoginForm extends HookConsumerWidget {
|
|||
),
|
||||
OAuthLoginButton(
|
||||
serverEndpointController: serverEndpointController,
|
||||
isSavedLoginInfo: isSaveLoginInfo.value,
|
||||
buttonLabel: oAuthButtonLabel.value,
|
||||
isLoading: isLoading,
|
||||
onLoginSuccess: () {
|
||||
|
|
@ -304,14 +276,12 @@ class LoginButton extends ConsumerWidget {
|
|||
final TextEditingController emailController;
|
||||
final TextEditingController passwordController;
|
||||
final TextEditingController serverEndpointController;
|
||||
final bool isSavedLoginInfo;
|
||||
|
||||
const LoginButton({
|
||||
Key? key,
|
||||
required this.emailController,
|
||||
required this.passwordController,
|
||||
required this.serverEndpointController,
|
||||
required this.isSavedLoginInfo,
|
||||
}) : super(key: key);
|
||||
|
||||
@override
|
||||
|
|
@ -329,7 +299,6 @@ class LoginButton extends ConsumerWidget {
|
|||
emailController.text,
|
||||
passwordController.text,
|
||||
serverEndpointController.text,
|
||||
isSavedLoginInfo,
|
||||
);
|
||||
|
||||
if (isAuthenticated) {
|
||||
|
|
@ -361,7 +330,6 @@ class LoginButton extends ConsumerWidget {
|
|||
|
||||
class OAuthLoginButton extends ConsumerWidget {
|
||||
final TextEditingController serverEndpointController;
|
||||
final bool isSavedLoginInfo;
|
||||
final ValueNotifier<bool> isLoading;
|
||||
final VoidCallback onLoginSuccess;
|
||||
final String buttonLabel;
|
||||
|
|
@ -369,7 +337,6 @@ class OAuthLoginButton extends ConsumerWidget {
|
|||
const OAuthLoginButton({
|
||||
Key? key,
|
||||
required this.serverEndpointController,
|
||||
required this.isSavedLoginInfo,
|
||||
required this.isLoading,
|
||||
required this.onLoginSuccess,
|
||||
required this.buttonLabel,
|
||||
|
|
@ -407,7 +374,6 @@ class OAuthLoginButton extends ConsumerWidget {
|
|||
.watch(authenticationProvider.notifier)
|
||||
.setSuccessLoginInfo(
|
||||
accessToken: loginResponseDto.accessToken,
|
||||
isSavedLoginInfo: isSavedLoginInfo,
|
||||
serverUrl: serverEndpointController.text,
|
||||
);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue