@ -27,10 +27,12 @@ func reset(m chat1.MsgSummary) {
@@ -27,10 +27,12 @@ func reset(m chat1.MsgSummary) {
func authenticate ( m chat1 . MsgSummary ) {
defer log . PanicSafe ( )
log . LogDebug ( "Called authenticate()" )
if isAuthenticated ( m ) {
k . SendMessageByConvID ( m . ConvID , "You have already authenticated (please use !reset to reset." )
return
}
log . LogDebug ( "User was not already authenticated" )
if ! m . IsEphemeral {
k . SendMessageByConvID ( m . ConvID , "Please remember to delete your message after we have authenticated!" )
}
@ -39,6 +41,7 @@ func authenticate(m chat1.MsgSummary) {
@@ -39,6 +41,7 @@ func authenticate(m chat1.MsgSummary) {
k . SendMessageByConvID ( m . ConvID , "Invalid input for command authenticate. Requires username and password. This information is not stored in keybase, or logged." )
return
}
log . LogDebug ( "Proper amount of parameters has been received, calling login()" )
username := parts [ 1 ]
password := parts [ 2 ]
t , err := login ( context . Background ( ) , username , password )
@ -46,6 +49,7 @@ func authenticate(m chat1.MsgSummary) {
@@ -46,6 +49,7 @@ func authenticate(m chat1.MsgSummary) {
handleError ( err , m , "There was an error logging in. Contact @rudi9719 for more information with code %+v" )
return
}
log . LogDebug ( "Returned from login()" )
log . LogDebug ( "Token created for %+v" , m . Sender . Username )
_ , err = k . KVPut ( & m . Channel . Name , "teslabot" , "authtok" , t )
if err != nil {