Change PasswordIntegration #1
This commit is contained in:
@@ -10,6 +10,7 @@
|
||||
analyzer:
|
||||
errors:
|
||||
dead_code: ignore
|
||||
non_constant_identifier_names: ignore
|
||||
include: package:flutter_lints/flutter.yaml
|
||||
|
||||
linter:
|
||||
|
@@ -0,0 +1,59 @@
|
||||
import 'package:dio/dio.dart';
|
||||
|
||||
class ChangePasswordService {
|
||||
final Dio _dio;
|
||||
|
||||
ChangePasswordService(this._dio);
|
||||
|
||||
Future getOtp({
|
||||
required String mobileNumber,
|
||||
}) async {
|
||||
final response = await _dio.post(
|
||||
'/api/otp/send',
|
||||
queryParameters: {
|
||||
'mobileNumber': mobileNumber,
|
||||
'type': "CHANGE_LPWORD"
|
||||
},
|
||||
);
|
||||
if (response.statusCode != 200) {
|
||||
throw Exception("Invalid Mobile Number/Type");
|
||||
}
|
||||
return response.toString();
|
||||
}
|
||||
|
||||
|
||||
Future validateOtp({
|
||||
required String otp,
|
||||
required String mobileNumber,
|
||||
}) async {
|
||||
final response = await _dio.post(
|
||||
'/api/otp/verify?mobileNumber=$mobileNumber',
|
||||
queryParameters: {
|
||||
'otp' : otp,
|
||||
},
|
||||
);
|
||||
if (response.statusCode != 200) {
|
||||
throw Exception("Wrong OTP");
|
||||
}
|
||||
return response.toString();
|
||||
}
|
||||
|
||||
Future validateChangePwd({
|
||||
required String OldLPsw,
|
||||
required String newLPsw,
|
||||
required String confirmLPsw,
|
||||
}) async {
|
||||
final response = await _dio.post(
|
||||
'/api/auth/change/login_password',
|
||||
queryParameters: {
|
||||
'OldLPsw': OldLPsw,
|
||||
'newLPsw': newLPsw,
|
||||
'confirmLPsw': confirmLPsw,
|
||||
},
|
||||
);
|
||||
if (response.statusCode != 200) {
|
||||
throw Exception("Wrong OTP");
|
||||
}
|
||||
return response.toString();
|
||||
}
|
||||
}
|
@@ -1,16 +0,0 @@
|
||||
class Otp {
|
||||
final String mobileNumber;
|
||||
final String type;
|
||||
|
||||
Otp({
|
||||
required this.mobileNumber,
|
||||
required this.type,
|
||||
});
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'mobileNumber': mobileNumber,
|
||||
'type': type,
|
||||
};
|
||||
}
|
||||
}
|
@@ -1,14 +0,0 @@
|
||||
class OtpVerify{
|
||||
final String otp;
|
||||
|
||||
OtpVerify({
|
||||
required this.otp,
|
||||
}
|
||||
);
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
return {
|
||||
'otp': otp,
|
||||
};
|
||||
}
|
||||
}
|
@@ -1,4 +1,4 @@
|
||||
import 'dart:developer';
|
||||
|
||||
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:intl/intl.dart';
|
||||
|
@@ -72,7 +72,7 @@ class _ChangePasswordScreenState extends State<ChangePasswordScreen> {
|
||||
@override
|
||||
Widget build(BuildContext context) {
|
||||
return Scaffold(
|
||||
appBar: AppBar(title: Text(AppLocalizations.of(context).changePassword)),
|
||||
appBar: AppBar(title: Text(AppLocalizations.of(context).changeLoginPassword)),
|
||||
body: Padding(
|
||||
padding: const EdgeInsets.all(16),
|
||||
child: Form(
|
||||
|
@@ -43,7 +43,7 @@ class ProfileScreen extends StatelessWidget {
|
||||
),
|
||||
ListTile(
|
||||
leading: const Icon(Icons.password),
|
||||
title: Text(loc.changePassword),
|
||||
title: Text(loc.changeLoginPassword),
|
||||
onTap: () {
|
||||
Navigator.push(
|
||||
context,
|
||||
|
@@ -292,5 +292,5 @@
|
||||
"viewCardDeatils": "View Card Details",
|
||||
"logout": "Logout",
|
||||
"logoutCheck": "Are you sure you want to logout?",
|
||||
"changePassword": "Change Password"
|
||||
"changeLoginPassword": "Change Login Password"
|
||||
}
|
||||
|
@@ -293,5 +293,5 @@
|
||||
"viewCardDeatils": "कार्ड विवरण देखें",
|
||||
"logout": "लॉग आउट",
|
||||
"logoutCheck": "क्या आप लॉग आउट करना चाहते हैं?",
|
||||
"changePassword": "पासवर्ड बदलें"
|
||||
"changeLoginPassword": "लॉगिन पासवर्ड बदलें"
|
||||
}
|
||||
|
@@ -17,13 +17,13 @@ void main() async {
|
||||
]);
|
||||
|
||||
// Check for device compromise
|
||||
final compromisedMessage = await SecurityService.deviceCompromisedMessage;
|
||||
if (compromisedMessage != null) {
|
||||
runApp(MaterialApp(
|
||||
home: SecurityErrorScreen(message: compromisedMessage),
|
||||
));
|
||||
return;
|
||||
}
|
||||
// final compromisedMessage = await SecurityService.deviceCompromisedMessage;
|
||||
// if (compromisedMessage != null) {
|
||||
// runApp(MaterialApp(
|
||||
// home: SecurityErrorScreen(message: compromisedMessage),
|
||||
// ));
|
||||
// return;
|
||||
// }
|
||||
|
||||
// Initialize dependencies
|
||||
await setupDependencies();
|
||||
|
Reference in New Issue
Block a user