liquid_feedback_frontend
annotate app/main/member/_action/update_api_key.lua @ 519:7492497005bd
Fixed voting for non javascript capable browser, removed browser warning
| author | bsw | 
|---|---|
| date | Mon Apr 16 23:27:07 2012 +0200 (2012-04-16) | 
| parents | 67c1695dc94d | 
| children | 
| 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@516 | 23 member_application.access_level = 'member' | 
| 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 |