You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

87 lines
5.8 KiB

1 year ago
  1. USE [FastMoneyPro_Remit]
  2. GO
  3. /****** Object: StoredProcedure [dbo].[mobile_proc_ChangePassword] Script Date: 7/4/2019 11:35:48 AM ******/
  4. DROP PROCEDURE [dbo].[mobile_proc_ChangePassword]
  5. GO
  6. /****** Object: StoredProcedure [dbo].[mobile_proc_ChangePassword] Script Date: 7/4/2019 11:35:48 AM ******/
  7. SET ANSI_NULLS ON
  8. GO
  9. SET QUOTED_IDENTIFIER ON
  10. GO
  11. CREATE PROCEDURE [dbo].[mobile_proc_ChangePassword]
  12. @userName VARCHAR(100),
  13. @oldPassword VARCHAR(100),
  14. @newPassword VARCHAR(100)
  15. AS
  16. BEGIN
  17. --#101 Mobile changes for multi lingual
  18. DECLARE @oldpassDB VARCHAR(200),@customerId BIGINT,@errorMsg VARCHAR(MAX),@mobile VARCHAR(15)
  19. IF EXISTS(SELECT 'A' FROM customermastertemp(NOLOCK) WHERE username = @userName AND ISACTIVE='Y')
  20. BEGIN
  21. SELECT
  22. @oldpassDB = customerPassword
  23. ,@customerId = customerId
  24. FROM customermastertemp WITH (NOLOCK)
  25. WHERE username = @userName
  26. IF DBO.FNAencryptstring(@oldPassword) = DBO.FNAencryptstring(@newPassword)
  27. BEGIN
  28. EXEC proc_errorHandler 1, 'New Password can not be same as your old password, Please try again!', @customerId
  29. RETURN;
  30. END
  31. IF isnull(@oldpassDB,'1') <> DBO.FNAencryptstring(@oldPassword)
  32. BEGIN
  33. EXEC proc_errorHandler 2, 'Your old password is invalid, Please try again!', @customerId
  34. RETURN;
  35. END
  36. UPDATE customermastertemp SET
  37. customerPassword = dbo.FNAencryptstring(@newPassword)
  38. ,modifiedDate = GETDATE()
  39. WHERE username = @userName
  40. INSERT INTO passwordHistory(userName ,pwd, createdBy, createdDate)
  41. SELECT @userName, dbo.FNAencryptstring(@oldPassword), @userName, GETDATE()
  42. EXEC proc_errorHandler 0, 'Your password has been successfully changed.', @customerId
  43. RETURN
  44. END
  45. SELECT
  46. @oldpassDB = customerPassword
  47. ,@customerId= customerId
  48. ,@mobile= mobile
  49. FROM customerMaster WITH (NOLOCK)
  50. WHERE username = @userName
  51. IF DBO.FNAencryptstring(@oldPassword) = DBO.FNAencryptstring(@newPassword)
  52. BEGIN
  53. EXEC proc_errorHandler 1, 'New Password can not be same as your old password, Please try again!', @customerId
  54. RETURN;
  55. END
  56. IF isnull(@oldpassDB,'1') <> DBO.FNAencryptstring(@oldPassword)
  57. BEGIN
  58. EXEC proc_errorHandler 2, 'Your old password is invalid, Please try again!', @customerId
  59. RETURN;
  60. END
  61. UPDATE customerMaster SET
  62. customerPassword = dbo.FNAencryptstring(@newPassword)
  63. ,modifiedDate = GETDATE()
  64. WHERE username = @userName
  65. UPDATE mobile_userRegistration SET isForcePassChange = 0 where username = @userName
  66. INSERT INTO passwordHistory(userName ,pwd, createdBy, createdDate)
  67. SELECT @userName, dbo.FNAencryptstring(@oldPassword), @userName, GETDATE()
  68. SET @errorMsg = 'Your GME login password is '+@newPassword
  69. -- EXEC proc_CallToSendSMS @FLAG = 'I',@SMSBody = @errorMsg,@MobileNo = @mobile
  70. EXEC proc_errorHandler 0, 'Your password has been successfully changed.', @customerId
  71. END