我正在为商业广告开发一个带有green_shoes(GUI)的界面。
下面是我的脚本连接到ldap服务器并检查用户是否存在,我可以输入登录名和密码。
当我点击“登录”按钮登录或没有它时,我收到错误。
错误:
may not work as expected
/home/zyriuse/.rvm/gems/ruby-1.9.3-p484/gems/green_shoes-1.1.374/lib/shoes/ruby.rb:14:in `exit_application': super: no superclass method `exit_application' for GLib:Module (NoMethodError)
from /home/zyriuse/.rvm/gems/ruby-1.9.3-p484/gems/green_shoes-1.1.374/lib/shoes/main.rb:123:in `main'
脚本
require 'green_shoes'
require 'net/ldap'
Shoes.app(:title => "Authentification",:width => 300, :height => 300) do
class ConnectLdap
@myApp
def initialize(myapp, connect = nil)
@connect = connect
@myApp = myapp
end
def connect(login,pwd)
@myApp.app do
ldap = Net::LDAP.new
ldap.host = "78.110.xx.xx"
ldap.port = 389
ldap.auth "cn=admin,dc=domaine,dc=com", "password"
filter = Net::LDAP::Filter.eq("uid","#{login}")
dn = ["dn"]
@connect = ldap.bind_as(:base => "dc=domaine,dc=com", :filter => filter, :attributes => dn, :password => "#{pwd}")
end
end
def connect?
if !!@connect == true
alert "Successful login"
else
alert "wrong password or login"
end
end
end
stack do
@myActions = ConnectLdap.new(self)
para "login"
login = edit_line
para "password"
password = edit_line
button "login" do
@myactions.connect(login.text,password,text)
end
end
end
答案 0 :(得分:0)
我不知道这是否仍然相关,但我现在才看到它...... 你试过green_shoes 1.1.367吗?
的问候, 西巴