hide cleartext password
Signed-off-by: ImFatF1sh <imfatf1sh@protonmail.com>
This commit is contained in:
parent
f91601661d
commit
0e998ba3b5
|
@ -148,7 +148,7 @@ Future<T?> chooseMapDialog<T>(
|
||||||
var _controller = TextEditingController.fromValue(TextEditingValue(text: ''));
|
var _controller = TextEditingController.fromValue(TextEditingValue(text: ''));
|
||||||
|
|
||||||
Future<String?> displayTextInputDialog(BuildContext context,
|
Future<String?> displayTextInputDialog(BuildContext context,
|
||||||
{String? title, String src = "", String? hint, String? desc}) {
|
{String? title, String src = "", String? hint, String? desc, bool isPasswd = false}) {
|
||||||
_controller.text = src;
|
_controller.text = src;
|
||||||
return showDialog(
|
return showDialog(
|
||||||
context: context,
|
context: context,
|
||||||
|
@ -161,6 +161,8 @@ Future<String?> displayTextInputDialog(BuildContext context,
|
||||||
TextField(
|
TextField(
|
||||||
controller: _controller,
|
controller: _controller,
|
||||||
decoration: InputDecoration(hintText: hint),
|
decoration: InputDecoration(hintText: hint),
|
||||||
|
obscureText: isPasswd,
|
||||||
|
obscuringCharacter: '\u2022',
|
||||||
),
|
),
|
||||||
...(desc == null
|
...(desc == null
|
||||||
? []
|
? []
|
||||||
|
|
|
@ -95,13 +95,14 @@ class _AccountScreenState extends State<AccountScreen> {
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
title: Text("密码"),
|
title: Text("密码"),
|
||||||
subtitle: Text(_password == "" ? "未设置" : "******"),
|
subtitle: Text(_password == "" ? "未设置" : '\u2022' * 48),
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
String? input = await displayTextInputDialog(
|
String? input = await displayTextInputDialog(
|
||||||
context,
|
context,
|
||||||
src: _password,
|
src: _password,
|
||||||
title: '密码',
|
title: '密码',
|
||||||
hint: '请输入密码',
|
hint: '请输入密码',
|
||||||
|
isPasswd: true,
|
||||||
);
|
);
|
||||||
if (input != null) {
|
if (input != null) {
|
||||||
await method.setPassword(input);
|
await method.setPassword(input);
|
||||||
|
|
|
@ -99,7 +99,6 @@ class _RegisterScreenState extends State<RegisterScreen> {
|
||||||
Text('您已经注册成功, 请返回登录'),
|
Text('您已经注册成功, 请返回登录'),
|
||||||
Text('账号 : $_email'),
|
Text('账号 : $_email'),
|
||||||
Text('昵称 : $_name'),
|
Text('昵称 : $_name'),
|
||||||
Text('密码 : $_password'),
|
|
||||||
Expanded(child: Container()),
|
Expanded(child: Container()),
|
||||||
Expanded(child: Container()),
|
Expanded(child: Container()),
|
||||||
],
|
],
|
||||||
|
@ -140,13 +139,14 @@ class _RegisterScreenState extends State<RegisterScreen> {
|
||||||
),
|
),
|
||||||
ListTile(
|
ListTile(
|
||||||
title: Text("密码 (8位以上)"),
|
title: Text("密码 (8位以上)"),
|
||||||
subtitle: Text(_password == "" ? "未设置" : _password),
|
subtitle: Text(_password == "" ? "未设置" : '\u2022' * 48),
|
||||||
onTap: () async {
|
onTap: () async {
|
||||||
String? input = await displayTextInputDialog(
|
String? input = await displayTextInputDialog(
|
||||||
context,
|
context,
|
||||||
src: _password,
|
src: _password,
|
||||||
title: '密码',
|
title: '密码',
|
||||||
hint: '请输入密码',
|
hint: '请输入密码',
|
||||||
|
isPasswd: true,
|
||||||
);
|
);
|
||||||
if (input != null) {
|
if (input != null) {
|
||||||
setState(() {
|
setState(() {
|
||||||
|
|
Loading…
Reference in New Issue