Login fixes
This commit is contained in:
parent
329a4a3817
commit
729624fcff
|
|
@ -4,6 +4,7 @@ import 'package:invoiceninja_flutter/data/models/entities.dart';
|
|||
// This version must be updated in tandem with the pubspec version.
|
||||
const String kSiteUrl = 'https://invoiceninja.com';
|
||||
const String kAppUrl = 'https://invoicing.co';
|
||||
const String kAppStagingUrl = 'https://staging.invoicing.co';
|
||||
const String kWhiteLabelUrl =
|
||||
'https://app.invoiceninja.com/buy_now/?account_key=AsFmBAeLXF0IKf7tmi0eiyZfmWW9hxMT&product_id=3';
|
||||
|
||||
|
|
@ -192,7 +193,7 @@ const String kGenerateNumberWhenSaved = 'when_saved';
|
|||
const String kGenerateNumberWhenSent = 'when_sent';
|
||||
//const String kNumberGeneratedWhenPaid = 'paid';
|
||||
|
||||
const String kDesignCleanId = 'Wpmbk5ezJn';
|
||||
const String kDesignCleanId = 'G0KQng2RBY';
|
||||
|
||||
const String kDesignHeader = 'header';
|
||||
const String kDesignBody = 'body';
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
import 'dart:async';
|
||||
import 'dart:convert';
|
||||
import 'dart:core';
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:invoiceninja_flutter/.env.dart';
|
||||
import 'package:invoiceninja_flutter/constants.dart';
|
||||
|
|
@ -35,10 +36,12 @@ class AuthRepository {
|
|||
'token_name': '${Config.PLATFORM.toLowerCase()}-client',
|
||||
};
|
||||
|
||||
final signupUrl =
|
||||
formatApiUrl((url ?? '').isEmpty ? kAppUrl : url) + '/signup';
|
||||
if ((url ?? '').isEmpty) {
|
||||
url = kReleaseMode ? kAppUrl : kAppStagingUrl;
|
||||
}
|
||||
|
||||
return sendRequest(url: signupUrl, data: credentials, secret: secret);
|
||||
return sendRequest(
|
||||
url: formatApiUrl(url) + '/signup', data: credentials, secret: secret);
|
||||
}
|
||||
|
||||
Future<LoginResponse> login(
|
||||
|
|
|
|||
|
|
@ -136,7 +136,7 @@ String _checkUrl(String url) {
|
|||
Map<String, String> _getHeaders(String token,
|
||||
{String secret, String password}) {
|
||||
final headers = {
|
||||
'X-API-Secret': (secret ?? '').isNotEmpty ? secret : Config.API_SECRET,
|
||||
'X-API-SECRET': (secret ?? '').isNotEmpty ? secret : Config.API_SECRET,
|
||||
'X-Requested-With': 'XMLHttpRequest',
|
||||
'Content-Type': 'application/json',
|
||||
};
|
||||
|
|
|
|||
|
|
@ -521,7 +521,7 @@ abstract class AppState implements Built<AppState, AppStateBuilder> {
|
|||
//return 'Invitations: ${invoiceUIState.editing.invitations}';
|
||||
//return 'Token: ${userCompanyStates.map((state) => state.token.token).where((name) => name.isNotEmpty).toList().join(', ')}';
|
||||
//return 'Settings: ${company.settings.companyLogo}';
|
||||
//return 'Designs: ${company.designs}';
|
||||
//return 'Designs: ${designState.list.map((id) => id + ' ' + designState.map[id].name).toList()}';
|
||||
//return 'PDF Variables: ${uiState.settingsUIState.settings.pdfVariables}';
|
||||
//return 'Account: ${userCompany.account}';
|
||||
//return 'Notifications: ${user.userCompany.notifications} ${uiState.settingsUIState.user.userCompany.notifications}';
|
||||
|
|
|
|||
|
|
@ -194,8 +194,6 @@ class _LoginState extends State<LoginView> {
|
|||
password: _passwordController.text,
|
||||
firstName: _firstNameController.text,
|
||||
lastName: _lastNameController.text,
|
||||
url: _urlController.text,
|
||||
secret: _secretController.text,
|
||||
);
|
||||
} else {
|
||||
viewModel.onGoogleSignUpPressed(context, completer);
|
||||
|
|
@ -276,7 +274,7 @@ class _LoginState extends State<LoginView> {
|
|||
final TextStyle linkStyle = themeData.textTheme.body1
|
||||
.copyWith(color: convertHexStringToColor(kDefaultAccentColor));
|
||||
//final showHostedOptions = viewModel.authState.isHosted || !kIsWeb;
|
||||
final showHostedOptions = false;
|
||||
final showHostedOptions = !kReleaseMode;
|
||||
|
||||
return Stack(
|
||||
children: <Widget>[
|
||||
|
|
|
|||
|
|
@ -75,8 +75,6 @@ class LoginVM {
|
|||
@required String lastName,
|
||||
@required String email,
|
||||
@required String password,
|
||||
@required String url,
|
||||
@required String secret,
|
||||
}) onSignUpPressed;
|
||||
|
||||
final Function(BuildContext, Completer<Null> completer,
|
||||
|
|
@ -167,25 +165,17 @@ class LoginVM {
|
|||
@required String lastName,
|
||||
@required String email,
|
||||
@required String password,
|
||||
@required String url,
|
||||
@required String secret,
|
||||
}) async {
|
||||
if (store.state.isLoading) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (url.isNotEmpty && !url.startsWith('http')) {
|
||||
url = 'https://' + url;
|
||||
}
|
||||
|
||||
store.dispatch(UserSignUpRequest(
|
||||
completer: completer,
|
||||
firstName: firstName.trim(),
|
||||
lastName: lastName.trim(),
|
||||
email: email.trim(),
|
||||
password: password.trim(),
|
||||
url: url.trim(),
|
||||
secret: secret.trim(),
|
||||
));
|
||||
completer.future.then((_) => _handleLogin(context));
|
||||
},
|
||||
|
|
|
|||
|
|
@ -688,7 +688,7 @@ packages:
|
|||
name: pub_semver
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.4.4"
|
||||
version: "1.4.3"
|
||||
pubspec_parse:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
|
|
|||
Loading…
Reference in New Issue