- if session[:token]
- token = UserToken.find_by(:token => session[:token])
- session.delete(:token)
- else
- token = nil
- end
-
- if token.nil? || token.user != user
- flash[:notice] = t(".success")
- redirect_to login_path(:referer => referer)
- else
- token.destroy