mirror of
https://github.com/GitJournal/GitJournal.git
synced 2025-08-06 15:21:21 +08:00
Supabase: Experiment with register
This commit is contained in:
@ -90,7 +90,7 @@ limitations under the License.
|
|||||||
<action android:name="android.intent.action.VIEW" />
|
<action android:name="android.intent.action.VIEW" />
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
<category android:name="android.intent.category.DEFAULT" />
|
||||||
<category android:name="android.intent.category.BROWSABLE" />
|
<category android:name="android.intent.category.BROWSABLE" />
|
||||||
<data android:scheme="gitjournal-identity" android:host="login-callback" />
|
<data android:scheme="gitjournal-identity" android:host="register-callback" />
|
||||||
</intent-filter>
|
</intent-filter>
|
||||||
</activity>
|
</activity>
|
||||||
|
|
||||||
|
10
lib/account/init.dart
Normal file
10
lib/account/init.dart
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
import 'package:supabase_flutter/supabase_flutter.dart';
|
||||||
|
|
||||||
|
Future<void> initSupabase() async {
|
||||||
|
await Supabase.initialize(
|
||||||
|
url: 'https://tefpmcttotopcptdivsj.supabase.co',
|
||||||
|
anonKey:
|
||||||
|
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYW5vbiIsImlhdCI6MTYyODA2NDAyNiwiZXhwIjoxOTQzNjQwMDI2fQ.xAN-giE3m1MPjoRkkdcg_0NJueLH0_L-Wu-V0TSnpwU',
|
||||||
|
authCallbackUrlHostname: 'register-callback',
|
||||||
|
);
|
||||||
|
}
|
@ -35,11 +35,6 @@ import 'package:flutter/material.dart';
|
|||||||
|
|
||||||
import 'package:gitjournal/widgets/scroll_view_without_animation.dart';
|
import 'package:gitjournal/widgets/scroll_view_without_animation.dart';
|
||||||
|
|
||||||
//import 'package:gotrue/gotrue.dart';
|
|
||||||
|
|
||||||
// const _localDevServer = 'http://192.168.1.130:9999/';
|
|
||||||
// const _prodServer = 'https://api.gitjournal.io/auth/';
|
|
||||||
|
|
||||||
class LoginPage extends StatefulWidget {
|
class LoginPage extends StatefulWidget {
|
||||||
LoginPage({Key? key, this.title}) : super(key: key);
|
LoginPage({Key? key, this.title}) : super(key: key);
|
||||||
|
|
||||||
@ -148,23 +143,6 @@ class _LoginPageState extends State<LoginPage> {
|
|||||||
fontWeight: FontWeight.w400)),
|
fontWeight: FontWeight.w400)),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
Expanded(
|
|
||||||
flex: 5,
|
|
||||||
child: Container(
|
|
||||||
decoration: const BoxDecoration(
|
|
||||||
color: Color(0xff2872ba),
|
|
||||||
borderRadius: BorderRadius.only(
|
|
||||||
bottomRight: Radius.circular(5),
|
|
||||||
topRight: Radius.circular(5)),
|
|
||||||
),
|
|
||||||
alignment: Alignment.center,
|
|
||||||
child: const Text('Log in with Facebook',
|
|
||||||
style: TextStyle(
|
|
||||||
color: Colors.white,
|
|
||||||
fontSize: 18,
|
|
||||||
fontWeight: FontWeight.w400)),
|
|
||||||
),
|
|
||||||
),
|
|
||||||
],
|
],
|
||||||
),
|
),
|
||||||
);
|
);
|
||||||
|
@ -1,6 +1,10 @@
|
|||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
|
|
||||||
|
import 'package:gotrue/gotrue.dart';
|
||||||
|
import 'package:supabase_flutter/supabase_flutter.dart';
|
||||||
|
|
||||||
import 'package:gitjournal/account/login_screen.dart';
|
import 'package:gitjournal/account/login_screen.dart';
|
||||||
|
import 'package:gitjournal/settings/settings_git_remote.dart';
|
||||||
|
|
||||||
class SignUpScreen extends StatefulWidget {
|
class SignUpScreen extends StatefulWidget {
|
||||||
SignUpScreen({Key? key}) : super(key: key);
|
SignUpScreen({Key? key}) : super(key: key);
|
||||||
@ -11,27 +15,25 @@ class SignUpScreen extends StatefulWidget {
|
|||||||
|
|
||||||
class _SignUpScreenState extends State<SignUpScreen> {
|
class _SignUpScreenState extends State<SignUpScreen> {
|
||||||
Widget _submitButton() {
|
Widget _submitButton() {
|
||||||
return Container(
|
return Button(
|
||||||
width: MediaQuery.of(context).size.width,
|
text: "Register Now",
|
||||||
padding: const EdgeInsets.symmetric(vertical: 15),
|
onPressed: () async {
|
||||||
alignment: Alignment.center,
|
var auth = Supabase.instance.client.auth;
|
||||||
decoration: BoxDecoration(
|
var result = await auth.signUp(
|
||||||
borderRadius: const BorderRadius.all(Radius.circular(5)),
|
'test@gitjournal.io',
|
||||||
boxShadow: <BoxShadow>[
|
'hellohello',
|
||||||
BoxShadow(
|
options: AuthOptions(
|
||||||
color: Colors.grey.shade200,
|
redirectTo: 'gitjournal-identity://register-callback',
|
||||||
offset: const Offset(2, 4),
|
),
|
||||||
blurRadius: 5,
|
);
|
||||||
spreadRadius: 2)
|
|
||||||
],
|
if (result.data == null && result.error == null) {
|
||||||
gradient: const LinearGradient(
|
// Email Validation
|
||||||
begin: Alignment.centerLeft,
|
}
|
||||||
end: Alignment.centerRight,
|
if (result.error != null) {
|
||||||
colors: [Color(0xfffbb448), Color(0xfff7892b)])),
|
// Show the error
|
||||||
child: const Text(
|
}
|
||||||
'Register Now',
|
},
|
||||||
style: TextStyle(fontSize: 20, color: Colors.white),
|
|
||||||
),
|
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,8 +7,8 @@ import 'package:easy_localization/easy_localization.dart';
|
|||||||
import 'package:easy_logger/easy_logger.dart';
|
import 'package:easy_logger/easy_logger.dart';
|
||||||
import 'package:shared_preferences/shared_preferences.dart';
|
import 'package:shared_preferences/shared_preferences.dart';
|
||||||
import 'package:stack_trace/stack_trace.dart';
|
import 'package:stack_trace/stack_trace.dart';
|
||||||
import 'package:supabase_flutter/supabase_flutter.dart';
|
|
||||||
|
|
||||||
|
import 'package:gitjournal/account/init.dart';
|
||||||
import 'package:gitjournal/app.dart';
|
import 'package:gitjournal/app.dart';
|
||||||
import 'package:gitjournal/error_reporting.dart';
|
import 'package:gitjournal/error_reporting.dart';
|
||||||
import 'package:gitjournal/settings/app_settings.dart';
|
import 'package:gitjournal/settings/app_settings.dart';
|
||||||
@ -21,13 +21,7 @@ void main() async {
|
|||||||
LevelMessages.warning,
|
LevelMessages.warning,
|
||||||
];
|
];
|
||||||
|
|
||||||
// FIXME: Does this need to be done over here?
|
initSupabase();
|
||||||
await Supabase.initialize(
|
|
||||||
url: 'https://tefpmcttotopcptdivsj.supabase.co',
|
|
||||||
anonKey:
|
|
||||||
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYW5vbiIsImlhdCI6MTYyODA2NDAyNiwiZXhwIjoxOTQzNjQwMDI2fQ.xAN-giE3m1MPjoRkkdcg_0NJueLH0_L-Wu-V0TSnpwU',
|
|
||||||
authCallbackUrlHostname: 'login-callback',
|
|
||||||
);
|
|
||||||
|
|
||||||
var pref = await SharedPreferences.getInstance();
|
var pref = await SharedPreferences.getInstance();
|
||||||
AppSettings.instance.load(pref);
|
AppSettings.instance.load(pref);
|
||||||
|
Reference in New Issue
Block a user