This file is indexed.

/usr/share/tpclient-pywx/windows/winAccount.py is in tpclient-pywx 0.3.1.1-3.1.

This file is owned by root:root, with mode 0o644.

The actual contents of the file can be viewed below.

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
"""\
This module contains the "connect" window which lets a
person enter the server/username/password.
"""

# Python imports
import string
import os

# wxPython Imports
import wx

from extra.decorators import freeze_wrapper, onlyshown, onlyenabled

from requirements import graphicsdir

try:
	from extra.GIFAnimationCtrl import GIFAnimationCtrl
except ImportError:
	from wx.animate import GIFAnimationCtrl

from tp.netlib import constants as features

# Local Imports
from winBase import winBaseXRC
from winConnect import usernameMixIn
from xrc.winAccount import winAccountBase

throbber = os.path.join(graphicsdir, "downloading.gif")
okay = os.path.join(graphicsdir, "finished.gif")

class winAccount(winAccountBase, winBaseXRC, usernameMixIn):
	title = _("Account")

	def __init__(self, application):
		winAccountBase.__init__(self, None)
		winBaseXRC.__init__(self, application)	
		usernameMixIn.__init__(self)

		self.application.gui.Binder(self.application.NetworkClass.NetworkConnectEvent,   self.OnNetworkConnect)
		self.application.gui.Binder(self.application.NetworkClass.NetworkAccountEvent,   self.OnNetworkAccount)
		self.application.gui.Binder(self.application.NetworkClass.NetworkFailureEvent,   self.OnNetworkFailure)

	def Show(self, show=True):
		if not show:
			return self.Hide()

		self.Panel.Layout()
		size = self.Panel.GetBestSize()
		self.SetClientSize(size)
		self.CenterOnScreen(wx.BOTH)

		url = self.application.gui.servers.URL.GetValue()
		g = url.rfind('/')
		url, game = url[:g], url[g+1:]
		self.Server.SetValue(url)

		self.State("start")

		winBaseXRC.Show(self, show)

	def State(self, mode):
		if mode == "start":
			# Enable the host entry box
			self.Server.Enable()

			# Show and enable the connect button
			self.Check.Show()
			self.Check.Enable()
			
			# Stop and hide the throbber
			self.Checking.LoadFile(throbber)
			self.Checking.Stop()
			self.Checking.Hide()

			# Disable the okay button
			self.Cancel.Enable()
			self.Okay.Disable()

			# Disable the entries	
			self.Username.Disable()
			self.GameShow.Disable()
			self.Game.Disable()
			self.Password1.Disable()
			self.Password2.Disable()
			self.Email.Disable()

			self.Check.SetDefault()
			self.Server.SetFocus()

		if mode == "connecting":
			# Stop the entry to host 
			self.Server.Disable()

			# Hide the connect button
			self.Check.Hide()
			self.Check.Disable()

			# Show and start the throbber
			self.Checking.LoadFile(throbber)
			self.Checking.Show()
			self.Checking.Play()

			# Disable the okay button
			self.Cancel.Enable()
			self.Okay.Disable()

			# Disable the entries	
			self.Username.Disable()
			self.GameShow.Disable()
			self.Game.Disable()
			self.Password1.Disable()
			self.Password2.Disable()
			self.Email.Disable()

		if mode == "details":
			# Stop the entry to host
			self.Server.Disable()

			# Show the connect button but disabled
			self.Check.Hide()
			self.Check.Disable()

			# Stop and hide the throbber
			self.Checking.LoadFile(okay)
			self.Checking.Show()
			self.Checking.Play()

			# Enable the okay button
			self.Cancel.Enable()
			self.Okay.Enable()
		
			# Enable the entries	
			self.Username.Enable()
			self.GameShow.Enable()
			self.Game.Enable()
			self.Password1.Enable()
			self.Password2.Enable()
			self.Email.Enable()
			
			self.Username.SetFocus()
			self.Okay.SetDefault()

		if mode == "saving":
			# Stop the entry to host
			self.Server.Disable()

			# Show the connect button but disabled
			self.Check.Hide()
			self.Check.Enable()

			# Stop and hide the throbber
			self.Checking.Show()
			self.Checking.Play()

			# Enable the okay button
			self.Okay.Disable()
			self.Cancel.Disable()
		
			# Enable the entries	
			self.Username.Disable()
			self.GameShow.Disable()
			self.Game.Disable()
			self.Password1.Disable()
			self.Password2.Disable()
			self.Email.Disable()

		self.Panel.Layout()
		size = self.Panel.GetBestSize()
		self.SetClientSize(size)
	
	@onlyshown
	@onlyenabled("Check")	
	def OnCheck(self, evt):
		self.State("connecting")
		self.application.network.Call(self.application.network.Connect, self.Server.GetValue(), 
				debug=self.application.gui.connectto.config['debug'])

	@onlyshown
	def OnNetworkConnect(self, evt):
		if features.FEATURE_ACCOUNT_REGISTER in evt.args[0]:
			self.State("details")
		else:
			self.OnNetworkFailure(_("This server does not support account creation."))

	@onlyshown
	def OnNetworkAccount(self, evt):
		self.application.gui.Show(self.application.gui.connectto)
		dlg = wx.MessageDialog(self.application.gui.current, unicode(evt), _("Account Created"), wx.OK|wx.ICON_INFORMATION)
		dlg.ShowModal()

	@onlyshown
	def OnNetworkFailure(self, evt):
		dlg = wx.MessageDialog(self.application.gui.current, unicode(evt), _("Network Error"), wx.OK|wx.ICON_ERROR)
		dlg.ShowModal()

		self.State("start")

	@onlyshown
	@onlyenabled("Okay")
	def OnOkay(self, evt):

		username = self.GetUsername()
		password1 = self.Password1.GetValue().strip()
		password2 = self.Password2.GetValue().strip()
		email = self.Email.GetValue().strip()

		# Check the values are sensible
		if username == "" or password1 == "" or password2 == "" or email == "":
			dlg = wx.MessageDialog(self.application.gui.current, _("All fields are required."), _("Fields Required"), wx.OK|wx.ICON_ERROR)
			dlg.ShowModal()
			return
		if password1 != password2:
			dlg = wx.MessageDialog(self.application.gui.current, _("Password fields do not match."), _("Fields Required"), wx.OK|wx.ICON_ERROR)
			dlg.ShowModal()
			return

		url = self.Server.GetValue()
		p = url.find('://')
		if p != -1:
			p += 3
		else:
			p = 0		

		username, game = self.GetUsernameGame()
		fullurl = "%s%s:%s@%s/%s" % (url[:p], username, password1, url[p:], game)
		self.application.gui.connectto.ShowURL(fullurl)

		#self.application.network.Call(self.application.network.ConnectTo, host, username, password, debug=self.config['debug'])
		self.application.network.Call(self.application.network.NewAccount, username, password1, email)

	@onlyshown
	@onlyenabled("Cancel")
	def OnCancel(self, evt):
		self.application.gui.Show(self.application.gui.servers)

	# Config Functions -----------------------------------------------------------------------------
	def ConfigDefault(self, config=None):
		"""\
		Fill out the config with defaults (if the options are not valid or nonexistant).
		"""
		if config is None:
			config = {}

		try:
			if not isinstance(config['debug'], bool):
				raise ValueError('Config-%s: a debug value of %s is not valid' % (self, config['debug']))
		except (ValueError, KeyError), e:
			config['debug'] = False

		return config

	def ConfigSave(self):
		"""\
		Returns the configuration of the Window (and it's children).
		"""
		self.ConfigUpdate()

		self.ConfigLoad(self.config)
		return self.config

	def ConfigLoad(self, config):
		"""\
		Loads the configuration of the Window (and it's children).
		"""
		return

	def ConfigUpdate(self):
		"""\
		Updates the config details using external sources.
		"""
		return

	def ConfigDisplay(self, panel, sizer):
		"""\
		Display a config panel with all the config options.
		"""
		return

	def ConfigDisplayUpdate(self, evt):
		"""\
		Updates the config details using external sources.
		"""
		return