Validate entered email address
This commit is contained in:
parent
cea00d8e8f
commit
bf423b2ccd
1 changed files with 7 additions and 0 deletions
|
@ -4,6 +4,8 @@ import 'package:flutter/widgets.dart';
|
|||
import 'package:photos/core/configuration.dart';
|
||||
import 'package:photos/services/user_service.dart';
|
||||
import 'package:photos/ui/common_elements.dart';
|
||||
import 'package:photos/utils/dialog_util.dart';
|
||||
import 'package:photos/utils/email_util.dart';
|
||||
|
||||
class EmailEntryPage extends StatefulWidget {
|
||||
EmailEntryPage({Key key}) : super(key: key);
|
||||
|
@ -60,6 +62,11 @@ class _EmailEntryPageState extends State<EmailEntryPage> {
|
|||
height: 44,
|
||||
child: button("Sign In", onPressed: () {
|
||||
final email = _emailController.text;
|
||||
if (!isValidEmail(email)) {
|
||||
showErrorDialog(context, "Invalid email address",
|
||||
"Please enter a valid email address.");
|
||||
return;
|
||||
}
|
||||
Configuration.instance.setEmail(email);
|
||||
UserService.instance.getOtt(context, email);
|
||||
}),
|
||||
|
|
Loading…
Add table
Reference in a new issue