added api for forgot password otp
This commit is contained in:
@@ -4,7 +4,6 @@ import 'package:go_router/go_router.dart';
|
||||
import 'package:pinput/pinput.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:tm_app/core/utils/size_config.dart';
|
||||
import 'package:tm_app/views/forget_password_create/pages/forgot_password_create_screen.dart';
|
||||
|
||||
import '../../../core/constants/assets.dart';
|
||||
import '../../../core/theme/colors.dart';
|
||||
@@ -88,20 +87,12 @@ class DesktopForgotPasswordOtpPage extends StatelessWidget {
|
||||
onPressed: null,
|
||||
)
|
||||
: BaseButton(
|
||||
isEnabled:
|
||||
viewModel.canSubmitOtpPage, // 👈 شرط جدید
|
||||
isEnabled: viewModel.canSubmitOtpPage,
|
||||
text: ForgotPasswordOtpStrings.resetLink,
|
||||
onPressed:
|
||||
viewModel.canSubmitOtpPage
|
||||
? () async {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder:
|
||||
(context) =>
|
||||
const ForgotPasswordCreateScreen(),
|
||||
),
|
||||
);
|
||||
await viewModel.verifyOtp(context);
|
||||
}
|
||||
: null,
|
||||
),
|
||||
|
||||
@@ -4,7 +4,6 @@ import 'package:go_router/go_router.dart';
|
||||
import 'package:pinput/pinput.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:tm_app/core/utils/size_config.dart';
|
||||
import 'package:tm_app/views/forget_password_create/pages/forgot_password_create_screen.dart';
|
||||
|
||||
import '../../../core/constants/assets.dart';
|
||||
import '../../../core/theme/colors.dart';
|
||||
@@ -89,14 +88,7 @@ class MobileForgotPasswordOtpPage extends StatelessWidget {
|
||||
onPressed:
|
||||
viewModel.canSubmitOtpPage
|
||||
? () async {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder:
|
||||
(context) =>
|
||||
const ForgotPasswordCreateScreen(),
|
||||
),
|
||||
);
|
||||
await viewModel.verifyOtp(context);
|
||||
}
|
||||
: null,
|
||||
),
|
||||
|
||||
@@ -4,7 +4,6 @@ import 'package:go_router/go_router.dart';
|
||||
import 'package:pinput/pinput.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:tm_app/core/utils/size_config.dart';
|
||||
import 'package:tm_app/views/forget_password_create/pages/forgot_password_create_screen.dart';
|
||||
|
||||
import '../../../core/constants/assets.dart';
|
||||
import '../../../core/theme/colors.dart';
|
||||
@@ -88,20 +87,12 @@ class TabletForgotPasswordOtpPage extends StatelessWidget {
|
||||
onPressed: null,
|
||||
)
|
||||
: BaseButton(
|
||||
isEnabled:
|
||||
viewModel.canSubmitOtpPage, // 👈 شرط جدید
|
||||
isEnabled: viewModel.canSubmitOtpPage,
|
||||
text: ForgotPasswordOtpStrings.resetLink,
|
||||
onPressed:
|
||||
viewModel.canSubmitOtpPage
|
||||
? () async {
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder:
|
||||
(context) =>
|
||||
const ForgotPasswordCreateScreen(),
|
||||
),
|
||||
);
|
||||
await viewModel.verifyOtp(context);
|
||||
}
|
||||
: null,
|
||||
),
|
||||
|
||||
@@ -1,8 +1,9 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:tm_app/core/routes/app_routes.dart';
|
||||
import 'package:tm_app/core/utils/size_config.dart';
|
||||
import 'package:tm_app/views/forget_password_otp.dart/pages/forgot_password_otp_screen.dart';
|
||||
|
||||
import '../../../core/constants/assets.dart';
|
||||
import '../../../core/theme/colors.dart';
|
||||
import '../../../core/utils/app_toast.dart';
|
||||
@@ -24,12 +25,7 @@ class DesktopForgotPasswordPage extends StatelessWidget {
|
||||
if (viewModel.successMessage != null) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
AppToast.success(context, viewModel.successMessage!);
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => const ForgotPasswordOtpScreen(),
|
||||
),
|
||||
);
|
||||
const ForgotPasswordOtpRouteData().push(context);
|
||||
});
|
||||
} else if (viewModel.errorMessage != null) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
@@ -84,19 +80,20 @@ class DesktopForgotPasswordPage extends StatelessWidget {
|
||||
SizedBox(height: 70.0.h()),
|
||||
viewModel.isLoading
|
||||
? const BaseButton(
|
||||
isEnabled: false,
|
||||
text: ForgotPasswordStrings.resetLink,
|
||||
onPressed: null,
|
||||
)
|
||||
isEnabled: false,
|
||||
text: ForgotPasswordStrings.resetLink,
|
||||
onPressed: null,
|
||||
)
|
||||
: BaseButton(
|
||||
isEnabled: viewModel.isEmailValid,
|
||||
text: ForgotPasswordStrings.resetLink,
|
||||
onPressed: viewModel.isEmailValid
|
||||
? () async {
|
||||
isEnabled: viewModel.isEmailValid,
|
||||
text: ForgotPasswordStrings.resetLink,
|
||||
onPressed:
|
||||
viewModel.isEmailValid
|
||||
? () async {
|
||||
await viewModel.forgotPassword(context);
|
||||
}
|
||||
: null,
|
||||
),
|
||||
: null,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
|
||||
@@ -2,11 +2,11 @@ import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:tm_app/core/constants/assets.dart';
|
||||
import 'package:tm_app/core/routes/app_routes.dart';
|
||||
import 'package:tm_app/core/theme/colors.dart';
|
||||
import 'package:tm_app/core/utils/app_toast.dart';
|
||||
import 'package:tm_app/core/utils/size_config.dart';
|
||||
import 'package:tm_app/view_models/auth_view_model.dart';
|
||||
import 'package:tm_app/views/forget_password_otp.dart/pages/forgot_password_otp_screen.dart';
|
||||
|
||||
import '../../login/widgets/login_textfield.dart';
|
||||
import '../../shared/base_button.dart';
|
||||
@@ -24,15 +24,10 @@ class MobileForgotPasswordPage extends StatelessWidget {
|
||||
padding: EdgeInsets.symmetric(horizontal: 24.0.w()),
|
||||
child: Consumer<AuthViewModel>(
|
||||
builder: (context, viewModel, _) {
|
||||
if (viewModel.successMessage == null) {
|
||||
if (viewModel.successMessage != null) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
AppToast.success(context, viewModel.successMessage!);
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => const ForgotPasswordOtpScreen(),
|
||||
),
|
||||
);
|
||||
const ForgotPasswordOtpRouteData().push(context);
|
||||
});
|
||||
} else if (viewModel.errorMessage != null) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:flutter_svg/svg.dart';
|
||||
import 'package:provider/provider.dart';
|
||||
import 'package:tm_app/core/routes/app_routes.dart';
|
||||
import 'package:tm_app/core/utils/size_config.dart';
|
||||
import 'package:tm_app/views/forget_password_otp.dart/pages/forgot_password_otp_screen.dart';
|
||||
|
||||
import '../../../core/constants/assets.dart';
|
||||
import '../../../core/theme/colors.dart';
|
||||
@@ -23,12 +23,7 @@ class TabletForgotPasswordPage extends StatelessWidget {
|
||||
if (viewModel.successMessage != null) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
AppToast.success(context, viewModel.successMessage!);
|
||||
Navigator.push(
|
||||
context,
|
||||
MaterialPageRoute(
|
||||
builder: (context) => const ForgotPasswordOtpScreen(),
|
||||
),
|
||||
);
|
||||
const ForgotPasswordOtpRouteData().push(context);
|
||||
});
|
||||
} else if (viewModel.errorMessage != null) {
|
||||
WidgetsBinding.instance.addPostFrameCallback((_) {
|
||||
@@ -79,19 +74,20 @@ class TabletForgotPasswordPage extends StatelessWidget {
|
||||
SizedBox(height: 24.0.h()),
|
||||
viewModel.isLoading
|
||||
? const BaseButton(
|
||||
isEnabled: false,
|
||||
text: ForgotPasswordStrings.resetLink,
|
||||
onPressed: null,
|
||||
)
|
||||
isEnabled: false,
|
||||
text: ForgotPasswordStrings.resetLink,
|
||||
onPressed: null,
|
||||
)
|
||||
: BaseButton(
|
||||
isEnabled: viewModel.isEmailValid,
|
||||
text: ForgotPasswordStrings.resetLink,
|
||||
onPressed: viewModel.isEmailValid
|
||||
? () async {
|
||||
isEnabled: viewModel.isEmailValid,
|
||||
text: ForgotPasswordStrings.resetLink,
|
||||
onPressed:
|
||||
viewModel.isEmailValid
|
||||
? () async {
|
||||
await viewModel.forgotPassword(context);
|
||||
}
|
||||
: null,
|
||||
),
|
||||
: null,
|
||||
),
|
||||
const SizedBox(height: 12),
|
||||
TextButton(
|
||||
onPressed: () {
|
||||
|
||||
Reference in New Issue
Block a user