MCPcopy
hub / github.com/tinode/chat / loginMsg

Function loginMsg

tn-cli/commands.py:127–151  ·  view source on GitHub ↗
(id, cmd, args)

Source from the content-addressed store, hash-verified

125
126# {login}
127def loginMsg(id, cmd, args):
128 if cmd.secret == None:
129 if cmd.uname == None:
130 cmd.uname = ''
131 if cmd.password == None:
132 cmd.password = ''
133 cmd.secret = str(cmd.uname) + ":" + str(cmd.password)
134 cmd.secret = cmd.secret.encode('utf-8')
135 elif cmd.scheme == "basic":
136 # Assuming secret is a uname:password string.
137 cmd.secret = str(cmd.secret).encode('utf-8')
138 else:
139 # All other schemes: assume secret is a base64-encoded string
140 cmd.secret = base64.b64decode(cmd.secret)
141
142 from client import handle_login, save_cookie
143 msg = pb.ClientMsg(login=pb.ClientLogin(id=str(id), scheme=cmd.scheme, secret=cmd.secret,
144 cred=parse_cred(cmd.cred)))
145
146 if args.no_cookie or not tn_globals.IsInteractive:
147 tn_globals.OnCompletion[str(id)] = lambda params: handle_login(params)
148 else:
149 tn_globals.OnCompletion[str(id)] = lambda params: save_cookie(params)
150
151 return msg
152
153
154# {sub}

Callers 1

gen_messageFunction · 0.90

Calls 3

parse_credFunction · 0.90
handle_loginFunction · 0.90
save_cookieFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…