maybe add login in the provisioning call
This commit is contained in:
parent
78a5114938
commit
4f99fc339f
@ -390,7 +390,7 @@ func (handler *CommandHandler) CommandLogin(ce *CommandEvent) {
|
||||
ce.User.Login(ce)
|
||||
}
|
||||
|
||||
const cmdLogoutHelp = `logout - Logout from WhatsApp`
|
||||
const cmdLogoutHelp = `logout - Logout from GroupMe`
|
||||
|
||||
// CommandLogout handles !logout command
|
||||
func (handler *CommandHandler) CommandLogout(ce *CommandEvent) {
|
||||
|
@ -336,8 +336,20 @@ var upgrader = websocket.Upgrader{
|
||||
}
|
||||
|
||||
func (prov *ProvisioningAPI) Login(w http.ResponseWriter, r *http.Request) {
|
||||
// userID := r.URL.Query().Get("user_id")
|
||||
// user := prov.bridge.GetUserByMXID(id.UserID(userID))
|
||||
userID := r.URL.Query().Get("user_id")
|
||||
user := prov.bridge.GetUserByMXID(id.UserID(userID))
|
||||
|
||||
if len(ce.Args) < 1 {
|
||||
// Return error that the token needs to be longer than 0 length
|
||||
// ce.Reply(`Get your access token from https://dev.groupme.com/ which should be the first argument to login`)
|
||||
return
|
||||
}
|
||||
user.Token = ce.Args[0]
|
||||
|
||||
user.addToJIDMap()
|
||||
// ce.Reply("Successfully logged in, synchronizing chats...")
|
||||
user.PostLogin()
|
||||
user.Connect()
|
||||
|
||||
// c, err := upgrader.Upgrade(w, r, nil)
|
||||
// if err != nil {
|
||||
|
1
user.go
1
user.go
@ -363,6 +363,7 @@ func (user *User) Login(ce *CommandEvent) {
|
||||
// // Also between the two logout methods (commands.go and provisioning.go)
|
||||
// user.ConnectionErrors = 0
|
||||
// user.JID = strings.Replace(user.Conn.Info.Wid, whatsappExt.OldUserSuffix, whatsappExt.NewUserSuffix, 1)
|
||||
|
||||
if len(ce.Args) < 1 {
|
||||
ce.Reply(`Get your access token from https://dev.groupme.com/ which should be the first argument to login`)
|
||||
return
|
||||
|
Loading…
Reference in New Issue
Block a user