liquid_feedback_frontend

annotate app/main/member/_action/update_api_key.lua @ 514:976d493106a1

Updated member api key settings to core 2.0
author bsw
date Sun Apr 15 12:32:59 2012 +0200 (2012-04-15)
parents 0849be391140
children 67c1695dc94d
rev   line source
bsw@51 1
bsw@51 2 local api_key
bsw@51 3
bsw@514 4 if param.get_id() and param.get("delete", atom.boolean) then
bsw@51 5
bsw@514 6 local member_application = MemberApplication:by_id(param.get_id())
bsw@514 7
bsw@514 8 if member_application then
bsw@514 9 member_application:destroy()
bsw@51 10 end
bsw@51 11
bsw@514 12 slot.put_into("notice", _"API key has been deleted")
bsw@51 13 else
bsw@51 14
bsw@514 15 local member_application = MemberApplication:new()
bsw@514 16 member_application.member_id = app.session.member_id
bsw@514 17 member_application.key = multirand.string(
bsw@51 18 20,
bsw@51 19 '23456789BCDFGHJKLMNPQRSTVWXYZbcdfghjkmnpqrstvwxyz'
bsw@51 20 )
bsw@514 21 member_application.name = 'member'
bsw@514 22 member_application.comment = ''
bsw@514 23 member_application.access_level = 'full'
bsw@51 24
bsw@514 25 member_application:save()
bsw@514 26 slot.put_into("notice", _"API key has been created")
bsw@51 27 end

Impressum / About Us