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

USE [FastMoneyPro_Remit]
GO
/****** Object: StoredProcedure [dbo].[mobile_proc_ChangePassword] Script Date: 7/4/2019 11:35:48 AM ******/
DROP PROCEDURE [dbo].[mobile_proc_ChangePassword]
GO
/****** Object: StoredProcedure [dbo].[mobile_proc_ChangePassword] Script Date: 7/4/2019 11:35:48 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[mobile_proc_ChangePassword]
@userName VARCHAR(100),
@oldPassword VARCHAR(100),
@newPassword VARCHAR(100)
AS
BEGIN
--#101 Mobile changes for multi lingual
DECLARE @oldpassDB VARCHAR(200),@customerId BIGINT,@errorMsg VARCHAR(MAX),@mobile VARCHAR(15)
IF EXISTS(SELECT 'A' FROM customermastertemp(NOLOCK) WHERE username = @userName AND ISACTIVE='Y')
BEGIN
SELECT
@oldpassDB = customerPassword
,@customerId = customerId
FROM customermastertemp WITH (NOLOCK)
WHERE username = @userName
IF DBO.FNAencryptstring(@oldPassword) = DBO.FNAencryptstring(@newPassword)
BEGIN
EXEC proc_errorHandler 1, 'New Password can not be same as your old password, Please try again!', @customerId
RETURN;
END
IF isnull(@oldpassDB,'1') <> DBO.FNAencryptstring(@oldPassword)
BEGIN
EXEC proc_errorHandler 2, 'Your old password is invalid, Please try again!', @customerId
RETURN;
END
UPDATE customermastertemp SET
customerPassword = dbo.FNAencryptstring(@newPassword)
,modifiedDate = GETDATE()
WHERE username = @userName
INSERT INTO passwordHistory(userName ,pwd, createdBy, createdDate)
SELECT @userName, dbo.FNAencryptstring(@oldPassword), @userName, GETDATE()
EXEC proc_errorHandler 0, 'Your password has been successfully changed.', @customerId
RETURN
END
SELECT
@oldpassDB = customerPassword
,@customerId= customerId
,@mobile= mobile
FROM customerMaster WITH (NOLOCK)
WHERE username = @userName
IF DBO.FNAencryptstring(@oldPassword) = DBO.FNAencryptstring(@newPassword)
BEGIN
EXEC proc_errorHandler 1, 'New Password can not be same as your old password, Please try again!', @customerId
RETURN;
END
IF isnull(@oldpassDB,'1') <> DBO.FNAencryptstring(@oldPassword)
BEGIN
EXEC proc_errorHandler 2, 'Your old password is invalid, Please try again!', @customerId
RETURN;
END
UPDATE customerMaster SET
customerPassword = dbo.FNAencryptstring(@newPassword)
,modifiedDate = GETDATE()
WHERE username = @userName
UPDATE mobile_userRegistration SET isForcePassChange = 0 where username = @userName
INSERT INTO passwordHistory(userName ,pwd, createdBy, createdDate)
SELECT @userName, dbo.FNAencryptstring(@oldPassword), @userName, GETDATE()
SET @errorMsg = 'Your GME login password is '+@newPassword
-- EXEC proc_CallToSendSMS @FLAG = 'I',@SMSBody = @errorMsg,@MobileNo = @mobile
EXEC proc_errorHandler 0, 'Your password has been successfully changed.', @customerId
END