Advertisement
Guest User

Untitled

a guest
May 17th, 2017
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. authenticate: aUser password: aPassword
  2.     "Authenticates a user against the database, and creates a Session for the user on success"
  3.  
  4.     | user |
  5.     db
  6.         rawQuery: 'SELECT * FROM "Users" WHERE "username" = ''' , aUser , ''' AND "password" = ''' , aPassword
  7.                 , ''''.
  8.     user := db asSingleResult.
  9.     user ifNil: [^False].
  10.     "If the user exists, then create a session for them"
  11.     Session userId: (user at: 1).
  12.     ^True
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement