Unit Instance
Units API.
See the Weblate's Web API documentation for detailed description of the API.
GET /api/units/25974/?format=api
https://translate-dev.freebsd.org/api/translations/freebsd-doc/articles_ldap-auth/es/?format=api", "source": [ "require 'ldap'\nrequire 'base64'\nrequire 'digest'\nrequire 'password' # ruby-password\n\nldap_server = \"ldap.example.org\"\nluser = \"uid=#{ENV['USER']},ou=people,dc=example,dc=org\"\n\n# get the new password, check it, and create a salted hash from it\ndef get_password\n pwd1 = Password.get(\"New Password: \")\n pwd2 = Password.get(\"Retype New Password: \")\n\n raise if pwd1 != pwd2\n pwd1.check # check password strength\n\n salt = rand.to_s.gsub(/0\\./, '')\n pass = pwd1.to_s\n hash = \"{SSHA}\"+Base64.encode64(Digest::SHA1.digest(\"#{pass}#{salt}\")+salt).chomp!\n return hash\nend\n\noldp = Password.get(\"Old Password: \")\nnewp = get_password\n\n# We'll just replace it. That we can bind proves that we either know\n# the old password or are an admin.\n\nreplace = LDAP::Mod.new(LDAP::LDAP_MOD_REPLACE | LDAP::LDAP_MOD_BVALUES,\n \"userPassword\",\n [newp])\n\nconn = LDAP::SSLConn.new(ldap_server, 389, true)\nconn.set_option(LDAP::LDAP_OPT_PROTOCOL_VERSION, 3)\nconn.bind(luser, oldp)\nconn.modify(luser, [replace])" ], "previous_source": "", "target": [ "require 'ldap'\nrequire 'base64'\nrequire 'digest'\nrequire 'password' # ruby-password\n\nldap_server = \"ldap.example.org\"\nluser = \"uid=#{ENV['USER']},ou=people,dc=example,dc=org\"\n\n# get the new password, check it, and create a salted hash from it\ndef get_password\n pwd1 = Password.get(\"New Password: \")\n pwd2 = Password.get(\"Retype New Password: \")\n\n raise if pwd1 != pwd2\n pwd1.check # check password strength\n\n salt = rand.to_s.gsub(/0\\./, '')\n pass = pwd1.to_s\n hash = \"{SSHA}\"+Base64.encode64(Digest::SHA1.digest(\"#{pass}#{salt}\")+salt).chomp!\n return hash\nend\n\noldp = Password.get(\"Old Password: \")\nnewp = get_password\n\n# We'll just replace it. That we can bind proves that we either know\n# the old password or are an admin.\n\nreplace = LDAP::Mod.new(LDAP::LDAP_MOD_REPLACE | LDAP::LDAP_MOD_BVALUES,\n \"userPassword\",\n [newp])\n\nconn = LDAP::SSLConn.new(ldap_server, 389, true)\nconn.set_option(LDAP::LDAP_OPT_PROTOCOL_VERSION, 3)\nconn.bind(luser, oldp)\nconn.modify(luser, [replace])" ], "id_hash": -7406185313479144903, "content_hash": -7406185313479144903, "location": "article.translate.xml:666", "context": "", "note": "(itstool) path: example/programlisting", "flags": "no-wrap", "labels": [], "state": 20, "fuzzy": false, "translated": true, "approved": false, "position": 120, "has_suggestion": false, "has_comment": false, "has_failing_check": true, "num_words": 114, "source_unit": "https://translate-dev.freebsd.org/api/units/99328/?format=api", "priority": 100, "id": 25974, "web_url": "https://translate-dev.freebsd.org/translate/freebsd-doc/articles_ldap-auth/es/?checksum=1937f1b2715c4a39", "url": "https://translate-dev.freebsd.org/api/units/25974/?format=api", "explanation": "", "extra_flags": "", "pending": false, "timestamp": "2019-10-20T12:09:44.844171Z" }{ "translation": "