fix : obscure password in auth
This commit is contained in:
@@ -24,7 +24,7 @@ class AuthLogic extends GetxController {
|
|||||||
|
|
||||||
Rx<GlobalKey<FormState>> formKeyOtp = GlobalKey<FormState>().obs;
|
Rx<GlobalKey<FormState>> formKeyOtp = GlobalKey<FormState>().obs;
|
||||||
Rx<GlobalKey<FormState>> formKeySentOtp = GlobalKey<FormState>().obs;
|
Rx<GlobalKey<FormState>> formKeySentOtp = GlobalKey<FormState>().obs;
|
||||||
Rx<TextEditingController> phoneNumberController = TextEditingController().obs;
|
Rx<TextEditingController> usernameController = TextEditingController().obs;
|
||||||
Rx<TextEditingController> passwordController = TextEditingController().obs;
|
Rx<TextEditingController> passwordController = TextEditingController().obs;
|
||||||
Rx<TextEditingController> phoneOtpNumberController =
|
Rx<TextEditingController> phoneOtpNumberController =
|
||||||
TextEditingController().obs;
|
TextEditingController().obs;
|
||||||
@@ -95,7 +95,7 @@ class AuthLogic extends GetxController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
LoginRequestModel _buildLoginRequest() {
|
LoginRequestModel _buildLoginRequest() {
|
||||||
final phone = phoneNumberController.value.text;
|
final phone = usernameController.value.text;
|
||||||
final pass = passwordController.value.text;
|
final pass = passwordController.value.text;
|
||||||
final code = captchaController.textController.value.text;
|
final code = captchaController.textController.value.text;
|
||||||
final key = captchaController.captchaKey.value;
|
final key = captchaController.captchaKey.value;
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ class AuthPage extends GetView<AuthLogic> {
|
|||||||
minWidth: 40,
|
minWidth: 40,
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
controller.phoneNumberController,
|
controller.usernameController,
|
||||||
),
|
),
|
||||||
const SizedBox(height: 26),
|
const SizedBox(height: 26),
|
||||||
ObxValue(
|
ObxValue(
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
name: rasadyar_auth
|
name: rasadyar_auth
|
||||||
description: "A new Flutter project."
|
description: "A new Flutter project."
|
||||||
version: 0.0.1
|
version: 1.0.2
|
||||||
publish_to: 'none'
|
publish_to: 'none'
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -2,12 +2,7 @@ import 'package:flutter/cupertino.dart';
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:rasadyar_core/core.dart';
|
import 'package:rasadyar_core/core.dart';
|
||||||
|
|
||||||
enum RTextFieldVariant {
|
enum RTextFieldVariant { normal, noBorder, password, passwordNoBorder }
|
||||||
normal,
|
|
||||||
noBorder,
|
|
||||||
password,
|
|
||||||
passwordNoBorder,
|
|
||||||
}
|
|
||||||
|
|
||||||
class RTextField extends StatefulWidget {
|
class RTextField extends StatefulWidget {
|
||||||
final TextEditingController controller;
|
final TextEditingController controller;
|
||||||
@@ -69,29 +64,21 @@ class RTextField extends StatefulWidget {
|
|||||||
this.onSubmitted,
|
this.onSubmitted,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
@override
|
@override
|
||||||
State<RTextField> createState() => _RTextFieldState();
|
State<RTextField> createState() => _RTextFieldState();
|
||||||
|
|
||||||
bool get _isPassword => variant == RTextFieldVariant.password;
|
bool get _isPassword => variant == RTextFieldVariant.password;
|
||||||
|
|
||||||
bool get _noBorder => variant == RTextFieldVariant.noBorder;
|
bool get _noBorder => variant == RTextFieldVariant.noBorder;
|
||||||
|
|
||||||
bool get _passwordNoBorder => variant == RTextFieldVariant.passwordNoBorder;
|
bool get _passwordNoBorder => variant == RTextFieldVariant.passwordNoBorder;
|
||||||
|
|
||||||
|
InputBorder get _inputBorder => _noBorder || _passwordNoBorder
|
||||||
InputBorder get _inputBorder =>
|
? InputBorder.none
|
||||||
_noBorder || _passwordNoBorder ? InputBorder.none : OutlineInputBorder(
|
: OutlineInputBorder(
|
||||||
borderRadius: BorderRadius.circular(8),
|
borderRadius: BorderRadius.circular(8),
|
||||||
borderSide: BorderSide(
|
borderSide: BorderSide(color: AppColor.lightGreyDarkActive, width: 1),
|
||||||
color: AppColor.lightGreyDarkActive,
|
|
||||||
width: 1,
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class _RTextFieldState extends State<RTextField> {
|
class _RTextFieldState extends State<RTextField> {
|
||||||
@@ -103,8 +90,12 @@ class _RTextFieldState extends State<RTextField> {
|
|||||||
if (widget.initText != null) {
|
if (widget.initText != null) {
|
||||||
widget.controller.text = widget.initText!;
|
widget.controller.text = widget.initText!;
|
||||||
}
|
}
|
||||||
|
if (widget._isPassword) {
|
||||||
|
obscure = true;
|
||||||
|
} else {
|
||||||
obscure = widget.obscure;
|
obscure = widget.obscure;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@override
|
@override
|
||||||
void didUpdateWidget(covariant RTextField oldWidget) {
|
void didUpdateWidget(covariant RTextField oldWidget) {
|
||||||
@@ -126,10 +117,7 @@ class _RTextFieldState extends State<RTextField> {
|
|||||||
obscure = !obscure;
|
obscure = !obscure;
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
child: Icon(
|
child: Icon(obscure ? CupertinoIcons.eye : CupertinoIcons.eye_slash, color: AppColor.darkGreyDarkActive),
|
||||||
obscure ? CupertinoIcons.eye : CupertinoIcons.eye_slash,
|
|
||||||
color: AppColor.darkGreyDarkActive,
|
|
||||||
),
|
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
@@ -165,9 +153,7 @@ class _RTextFieldState extends State<RTextField> {
|
|||||||
hintText: widget.hintText,
|
hintText: widget.hintText,
|
||||||
labelText: widget.label,
|
labelText: widget.label,
|
||||||
alignLabelWithHint: true,
|
alignLabelWithHint: true,
|
||||||
labelStyle: AppFonts.yekan14
|
labelStyle: AppFonts.yekan14.copyWith(color: AppColor.lightGreyDarkActive).merge(widget.labelStyle),
|
||||||
.copyWith(color: AppColor.lightGreyDarkActive)
|
|
||||||
.merge(widget.labelStyle),
|
|
||||||
filled: widget.filled || widget._noBorder || widget._passwordNoBorder,
|
filled: widget.filled || widget._noBorder || widget._passwordNoBorder,
|
||||||
fillColor: widget.filledColor,
|
fillColor: widget.filledColor,
|
||||||
counter: widget.showCounter ? null : const SizedBox(),
|
counter: widget.showCounter ? null : const SizedBox(),
|
||||||
|
|||||||
Reference in New Issue
Block a user