def register(obj): print 'BoooooYahhhh' msg = obj.msg.split(' ') #if not obj.chan == c.nick: # c.send(obj.chan, 'Please register in a private message...') if len(msg) == 2: #!register mypass if 6 <= len(msg[1]) <= 35: #Is mypass valid? if not db.hasUser(obj.nick): #Does the user exist? db.addUser(obj.nick).setpass(msg[1]) #Add the user return c.send(obj.nick, 'You have been registered with the given password! Login in the future with the !authorize command.') else: return c.send(obj.chan, 'User already exsists! Please login with !authorize.') c.send(obj.chan, obj.usage)
def auth(obj): msg = obj.msg.split(' ') if len(msg) == 2: nick = obj.nick pas = msg[1] elif len(msg) == 3: nick = msg[1] pas = msg[2] else: c.send(obj.nick, obj.usage) if db.hasUser(nick): if db.getUser(nick).auth(pas): obj.user.authed = True return c.send(obj.nick, 'Welcome back %s' % nick) c.send(obj.nick, 'Incorrect login info!')