update forgot password
This commit is contained in:
parent
f4e99a7bbd
commit
9738da6d1d
2 changed files with 28 additions and 3 deletions
|
@ -41,6 +41,20 @@ Future<dynamic> loginPost(data) async {
|
||||||
return {'statusCode': req.statusCode, 'data': req.data};
|
return {'statusCode': req.statusCode, 'data': req.data};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Future<dynamic> resetPost(data) async {
|
||||||
|
Response req = await Dio().post(
|
||||||
|
('$host/request-reset-password'),
|
||||||
|
data: data,
|
||||||
|
options: Options(
|
||||||
|
contentType: Headers.formUrlEncodedContentType,
|
||||||
|
validateStatus: (status) {
|
||||||
|
return status! < 400;
|
||||||
|
},
|
||||||
|
),
|
||||||
|
);
|
||||||
|
return {'statusCode': req.statusCode, 'data': req.data};
|
||||||
|
}
|
||||||
|
|
||||||
Future<dynamic> getSessions(session) async {
|
Future<dynamic> getSessions(session) async {
|
||||||
var req = await Dio()
|
var req = await Dio()
|
||||||
.post('$host/sessions', queryParameters: {'session_token': session});
|
.post('$host/sessions', queryParameters: {'session_token': session});
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
import 'package:flutter/material.dart';
|
import 'package:flutter/material.dart';
|
||||||
import 'package:lottie/lottie.dart';
|
import 'package:lottie/lottie.dart';
|
||||||
|
import 'package:nekoya_flutter/api/api.dart';
|
||||||
import 'package:nekoya_flutter/screens/otp.dart';
|
import 'package:nekoya_flutter/screens/otp.dart';
|
||||||
|
|
||||||
class ForgotPassBody extends StatefulWidget {
|
class ForgotPassBody extends StatefulWidget {
|
||||||
|
@ -10,6 +11,8 @@ class ForgotPassBody extends StatefulWidget {
|
||||||
}
|
}
|
||||||
|
|
||||||
class _ForgotPassBodyState extends State<ForgotPassBody> {
|
class _ForgotPassBodyState extends State<ForgotPassBody> {
|
||||||
|
TextEditingController emailController = TextEditingController();
|
||||||
|
|
||||||
@override
|
@override
|
||||||
Widget build(BuildContext context) {
|
Widget build(BuildContext context) {
|
||||||
return Container(
|
return Container(
|
||||||
|
@ -41,12 +44,16 @@ class _ForgotPassBodyState extends State<ForgotPassBody> {
|
||||||
),
|
),
|
||||||
Container(
|
Container(
|
||||||
padding: const EdgeInsets.only(bottom: 20),
|
padding: const EdgeInsets.only(bottom: 20),
|
||||||
child: const TextField(
|
child: TextField(
|
||||||
|
controller: emailController,
|
||||||
|
keyboardType: TextInputType.emailAddress,
|
||||||
style: TextStyle(color: Colors.white),
|
style: TextStyle(color: Colors.white),
|
||||||
decoration: InputDecoration(
|
decoration: InputDecoration(
|
||||||
border: OutlineInputBorder(),
|
border: OutlineInputBorder(
|
||||||
|
borderSide: BorderSide(color: Colors.white)),
|
||||||
hintText: 'EMAIL',
|
hintText: 'EMAIL',
|
||||||
fillColor: Colors.white),
|
fillColor: Colors.white,
|
||||||
|
hintStyle: TextStyle(color: Colors.white)),
|
||||||
),
|
),
|
||||||
),
|
),
|
||||||
ElevatedButton(
|
ElevatedButton(
|
||||||
|
@ -60,6 +67,10 @@ class _ForgotPassBodyState extends State<ForgotPassBody> {
|
||||||
borderRadius: BorderRadius.circular(18.0),
|
borderRadius: BorderRadius.circular(18.0),
|
||||||
side: const BorderSide(color: Colors.red)))),
|
side: const BorderSide(color: Colors.red)))),
|
||||||
onPressed: () {
|
onPressed: () {
|
||||||
|
Map<String, dynamic> data = {
|
||||||
|
"email": emailController.text,
|
||||||
|
};
|
||||||
|
resetPost(data);
|
||||||
Navigator.push(context,
|
Navigator.push(context,
|
||||||
MaterialPageRoute(builder: (context) => const Otp()));
|
MaterialPageRoute(builder: (context) => const Otp()));
|
||||||
},
|
},
|
||||||
|
|
Loading…
Add table
Reference in a new issue