Add a link to "how it works"
This commit is contained in:
parent
0f4d082048
commit
e42d478aa3
|
@ -1,8 +1,13 @@
|
|||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter/widgets.dart';
|
||||
import 'package:flutter_markdown/flutter_markdown.dart';
|
||||
import 'package:flutter_password_strength/flutter_password_strength.dart';
|
||||
import 'package:photos/core/network.dart';
|
||||
import 'package:photos/services/user_service.dart';
|
||||
import 'package:photos/ui/common_elements.dart';
|
||||
import 'package:photos/ui/loading_widget.dart';
|
||||
import 'package:photos/ui/subscription_page.dart';
|
||||
import 'package:photos/ui/web_page.dart';
|
||||
import 'package:photos/utils/dialog_util.dart';
|
||||
|
||||
class PasswordEntryPage extends StatefulWidget {
|
||||
|
@ -43,102 +48,126 @@ class _PasswordEntryPageState extends State<PasswordEntryPage> {
|
|||
_passwordStrength = strength;
|
||||
},
|
||||
),
|
||||
Expanded(
|
||||
child: SingleChildScrollView(
|
||||
child: Container(
|
||||
padding: EdgeInsets.fromLTRB(16, 36, 16, 16),
|
||||
child: Column(
|
||||
children: [
|
||||
// Image.asset(
|
||||
// "assets/vault.png",
|
||||
// width: 196,
|
||||
// height: 196,
|
||||
// ),
|
||||
Padding(padding: EdgeInsets.all(12)),
|
||||
Text(
|
||||
"enter a password we can use to encrypt your data",
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
height: 1.3,
|
||||
),
|
||||
SingleChildScrollView(
|
||||
child: Container(
|
||||
padding: EdgeInsets.fromLTRB(16, 36, 16, 16),
|
||||
child: Column(
|
||||
children: [
|
||||
// Image.asset(
|
||||
// "assets/vault.png",
|
||||
// width: 196,
|
||||
// height: 196,
|
||||
// ),
|
||||
Padding(padding: EdgeInsets.all(12)),
|
||||
Text(
|
||||
"enter a password we can use to encrypt your data",
|
||||
textAlign: TextAlign.center,
|
||||
style: TextStyle(
|
||||
height: 1.3,
|
||||
),
|
||||
Padding(padding: EdgeInsets.all(8)),
|
||||
Text("we don't store this password, so if you forget, "),
|
||||
Text.rich(
|
||||
TextSpan(
|
||||
text: "we cannot decrypt your data",
|
||||
style: TextStyle(
|
||||
decoration: TextDecoration.underline,
|
||||
fontWeight: FontWeight.bold,
|
||||
)),
|
||||
style: TextStyle(
|
||||
height: 1.3,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
Padding(padding: EdgeInsets.all(12)),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(32, 0, 32, 0),
|
||||
child: TextFormField(
|
||||
decoration: InputDecoration(
|
||||
hintText: "password",
|
||||
contentPadding: EdgeInsets.all(20),
|
||||
),
|
||||
controller: _passwordController1,
|
||||
autofocus: false,
|
||||
autocorrect: false,
|
||||
keyboardType: TextInputType.visiblePassword,
|
||||
onChanged: (_) {
|
||||
setState(() {});
|
||||
},
|
||||
),
|
||||
),
|
||||
Padding(padding: EdgeInsets.all(8)),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(32, 0, 32, 0),
|
||||
child: TextFormField(
|
||||
decoration: InputDecoration(
|
||||
hintText: "password again",
|
||||
contentPadding: EdgeInsets.all(20),
|
||||
),
|
||||
controller: _passwordController2,
|
||||
autofocus: false,
|
||||
autocorrect: false,
|
||||
obscureText: true,
|
||||
keyboardType: TextInputType.visiblePassword,
|
||||
onChanged: (_) {
|
||||
setState(() {});
|
||||
},
|
||||
),
|
||||
),
|
||||
Padding(padding: EdgeInsets.all(20)),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
height: 64,
|
||||
padding: EdgeInsets.fromLTRB(40, 0, 40, 0),
|
||||
child: button(
|
||||
widget.isUpdatePassword
|
||||
? "change password"
|
||||
: "set password",
|
||||
fontSize: 18,
|
||||
onPressed: _passwordController1.text.isNotEmpty &&
|
||||
_passwordController2.text.isNotEmpty
|
||||
? () {
|
||||
if (_passwordController1.text !=
|
||||
_passwordController2.text) {
|
||||
showErrorDialog(context, "uhm...",
|
||||
"the passwords you entered don't match");
|
||||
} else if (_passwordStrength <
|
||||
kPasswordStrengthThreshold) {
|
||||
showErrorDialog(context, "weak password",
|
||||
"the password you have chosen is too simple, please choose another one");
|
||||
} else {
|
||||
_showPasswordConfirmationDialog();
|
||||
}
|
||||
}
|
||||
: null,
|
||||
),
|
||||
Padding(padding: EdgeInsets.all(8)),
|
||||
Text("we don't store this password, so if you forget, "),
|
||||
Text.rich(
|
||||
TextSpan(
|
||||
text: "we cannot decrypt your data",
|
||||
style: TextStyle(
|
||||
decoration: TextDecoration.underline,
|
||||
fontWeight: FontWeight.bold,
|
||||
)),
|
||||
],
|
||||
style: TextStyle(
|
||||
height: 1.3,
|
||||
),
|
||||
textAlign: TextAlign.center,
|
||||
),
|
||||
Padding(padding: EdgeInsets.all(12)),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(32, 0, 32, 0),
|
||||
child: TextFormField(
|
||||
decoration: InputDecoration(
|
||||
hintText: "password",
|
||||
contentPadding: EdgeInsets.all(20),
|
||||
),
|
||||
controller: _passwordController1,
|
||||
autofocus: false,
|
||||
autocorrect: false,
|
||||
keyboardType: TextInputType.visiblePassword,
|
||||
onChanged: (_) {
|
||||
setState(() {});
|
||||
},
|
||||
),
|
||||
),
|
||||
Padding(padding: EdgeInsets.all(8)),
|
||||
Padding(
|
||||
padding: const EdgeInsets.fromLTRB(32, 0, 32, 0),
|
||||
child: TextFormField(
|
||||
decoration: InputDecoration(
|
||||
hintText: "password again",
|
||||
contentPadding: EdgeInsets.all(20),
|
||||
),
|
||||
controller: _passwordController2,
|
||||
autofocus: false,
|
||||
autocorrect: false,
|
||||
obscureText: true,
|
||||
keyboardType: TextInputType.visiblePassword,
|
||||
onChanged: (_) {
|
||||
setState(() {});
|
||||
},
|
||||
),
|
||||
),
|
||||
Padding(padding: EdgeInsets.all(20)),
|
||||
Container(
|
||||
width: double.infinity,
|
||||
height: 64,
|
||||
padding: EdgeInsets.fromLTRB(40, 0, 40, 0),
|
||||
child: button(
|
||||
widget.isUpdatePassword
|
||||
? "change password"
|
||||
: "set password",
|
||||
fontSize: 18,
|
||||
onPressed: _passwordController1.text.isNotEmpty &&
|
||||
_passwordController2.text.isNotEmpty
|
||||
? () {
|
||||
if (_passwordController1.text !=
|
||||
_passwordController2.text) {
|
||||
showErrorDialog(context, "uhm...",
|
||||
"the passwords you entered don't match");
|
||||
} else if (_passwordStrength <
|
||||
kPasswordStrengthThreshold) {
|
||||
showErrorDialog(context, "weak password",
|
||||
"the password you have chosen is too simple, please choose another one");
|
||||
} else {
|
||||
_showPasswordConfirmationDialog();
|
||||
}
|
||||
}
|
||||
: null,
|
||||
),
|
||||
),
|
||||
],
|
||||
),
|
||||
),
|
||||
),
|
||||
Expanded(child: Container()),
|
||||
GestureDetector(
|
||||
behavior: HitTestBehavior.translucent,
|
||||
onTap: () {
|
||||
Navigator.of(context).push(
|
||||
MaterialPageRoute(
|
||||
builder: (BuildContext context) {
|
||||
return WebPage("how it works", "https://ente.io/encryption");
|
||||
},
|
||||
),
|
||||
);
|
||||
},
|
||||
child: Container(
|
||||
padding: EdgeInsets.all(40),
|
||||
child: RichText(
|
||||
text: TextSpan(
|
||||
text: "how it works",
|
||||
style: TextStyle(
|
||||
color: Colors.blue,
|
||||
fontFamily: 'Ubuntu',
|
||||
),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
|
Loading…
Reference in a new issue