Merge pull request #4513 from fufesou/refact/remove_auto_login

remove auto login checkbox
This commit is contained in:
RustDesk 2023-05-31 18:50:52 +08:00 committed by GitHub
commit 31cec1a896
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -95,13 +95,11 @@ class ConfigOP {
class WidgetOP extends StatefulWidget { class WidgetOP extends StatefulWidget {
final ConfigOP config; final ConfigOP config;
final RxString curOP; final RxString curOP;
final RxBool autoLogin;
final Function(String) cbLogin; final Function(String) cbLogin;
const WidgetOP({ const WidgetOP({
Key? key, Key? key,
required this.config, required this.config,
required this.curOP, required this.curOP,
required this.autoLogin,
required this.cbLogin, required this.cbLogin,
}) : super(key: key); }) : super(key: key);
@ -190,7 +188,7 @@ class _WidgetOPState extends State<WidgetOP> {
onTap: () async { onTap: () async {
_resetState(); _resetState();
widget.curOP.value = widget.config.op; widget.curOP.value = widget.config.op;
await bind.mainAccountAuth(op: widget.config.op, rememberMe: widget.autoLogin.value); await bind.mainAccountAuth(op: widget.config.op, rememberMe: true);
_beginQueryState(); _beginQueryState();
}, },
), ),
@ -256,14 +254,12 @@ class _WidgetOPState extends State<WidgetOP> {
class LoginWidgetOP extends StatelessWidget { class LoginWidgetOP extends StatelessWidget {
final List<ConfigOP> ops; final List<ConfigOP> ops;
final RxString curOP; final RxString curOP;
final RxBool autoLogin;
final Function(String) cbLogin; final Function(String) cbLogin;
LoginWidgetOP({ LoginWidgetOP({
Key? key, Key? key,
required this.ops, required this.ops,
required this.curOP, required this.curOP,
required this.autoLogin,
required this.cbLogin, required this.cbLogin,
}) : super(key: key); }) : super(key: key);
@ -274,7 +270,6 @@ class LoginWidgetOP extends StatelessWidget {
WidgetOP( WidgetOP(
config: op, config: op,
curOP: curOP, curOP: curOP,
autoLogin: autoLogin,
cbLogin: cbLogin, cbLogin: cbLogin,
), ),
const Divider( const Divider(
@ -305,7 +300,6 @@ class LoginWidgetUserPass extends StatelessWidget {
final String? passMsg; final String? passMsg;
final bool isInProgress; final bool isInProgress;
final RxString curOP; final RxString curOP;
final RxBool autoLogin;
final Function() onLogin; final Function() onLogin;
final FocusNode? userFocusNode; final FocusNode? userFocusNode;
const LoginWidgetUserPass({ const LoginWidgetUserPass({
@ -317,7 +311,6 @@ class LoginWidgetUserPass extends StatelessWidget {
required this.passMsg, required this.passMsg,
required this.isInProgress, required this.isInProgress,
required this.curOP, required this.curOP,
required this.autoLogin,
required this.onLogin, required this.onLogin,
}) : super(key: key); }) : super(key: key);
@ -340,19 +333,6 @@ class LoginWidgetUserPass extends StatelessWidget {
autoFocus: false, autoFocus: false,
errorText: passMsg, errorText: passMsg,
), ),
Obx(() => CheckboxListTile(
contentPadding: const EdgeInsets.all(0),
dense: true,
controlAffinity: ListTileControlAffinity.leading,
title: Text(
translate("Remember me"),
),
value: autoLogin.value,
onChanged: (v) {
if (v == null) return;
autoLogin.value = v;
},
)),
Offstage( Offstage(
offstage: !isInProgress, offstage: !isInProgress,
child: const LinearProgressIndicator()), child: const LinearProgressIndicator()),
@ -393,7 +373,6 @@ Future<bool?> loginDialog() async {
String? usernameMsg; String? usernameMsg;
String? passwordMsg; String? passwordMsg;
var isInProgress = false; var isInProgress = false;
final autoLogin = true.obs;
final RxString curOP = ''.obs; final RxString curOP = ''.obs;
final res = await gFFI.dialogManager.show<bool>((setState, close, context) { final res = await gFFI.dialogManager.show<bool>((setState, close, context) {
@ -432,7 +411,6 @@ Future<bool?> loginDialog() async {
password: password.text, password: password.text,
id: await bind.mainGetMyId(), id: await bind.mainGetMyId(),
uuid: await bind.mainGetUuid(), uuid: await bind.mainGetUuid(),
autoLogin: autoLogin.value,
type: HttpType.kAuthReqTypeAccount)); type: HttpType.kAuthReqTypeAccount));
switch (resp.type) { switch (resp.type) {
@ -483,7 +461,6 @@ Future<bool?> loginDialog() async {
passMsg: passwordMsg, passMsg: passwordMsg,
isInProgress: isInProgress, isInProgress: isInProgress,
curOP: curOP, curOP: curOP,
autoLogin: autoLogin,
onLogin: onLogin, onLogin: onLogin,
userFocusNode: userFocusNode, userFocusNode: userFocusNode,
), ),
@ -505,7 +482,6 @@ Future<bool?> loginDialog() async {
ConfigOP(op: 'Okta', iconWidth: 38), ConfigOP(op: 'Okta', iconWidth: 38),
], ],
curOP: curOP, curOP: curOP,
autoLogin: autoLogin,
cbLogin: (String username) { cbLogin: (String username) {
gFFI.userModel.userName.value = username; gFFI.userModel.userName.value = username;
close(true); close(true);