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" />
|
||||
<category android:name="android.intent.category.DEFAULT" />
|
||||
<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>
|
||||
</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:gotrue/gotrue.dart';
|
||||
|
||||
// const _localDevServer = 'http://192.168.1.130:9999/';
|
||||
// const _prodServer = 'https://api.gitjournal.io/auth/';
|
||||
|
||||
class LoginPage extends StatefulWidget {
|
||||
LoginPage({Key? key, this.title}) : super(key: key);
|
||||
|
||||
@ -148,23 +143,6 @@ class _LoginPageState extends State<LoginPage> {
|
||||
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:gotrue/gotrue.dart';
|
||||
import 'package:supabase_flutter/supabase_flutter.dart';
|
||||
|
||||
import 'package:gitjournal/account/login_screen.dart';
|
||||
import 'package:gitjournal/settings/settings_git_remote.dart';
|
||||
|
||||
class SignUpScreen extends StatefulWidget {
|
||||
SignUpScreen({Key? key}) : super(key: key);
|
||||
@ -11,27 +15,25 @@ class SignUpScreen extends StatefulWidget {
|
||||
|
||||
class _SignUpScreenState extends State<SignUpScreen> {
|
||||
Widget _submitButton() {
|
||||
return Container(
|
||||
width: MediaQuery.of(context).size.width,
|
||||
padding: const EdgeInsets.symmetric(vertical: 15),
|
||||
alignment: Alignment.center,
|
||||
decoration: BoxDecoration(
|
||||
borderRadius: const BorderRadius.all(Radius.circular(5)),
|
||||
boxShadow: <BoxShadow>[
|
||||
BoxShadow(
|
||||
color: Colors.grey.shade200,
|
||||
offset: const Offset(2, 4),
|
||||
blurRadius: 5,
|
||||
spreadRadius: 2)
|
||||
],
|
||||
gradient: const LinearGradient(
|
||||
begin: Alignment.centerLeft,
|
||||
end: Alignment.centerRight,
|
||||
colors: [Color(0xfffbb448), Color(0xfff7892b)])),
|
||||
child: const Text(
|
||||
'Register Now',
|
||||
style: TextStyle(fontSize: 20, color: Colors.white),
|
||||
),
|
||||
return Button(
|
||||
text: "Register Now",
|
||||
onPressed: () async {
|
||||
var auth = Supabase.instance.client.auth;
|
||||
var result = await auth.signUp(
|
||||
'test@gitjournal.io',
|
||||
'hellohello',
|
||||
options: AuthOptions(
|
||||
redirectTo: 'gitjournal-identity://register-callback',
|
||||
),
|
||||
);
|
||||
|
||||
if (result.data == null && result.error == null) {
|
||||
// Email Validation
|
||||
}
|
||||
if (result.error != null) {
|
||||
// Show the error
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -7,8 +7,8 @@ import 'package:easy_localization/easy_localization.dart';
|
||||
import 'package:easy_logger/easy_logger.dart';
|
||||
import 'package:shared_preferences/shared_preferences.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/error_reporting.dart';
|
||||
import 'package:gitjournal/settings/app_settings.dart';
|
||||
@ -21,13 +21,7 @@ void main() async {
|
||||
LevelMessages.warning,
|
||||
];
|
||||
|
||||
// FIXME: Does this need to be done over here?
|
||||
await Supabase.initialize(
|
||||
url: 'https://tefpmcttotopcptdivsj.supabase.co',
|
||||
anonKey:
|
||||
'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJyb2xlIjoiYW5vbiIsImlhdCI6MTYyODA2NDAyNiwiZXhwIjoxOTQzNjQwMDI2fQ.xAN-giE3m1MPjoRkkdcg_0NJueLH0_L-Wu-V0TSnpwU',
|
||||
authCallbackUrlHostname: 'login-callback',
|
||||
);
|
||||
initSupabase();
|
||||
|
||||
var pref = await SharedPreferences.getInstance();
|
||||
AppSettings.instance.load(pref);
|
||||
|
Reference in New Issue
Block a user