webmcp
diff demo-app/app/main/index/_action/login.lua @ 0:9fdfb27f8e67
Version 1.0.0
author | jbe/bsw |
---|---|
date | Sun Oct 25 12:00:00 2009 +0100 (2009-10-25) |
parents | |
children |
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/demo-app/app/main/index/_action/login.lua Sun Oct 25 12:00:00 2009 +0100 1.3 @@ -0,0 +1,12 @@ 1.4 +local user = User:by_ident_and_password(param.get('ident'), param.get('password')) 1.5 + 1.6 +if user then 1.7 + app.session.user = user 1.8 + app.session:save() 1.9 + slot.put_into('notice', _'Login successful!') 1.10 + trace.debug('User authenticated') 1.11 +else 1.12 + slot.put_into('error', _'Invalid username or password!') 1.13 + trace.debug('User NOT authenticated') 1.14 + return false 1.15 +end