Commit a3678363b6cbd8549bc32fd52d3ddce119f49015

Authored by Michel Felipe
1 parent 1bbcf76f

Added user not activated exception verification in /login endpoint

Showing 1 changed file with 5 additions and 1 deletions   Show diff stats
lib/noosfero/api/session.rb
... ... @@ -13,7 +13,11 @@ module Noosfero
13 13 # Example Request:
14 14 # POST http://localhost:3000/api/v1/login?login=adminuser&password=admin
15 15 post "/login" do
16   - user ||= User.authenticate(params[:login], params[:password], environment)
  16 + begin
  17 + user ||= User.authenticate(params[:login], params[:password], environment)
  18 + rescue NoosferoExceptions::UserNotActivated => e
  19 + render_api_error!(e.message, 401)
  20 + end
17 21  
18 22 return unauthorized! unless user
19 23 user.generate_private_token!
... ...