GoralWMoro

Untitled

Apr 21st, 2020
386
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.37 KB | None | 0 0
  1. function fc_user_auth(p_username in char,
  2. p_password in char) Return Boolean
  3. As
  4. v_Password char(250);
  5. v_Email char(250);
  6. v_id_user h_user.id_user%type;
  7.  
  8. Begin
  9. If p_username Is Null Or p_password Is Null Then
  10.  
  11. -- Write to Session, Notification must enter a username and password
  12. Apex_Util.Set_Session_State('LOGIN_MESSAGE','Please enter Username and password.');
  13. Return False;
  14. End If;
  15. ----
  16. Begin
  17. Select u.password
  18. ,u.email,
  19. id_user
  20. Into v_Password
  21. ,v_Email,
  22. v_id_user
  23. From h_user u
  24. Where upper(u.login) = upper(p_username);
  25. Apex_Util.Set_Session_State('LOGIN_MESSAGE', 'Tutaj');
  26. Exception
  27. When No_Data_Found Then
  28.  
  29. -- Write to Session, User not found.
  30. Apex_Util.Set_Session_State('LOGIN_MESSAGE',p_username);
  31. Return False;
  32. End;
  33. If v_Password <> p_password Then
  34.  
  35. -- Write to Session, Password incorrect.
  36. Apex_Util.Set_Session_State('LOGIN_MESSAGE','Password incorrect');
  37. Return False;
  38. End If;
  39.  
  40. ---
  41. -- Write user information to Session.
  42. --
  43. Apex_Util.Set_Session_State('SESSION_USER_ID',v_id_user);
  44. ---
  45. ---
  46. Return True;
  47. End;
Advertisement
Add Comment
Please, Sign In to add comment