Create account

This commit is contained in:
Hillel Coren 2019-08-26 12:45:14 +03:00
parent 4bc6f65d11
commit 05e73c5c38
4 changed files with 27 additions and 4 deletions

View File

@ -15,11 +15,16 @@ class AuthRepository {
final WebClient webClient;
Future<LoginResponseData> signUp(
{String email,
String password,
String platform,}) async {
Future<LoginResponseData> signUp({
String firstName,
String lastName,
String email,
String password,
String platform,
}) async {
final credentials = {
'first_name': firstName,
'last_name': lastName,
'token_name': 'invoice-ninja-$platform-app',
'api_secret': Config.API_SECRET,
'email': email,

View File

@ -121,6 +121,8 @@ Middleware<AppState> _createSignUpRequest(AuthRepository repository) {
email: action.email,
password: action.password,
platform: action.platform,
firstName: action.firstName,
lastName: action.lastName,
)
.then((data) {
_saveAuthLocal(

View File

@ -202,11 +202,19 @@ class _LoginState extends State<LoginView> {
DecoratedFormField(
label: localization.firstName,
controller: _firstNameController,
autovalidate: _autoValidate,
validator: (val) => val.isEmpty || val.trim().isEmpty
? localization.pleaseEnterAFirstName
: null,
),
if (_createAccount)
DecoratedFormField(
label: localization.lastName,
controller: _lastNameController,
autovalidate: _autoValidate,
validator: (val) => val.isEmpty || val.trim().isEmpty
? localization.pleaseEnterALastName
: null,
),
TextFormField(
controller: _emailController,

View File

@ -14,6 +14,8 @@ abstract class LocaleCodeAware {
mixin LocalizationsProvider on LocaleCodeAware {
static final Map<String, Map<String, String>> _localizedValues = {
'en': {
'please_enter_a_first_name': 'Please enter a first name',
'please_enter_a_last_name': 'Please enter a last name',
'please_agree_to_terms_and_privacy' :
'Please agree to the terms of service and privacy policy to create an account.',
'i_agree_to_the': 'I agree to the',
@ -13148,6 +13150,12 @@ mixin LocalizationsProvider on LocaleCodeAware {
String get pleaseEnterAProductKey =>
_localizedValues[localeCode]['please_enter_a_product_key'];
String get pleaseEnterAFirstName =>
_localizedValues[localeCode]['please_enter_a_last_name'];
String get pleaseEnterALastName =>
_localizedValues[localeCode]['please_enter_a_first_name'];
String get ascending => _localizedValues[localeCode]['ascending'];
String get descending => _localizedValues[localeCode]['descending'];