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.

517 lines
36 KiB

  1. USE [FastMoneyPro_Remit]
  2. GO
  3. /****** Object: StoredProcedure [dbo].[proc_online_customer_login] Script Date: 1/23/2024 10:08:08 AM ******/
  4. SET ANSI_NULLS ON
  5. GO
  6. SET QUOTED_IDENTIFIER ON
  7. GO
  8. ALTER PROC [dbo].[proc_online_customer_login]
  9. @flag VARCHAR(50)
  10. ,@customerEmail VARCHAR(100) = NULL
  11. ,@customerPassword VARCHAR(255) = NULL
  12. ,@country VARCHAR(50) = NULL
  13. ,@ipAddress VARCHAR(100) = NULL
  14. ,@lockReason VARCHAR(500) = NULL
  15. ,@UserInfoDetail VARCHAR(MAX) = NULL
  16. ,@sessionId VARCHAR(60) = NULL
  17. ,@checkCountry VARCHAR(50) = NULL
  18. ,@password VARCHAR(50) = NULL
  19. ,@idType VARCHAR(50) = NULL
  20. ,@idNumber VARCHAR(50) = NULL
  21. ,@LogInfo VARCHAR(MAX) = NULL
  22. AS
  23. -----------------------------------------------------
  24. -- #101 - Mobile Changes , #361 - Multi-Lingual
  25. -----------------------------------------------------
  26. SET NOCOUNT ON;
  27. SET XACT_ABORT ON;
  28. BEGIN TRY
  29. DECLARE
  30. @UserData VARCHAR(200)
  31. ,@lastPwdChangedOn DATETIME
  32. ,@forceChangePwd CHAR(1)
  33. ,@pwdChangeDays VARCHAR(20)
  34. ,@msg VARCHAR(2000)
  35. ,@pwdChangeWarningDays VARCHAR(5)
  36. ,@lastLoginDate DATETIME
  37. DECLARE @email VARCHAR(100)
  38. ,@customerPwd VARCHAR(50)
  39. ,@isActive CHAR(1)
  40. ,@onlineUser CHAR(1)
  41. ,@isLocked VARCHAR(1)
  42. ,@ccountry VARCHAR(50)
  43. ,@customerStatus CHAR(1)
  44. ,@loginAttempt INT
  45. ,@existingCustomer INT
  46. ,@CreatedFrom varchar(50)
  47. IF @flag = 'check-id'
  48. BEGIN
  49. IF EXISTS(SELECT FULLNAME FROM CUSTOMERMASTER (NOLOCK) WHERE IDNUMBER = @idNumber) OR
  50. EXISTS(SELECT 'x' FROM dbo.CustomerMasterTemp AS CM(NOLOCK) WHERE IDNUMBER = @idNumber AND createdBy IS NOT NULL)
  51. BEGIN
  52. SELECT 1 ERRORCODE,'Already exists!' MSG,NULL
  53. RETURN
  54. END
  55. SELECT 0 ERRORCODE,'Success' MSG,NULL
  56. RETURN
  57. END
  58. IF @flag = 'checkIp'
  59. BEGIN
  60. IF NOT EXISTS( SELECT COUNTRYNAME FROM COUNTRYMASTER WITH (NOLOCK)
  61. WHERE ISNULL(allowOnlineCustomer,'N')='Y' AND upper(COUNTRYNAME)=upper(@checkCountry))
  62. BEGIN
  63. SELECT 1 ERRORCODE,'NOT AVAILABLE' MSG,NULL
  64. RETURN
  65. END
  66. ELSE
  67. BEGIN
  68. SELECT 0 ERRORCODE,'AVAILABLE' MSG,NULL
  69. END
  70. END
  71. IF @flag = 'l'
  72. BEGIN
  73. IF NOT EXISTS(SELECT 'x' FROM customerMaster WITH(NOLOCK) WHERE email=@customerEmail)
  74. BEGIN
  75. SELECT 1 errorCode, 'Login Failed - Invalid username or password!' msg, @customerEmail id
  76. RETURN
  77. END
  78. SELECT @email=email,
  79. @customerPwd=customerPassword,
  80. @isActive=isactive,
  81. @onlineUser=onlineuser,
  82. @isLocked=isLocked,
  83. @ccountry=country,
  84. @customerStatus=customerStatus,
  85. @lastLoginDate=lastLoginTs,
  86. @loginAttempt = ISNULL(invalidAttemptCount, 0),
  87. @existingCustomer= ISNULL(isexistingcustomer,0),
  88. @CreatedFrom= createdfrom
  89. FROM customerMaster WITH (NOLOCK)
  90. WHERE email=@customerEmail and ISNULL(onlineUser, 'N')='Y'
  91. SET @UserData ='User: '+ @customerEmail +' User Type:Online User'
  92. DECLARE @attemptsCount INT, @InvalidReason VARCHAR(80), @InvalidMsg VARCHAR(100)
  93. SELECT TOP 1 @attemptsCount = loginAttemptCount FROM passwordFormat WITH(NOLOCK)
  94. IF( @existingCustomer=1 and (@customerPwd IS NULL OR @customerPwd=''))
  95. BEGIN
  96. SELECT 3 errorCode, 'Login Failed. Please click forgot Password to set new password.' msg, @customerEmail id, @attemptsCount ac
  97. SET @UserInfoDetail = 'Reason = Login fails, Invalid password.-:::-'+@UserInfoDetail
  98. EXEC proc_applicationLogs
  99. @flag='login',
  100. @logType='Login fails',
  101. @createdBy = @customerEmail,
  102. @Reason='INFICARE USER',
  103. @UserData = @UserData,
  104. @fieldValue = @UserInfoDetail,
  105. @IP = @ipAddress
  106. RETURN
  107. END
  108. IF( @CreatedFrom='C' and (@customerPwd IS NULL OR @customerPwd=''))
  109. BEGIN
  110. SELECT 3 errorCode, 'Login Failed. Please click forgot Password to set new password.' msg, @customerEmail id, @attemptsCount ac
  111. SET @UserInfoDetail = 'Reason = Login fails, Invalid password.-:::-'+@UserInfoDetail
  112. EXEC proc_applicationLogs
  113. @flag='login',
  114. @logType='Login fails',
  115. @createdBy = @customerEmail,
  116. @Reason='CORE USER',
  117. @UserData = @UserData,
  118. @fieldValue = @UserInfoDetail,
  119. @IP = @ipAddress
  120. RETURN
  121. END
  122. IF (ISNULL(@isLocked, 'N') IN ('B', 'Y')) OR ((@loginAttempt - @attemptsCount) = -1)
  123. BEGIN
  124. SET @UserInfoDetail = 'Reason = Too many wrong attempts .-:::-' + @UserInfoDetail
  125. SELECT 1 errorCode, 'Login Failed - Too many wrong attempts, please contact GME Support!' msg, @customerEmail id, @attemptsCount ac
  126. EXEC proc_applicationLogs
  127. @flag='login',
  128. @logType='Login fails',
  129. @createdBy = @customerEmail,
  130. @Reason= 'Reason = Too many wrong attempts.',
  131. @UserData = @UserData,
  132. @fieldValue = @UserInfoDetail,
  133. @IP = @ipAddress
  134. RETURN
  135. END
  136. PRINT @customerPwd
  137. IF (@customerPwd <> dbo.FNAEncryptString(@customerPassword))
  138. BEGIN
  139. SET @UserInfoDetail = 'Reason = Incorrect password .-:::-' + @UserInfoDetail
  140. SET @loginAttempt = @loginAttempt + 1
  141. UPDATE customerMaster SET invalidAttemptCount = @loginAttempt--, isLocked = CASE WHEN @loginAttempt > @attemptsCount THEN 'B' ELSE 'N' END
  142. WHERE email = @customerEmail and ISNULL(onlineUser, 'N')='Y'
  143. SET @InvalidReason = CASE WHEN @loginAttempt > @attemptsCount THEN 'Number of invalid password attempts exceeded!' ELSE 'Invalid Password' END
  144. SET @InvalidMsg = 'Login Failed - you have ' + CAST((@attemptsCount - @loginAttempt) AS VARCHAR) + ' Attempts Left'
  145. SELECT 1 errorCode, @InvalidMsg msg, @customerEmail id, @attemptsCount ac
  146. EXEC proc_applicationLogs
  147. @flag='login',
  148. @logType='Login fails',
  149. @createdBy = @customerEmail,
  150. @Reason= @InvalidReason,
  151. @UserData = @UserData,
  152. @fieldValue = @UserInfoDetail,
  153. @IP = @ipAddress
  154. RETURN
  155. END
  156. IF (ISNULL(@onlineUser, 'N') = 'N')
  157. BEGIN
  158. SELECT 2 errorCode, 'User is not an Online User' msg, @customerEmail id, @attemptsCount ac
  159. SET @UserInfoDetail = 'Reason = Login fails, Invalid password.-:::-'+@UserInfoDetail
  160. EXEC proc_applicationLogs
  161. @flag='login',
  162. @logType='Login fails',
  163. @createdBy = @customerEmail,
  164. @Reason='Not online User',
  165. @UserData = @UserData,
  166. @fieldValue = @UserInfoDetail,
  167. @IP = @ipAddress
  168. RETURN
  169. END
  170. DECLARE @vPenny CHAR(1),@vCustomerId BIGINT
  171. --SELECT @vCustomerId=CM.customerId , @vPenny = CASE WHEN CM.createdDate < '2018-12-19 11:00:00' THEN 'N' WHEN ISNULL(CC.action,'REQ') = 'REQ' THEN 'Y' ELSE 'N' END
  172. --from customerMaster CM (nolock)
  173. --LEFT JOIN TblCustomerBankVerification CC (nolock) ON CM.customerId = CC.customerId
  174. --WHERE CM.email = @customerEmail
  175. --IF @vPenny = 'Y'
  176. --BEGIN
  177. -- SELECT 1000 errorCode, 'User redirect to penny test verification' mes, @vCustomerId id
  178. -- SET @UserInfoDetail = 'Reason = Login fails, User redirect to penny test verification.-:::-'+@UserInfoDetail
  179. -- EXEC proc_applicationLogs
  180. -- @flag='login',
  181. -- @logType='Login fails',
  182. -- @createdBy = @customerEmail,
  183. -- @Reason='Penny test verification',
  184. -- @UserData = @UserData,
  185. -- @fieldValue = @UserInfoDetail,
  186. -- @IP = @ipAddress
  187. -- RETURN
  188. --END
  189. IF (ISNULL(@isActive, 'Y') = 'N')
  190. BEGIN
  191. SELECT 1 errorCode, 'Your account is Inactive. Please, contact GME Support Team.' msg, @customerEmail id
  192. SET @UserInfoDetail = 'Reason = Login fails, Your account is Inactive. Please, contact your administrator.-:::-'+@UserInfoDetail
  193. EXEC proc_applicationLogs
  194. @flag='login',
  195. @logType='Login fails',
  196. @createdBy = @customerEmail,
  197. @Reason='User is not active ',
  198. @UserData = @UserData,
  199. @fieldValue = @UserInfoDetail,
  200. @IP = @ipAddress
  201. RETURN
  202. END
  203. --IF EXISTS (SELECT 'x' FROM customerMaster (NOLOCK) WHERE email=@customerEmail AND approvedBy IS NULL AND approvedDate IS NULL)
  204. --BEGIN
  205. -- SELECT 1 errorCode, 'Login Failed - Customer registration verification pending please visit nearest GME branch to get verified!' msg, @customerEmail id
  206. -- RETURN
  207. --END
  208. UPDATE customerMaster SET
  209. sessionId=@sessionId
  210. ,lastLoginTs = GETDATE()
  211. ,invalidAttemptCount = 0
  212. WHERE email = @customerEmail and ISNULL(onlineUser, 'N')='Y'
  213. DECLARE @mobileNo VARCHAR(16)
  214. SET @mobileNo = REPLACE(@mobileNo,' ','')
  215. SET @mobileNo = REPLACE(@mobileNo,'-','')
  216. SET @mobileNo = REPLACE(@mobileNo,'+','')
  217. SET @mobileNo = LEFT(@mobileNo,16)
  218. DECLARE @clientUseCode VARCHAR(10), @clientId VARCHAR(50), @clientSecret VARCHAR(50), @accessToken VARCHAR(400), @gmeBankCode VARCHAR(3), @gmeAccountNo VARCHAR(20)
  219. SELECT @clientUseCode = DBO.DECRYPTDB(clientUseCode), @clientId = DBO.DECRYPTDB(clientId), @clientSecret = DBO.DECRYPTDB(clientSecret)
  220. , @accessToken = accessToken, @gmeAccountNo = accountNum, @gmeBankCode = bankCodeStd
  221. FROM KFTC_GME_MASTER (NOLOCK)
  222. DECLARE @totalPoints INT, @regPoints INT, @tranPoints INT
  223. SELECT @totalPoints = totalPoints, @regPoints = RegPoint, @tranPoints = TranPoint FROM [dbo].[FNA_GET_REWARD_POINTS]()
  224. SELECT
  225. TOP 1
  226. 0 errorCode
  227. ,'Login success.' msg
  228. ,cu.customerId Id
  229. ,username = cu.email
  230. ,fullName = cu.fullName
  231. ,country = cm.countryName
  232. ,agent_branch_code=cu.branchId
  233. ,agentcode=cu.agentId
  234. ,date_format=NULL
  235. ,limitPerTran=0
  236. ,GMT_value=NULL
  237. ,currencyType=NULL
  238. ,extra_rate_bank=NULL
  239. ,cash_ledger_id=NULL
  240. ,@attemptsCount [ac]
  241. ,sessionTimeOutPeriod=NULL
  242. ,lastLoginTs=GETDATE()
  243. ,cm.countryId
  244. ,[address] = cu.city +'-Provience,South Korea'
  245. ,[address2]=cu.[address2]
  246. ,homePhone=cu.homePhone
  247. ,mobile=cu.mobile
  248. ,cm.countryCode
  249. ,utcTime=8
  250. ,mobile= @mobileNo
  251. ,city=cu.city
  252. ,postalCode=cu.postalCode
  253. ,membershipId=membershipId
  254. ,sdv.detailTitle idType
  255. ,cu.idNumber
  256. ,isForcedPwdChange = ISNULL(isForcedPwdChange,0)
  257. ,customerStatus
  258. ,cu.walletAccountNo
  259. ,primaryBankName=CASE WHEN cu.customerType='11048' THEN 'Mutual savings bank(050)' ELSE 'Kwangju Bank (034)' END
  260. ,nativeCountry = cm1.countryName
  261. ,nativeCountryId = cm1.countryId
  262. ,nativeCountryCode = cm1.countryCode
  263. ,occupation = sd.detailTitle
  264. ,idExpiryDate = CASE WHEN cu.idType='8008' THEN '2059-12-12' ELSE FORMAT(cu.idExpiryDate,'MM/dd/yyyy') END
  265. ,birthDate = FORMAT(cu.dob,'MM/dd/yyyy')
  266. ,accessToken = KFTC.accessToken
  267. ,clientUseCode = @clientUseCode
  268. ,clientId = @clientId
  269. ,clientSecret = @clientSecret
  270. ,gmeAccessToken = @accessToken
  271. ,gmeBankCode = @gmeBankCode
  272. ,gmeAccountNum = @gmeAccountNo
  273. ,rewardPoints= DBO.FNA_GET_AVAILABLE_BALANCE_POINTS(cu.customerId)
  274. ,IsEmailVerified = ISNULL(isEmailVerified,0)
  275. ,cu.SelfieDoc
  276. ,@totalPoints as TotalPoints
  277. ,@regPoints as RegPoints
  278. ,@tranPoints as TranPoints
  279. FROM customerMaster cu WITH(NOLOCK)
  280. LEFT JOIN countryMaster cm WITH (NOLOCK) ON cm.countryId=cu.country
  281. LEFT JOIN countryMaster cm1 with(nolock) on cm1.countryId = cu.nativeCountry
  282. left join staticDataValue sdv with (nolock) on sdv.valueId=cu.idType
  283. left join staticDataValue sd with(nolock) on sd.valueId = cu.occupation
  284. LEFT JOIN dbo.vwBankLists vwbank WITH (NOLOCK) ON cu.bankName=vwbank.rowid
  285. LEFT JOIN KFTC_CUSTOMER_MASTER KFTC(NOLOCK) ON KFTC.customerId = CU.customerId
  286. WHERE cu.email= @customerEmail
  287. and ISNULL(cu.onlineUser, 'N')='Y'
  288. EXEC proc_applicationLogs
  289. @flag='login',
  290. @logType='Login',
  291. @createdBy = @customerEmail,
  292. @Reason='Login',
  293. @UserData = @UserData,
  294. @fieldValue = @UserInfoDetail,
  295. @IP = @ipAddress
  296. END
  297. ELSE IF @flag = 'loc'
  298. BEGIN
  299. UPDATE customerMaster SET
  300. isLocked = 'Y'
  301. WHERE email= @customerEmail and ISNULL(onlineUser, 'N')='Y'
  302. INSERT INTO userLockHistory(userName, lockReason, createdBy, createdDate)
  303. SELECT @customerEmail, @lockReason, 'system',GETDATE()
  304. SELECT 0 errorCode, 'Your account has been locked. Please, contact your administrator.' mes, @customerEmail id
  305. END
  306. ELSE IF @flag='availbal'
  307. BEGIN
  308. SELECT ISNULL(availableBalance, 0.00) AS availableBalance FROM dbo.customerMaster(nolock)
  309. WHERE email=@customerEmail
  310. --SELECT 0 errorCode,ISNULL(a.clr_bal_amt, 0.00) AS availableBalance
  311. --FROM dbo.customerMaster c(nolock)
  312. --INNER JOIN FastMoneyPro_account.dbo.ac_master a(nolock) ON A.acct_num = c.walletAccountNo
  313. --WHERE c.email = @customerEmail
  314. END
  315. ELSE IF @flag='checkpin'
  316. BEGIN
  317. DECLARE @TXN_PIN VARCHAR(30)
  318. IF NOT EXISTS(SELECT 'X' FROM customerMaster WITH (NOLOCK)
  319. WHERE username=@customerEmail and ISNULL(onlineUser, 'N')='Y')
  320. BEGIN
  321. SELECT @email=email,
  322. @customerPwd=customerPassword,
  323. @isActive=isactive,
  324. @onlineUser=onlineuser,
  325. @isLocked=isLocked,
  326. @ccountry=country,
  327. @customerStatus=customerStatus,
  328. @lastLoginDate=lastLoginTs,
  329. @loginAttempt = ISNULL(invalidAttemptPinCount, 0),
  330. @TXN_PIN = txnPin
  331. FROM customerMaster WITH (NOLOCK)
  332. WHERE username=@customerEmail and ISNULL(onlineUser, 'N')='Y'
  333. END
  334. ELSE
  335. BEGIN
  336. SELECT @email=email,
  337. @customerPwd=customerPassword,
  338. @isActive=isactive,
  339. @onlineUser=onlineuser,
  340. @isLocked=isLocked,
  341. @ccountry=country,
  342. @customerStatus=customerStatus,
  343. @lastLoginDate=lastLoginTs,
  344. @loginAttempt = ISNULL(invalidAttemptPinCount, 0),
  345. @TXN_PIN = txnPin
  346. FROM customerMaster WITH (NOLOCK)
  347. WHERE username=@customerEmail and ISNULL(onlineUser, 'N')='Y'
  348. END
  349. IF (ISNULL(@password, '') = ISNULL(@TXN_PIN, '-1'))
  350. BEGIN
  351. UPDATE customerMaster SET
  352. invalidAttemptPinCount = 0
  353. WHERE username = @customerEmail and ISNULL(onlineUser, 'N')='Y'
  354. SELECT 0 errorCode, 'Success' msg, @customerEmail id
  355. RETURN;
  356. END
  357. SELECT TOP 1 @attemptsCount = loginAttemptCount FROM passwordFormat WITH(NOLOCK)
  358. IF (ISNULL(@isLocked, 'N') IN ('B', 'Y')) OR ((@loginAttempt - @attemptsCount) = -1)
  359. BEGIN
  360. SELECT 18 errorCode, 'Too many wrong attempts, please contact JME Support!' mes, @customerEmail id
  361. EXEC proc_applicationLogs
  362. @flag='login',
  363. @logType='Send Transaction',
  364. @createdBy = @customerEmail,
  365. @Reason= 'Reason = Too many wrong attempts sending transaaction.'
  366. RETURN
  367. END
  368. IF (ISNULL(@password, '') <> ISNULL(@TXN_PIN, '-1'))
  369. BEGIN
  370. SET @UserInfoDetail = 'Reason = Incorrect PIN .-:::-' + @UserInfoDetail
  371. SET @loginAttempt = @loginAttempt + 1
  372. UPDATE customerMaster SET invalidAttemptPinCount = @loginAttempt, isLocked = CASE WHEN @loginAttempt > @attemptsCount THEN 'B' ELSE 'N' END
  373. WHERE username = @customerEmail and ISNULL(onlineUser, 'N')='Y'
  374. SET @InvalidReason = CASE WHEN @loginAttempt > @attemptsCount THEN 'Number of invalid PIN attempts exceeded!' ELSE 'Invalid PIN' END
  375. SET @InvalidMsg = 'Send txn Failed - Invalid PIN, you have ' + CAST((@attemptsCount - @loginAttempt) AS VARCHAR) + ' Attempts Left'
  376. SELECT 20 errorCode, @InvalidMsg mes, @customerEmail id
  377. EXEC proc_applicationLogs
  378. @flag='login',
  379. @logType='Send Transaction',
  380. @createdBy = @customerEmail,
  381. @Reason= 'Reason = wrong transaction PIN.'
  382. RETURN
  383. END
  384. END
  385. ELSE IF @flag='checkpass'
  386. BEGIN
  387. IF NOT EXISTS(SELECT 'X' FROM customerMaster WITH (NOLOCK)
  388. WHERE username=@customerEmail and ISNULL(onlineUser, 'N')='Y')
  389. BEGIN
  390. SELECT @email=email,
  391. @customerPwd=customerPassword,
  392. @isActive=isactive,
  393. @onlineUser=onlineuser,
  394. @isLocked=isLocked,
  395. @ccountry=country,
  396. @customerStatus=customerStatus,
  397. @lastLoginDate=lastLoginTs,
  398. @loginAttempt = ISNULL(invalidAttemptCount, 0),
  399. @TXN_PIN = txnPin
  400. FROM customerMaster WITH (NOLOCK)
  401. WHERE username=@customerEmail and ISNULL(onlineUser, 'N')='Y'
  402. END
  403. ELSE
  404. BEGIN
  405. SELECT @email=email,
  406. @customerPwd=customerPassword,
  407. @isActive=isactive,
  408. @onlineUser=onlineuser,
  409. @isLocked=isLocked,
  410. @ccountry=country,
  411. @customerStatus=customerStatus,
  412. @lastLoginDate=lastLoginTs,
  413. @loginAttempt = ISNULL(invalidAttemptCount, 0),
  414. @TXN_PIN = txnPin
  415. FROM customerMaster WITH (NOLOCK)
  416. WHERE username=@customerEmail and ISNULL(onlineUser, 'N')='Y'
  417. END
  418. IF (@customerPwd = dbo.FNAEncryptString(@password))
  419. BEGIN
  420. UPDATE customerMaster SET
  421. invalidAttemptCount = 0
  422. WHERE username = @customerEmail and ISNULL(onlineUser, 'N')='Y'
  423. SELECT 0 errorCode, 'Success' msg, @customerEmail id
  424. RETURN;
  425. END
  426. SELECT TOP 1 @attemptsCount = loginAttemptCount FROM passwordFormat WITH(NOLOCK)
  427. IF (ISNULL(@isLocked, 'N') IN ('B', 'Y')) OR ((@loginAttempt - @attemptsCount) = -1)
  428. BEGIN
  429. SELECT 9 errorCode, 'Too many wrong attempts, please contact GME Support!' mes, @customerEmail id
  430. EXEC proc_applicationLogs
  431. @flag='login',
  432. @logType='Send Transaction',
  433. @createdBy = @customerEmail,
  434. @Reason= 'Reason = Too many wrong attempts sending transaaction.'
  435. RETURN
  436. END
  437. IF (@customerPwd <> dbo.FNAEncryptString(@password))
  438. BEGIN
  439. SET @UserInfoDetail = 'Reason = Incorrect password .-:::-' + @UserInfoDetail
  440. SET @loginAttempt = @loginAttempt + 1
  441. UPDATE customerMaster SET invalidAttemptCount = @loginAttempt, isLocked = CASE WHEN @loginAttempt > @attemptsCount THEN 'B' ELSE 'N' END
  442. WHERE email = @customerEmail and ISNULL(onlineUser, 'N')='Y'
  443. SET @InvalidReason = CASE WHEN @loginAttempt > @attemptsCount THEN 'Number of invalid password attempts exceeded!' ELSE 'Invalid Password' END
  444. SET @InvalidMsg = 'Login Failed - Invalid Password, you have ' + CAST((@attemptsCount - @loginAttempt) AS VARCHAR) + ' Attempts Left'
  445. SELECT 1 errorCode, @InvalidMsg mes, @customerEmail id
  446. EXEC proc_applicationLogs
  447. @flag='login',
  448. @logType='Send Transaction',
  449. @createdBy = @customerEmail,
  450. @Reason= 'Reason = wrong transaction password.'
  451. RETURN
  452. END
  453. END
  454. END TRY
  455. BEGIN CATCH
  456. IF @@TRANCOUNT > 0
  457. ROLLBACK TRANSACTION
  458. DECLARE @errorMessage VARCHAR(MAX)
  459. SET @errorMessage = ERROR_MESSAGE()
  460. EXEC proc_errorHandler 1, @errorMessage,NULL
  461. END CATCH