Create account
This commit is contained in:
parent
4bc6f65d11
commit
05e73c5c38
|
|
@ -15,11 +15,16 @@ class AuthRepository {
|
||||||
|
|
||||||
final WebClient webClient;
|
final WebClient webClient;
|
||||||
|
|
||||||
Future<LoginResponseData> signUp(
|
Future<LoginResponseData> signUp({
|
||||||
{String email,
|
String firstName,
|
||||||
String password,
|
String lastName,
|
||||||
String platform,}) async {
|
String email,
|
||||||
|
String password,
|
||||||
|
String platform,
|
||||||
|
}) async {
|
||||||
final credentials = {
|
final credentials = {
|
||||||
|
'first_name': firstName,
|
||||||
|
'last_name': lastName,
|
||||||
'token_name': 'invoice-ninja-$platform-app',
|
'token_name': 'invoice-ninja-$platform-app',
|
||||||
'api_secret': Config.API_SECRET,
|
'api_secret': Config.API_SECRET,
|
||||||
'email': email,
|
'email': email,
|
||||||
|
|
|
||||||
|
|
@ -121,6 +121,8 @@ Middleware<AppState> _createSignUpRequest(AuthRepository repository) {
|
||||||
email: action.email,
|
email: action.email,
|
||||||
password: action.password,
|
password: action.password,
|
||||||
platform: action.platform,
|
platform: action.platform,
|
||||||
|
firstName: action.firstName,
|
||||||
|
lastName: action.lastName,
|
||||||
)
|
)
|
||||||
.then((data) {
|
.then((data) {
|
||||||
_saveAuthLocal(
|
_saveAuthLocal(
|
||||||
|
|
|
||||||
|
|
@ -202,11 +202,19 @@ class _LoginState extends State<LoginView> {
|
||||||
DecoratedFormField(
|
DecoratedFormField(
|
||||||
label: localization.firstName,
|
label: localization.firstName,
|
||||||
controller: _firstNameController,
|
controller: _firstNameController,
|
||||||
|
autovalidate: _autoValidate,
|
||||||
|
validator: (val) => val.isEmpty || val.trim().isEmpty
|
||||||
|
? localization.pleaseEnterAFirstName
|
||||||
|
: null,
|
||||||
),
|
),
|
||||||
if (_createAccount)
|
if (_createAccount)
|
||||||
DecoratedFormField(
|
DecoratedFormField(
|
||||||
label: localization.lastName,
|
label: localization.lastName,
|
||||||
controller: _lastNameController,
|
controller: _lastNameController,
|
||||||
|
autovalidate: _autoValidate,
|
||||||
|
validator: (val) => val.isEmpty || val.trim().isEmpty
|
||||||
|
? localization.pleaseEnterALastName
|
||||||
|
: null,
|
||||||
),
|
),
|
||||||
TextFormField(
|
TextFormField(
|
||||||
controller: _emailController,
|
controller: _emailController,
|
||||||
|
|
|
||||||
|
|
@ -14,6 +14,8 @@ abstract class LocaleCodeAware {
|
||||||
mixin LocalizationsProvider on LocaleCodeAware {
|
mixin LocalizationsProvider on LocaleCodeAware {
|
||||||
static final Map<String, Map<String, String>> _localizedValues = {
|
static final Map<String, Map<String, String>> _localizedValues = {
|
||||||
'en': {
|
'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_terms_and_privacy' :
|
||||||
'Please agree to the terms of service and privacy policy to create an account.',
|
'Please agree to the terms of service and privacy policy to create an account.',
|
||||||
'i_agree_to_the': 'I agree to the',
|
'i_agree_to_the': 'I agree to the',
|
||||||
|
|
@ -13148,6 +13150,12 @@ mixin LocalizationsProvider on LocaleCodeAware {
|
||||||
String get pleaseEnterAProductKey =>
|
String get pleaseEnterAProductKey =>
|
||||||
_localizedValues[localeCode]['please_enter_a_product_key'];
|
_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 ascending => _localizedValues[localeCode]['ascending'];
|
||||||
|
|
||||||
String get descending => _localizedValues[localeCode]['descending'];
|
String get descending => _localizedValues[localeCode]['descending'];
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue