diff options
-rw-r--r-- | example/http-srp.rb | 11 | ||||
-rw-r--r-- | example/models/user.rb | 10 |
2 files changed, 2 insertions, 19 deletions
diff --git a/example/http-srp.rb b/example/http-srp.rb index 4c34130..b2de7bf 100644 --- a/example/http-srp.rb +++ b/example/http-srp.rb @@ -43,17 +43,6 @@ post '/authenticate/' do erb :authenticate, :layout => false, :content_type => :xml end -post '/login' do - Log.log(:login, params) - @user = User.current - if @user.login!(params) - Log.log(:response, "Login succeeded") - else - Log.log(:response, "Login failed") - end - redirect '/' -end - get '/verify' do erb :verify end diff --git a/example/models/user.rb b/example/models/user.rb index ffbdf62..3ad8147 100644 --- a/example/models/user.rb +++ b/example/models/user.rb @@ -26,18 +26,12 @@ class User def authenticate(params) if m2 = self.srp.authenticate(params.delete('aa').to_i, params.delete('M').to_i) + self.active = true return {:M2 => m2} else + self.active = false return {:error => "Access Denied"} end end - - def login!(params) - self.active = valid_login?(params[:login], params[:password]) - end - - def valid_login?(login, password) - (self.login == login) and (self.password == password) - end end |