request = require 'request'
readlineSync = require 'readline-sync'

exports.login = () ->
    userInfo = getInfo()
    # getInfo((username, password) ->
    #     options =
    #         url: 'https://qsso.corp.qunar.com/auth.php'
    #         headers:
    #             "User-Agent": 'QXF',
    #             "Host": 'qsso.corp.qunar.com',
    #             "Referer": 'https://qsso.corp.qunar.com/login.php'
    #         form:
    #             "mobile": ""
    #             "passCode": password
    #             "type": "rsa"
    #             "userId": username
    #
    #     request.post(options, (err, httpResponse, body) ->
    #         console.log err, body
    #     )
    # )

getInfo = () ->
    username = readlineSync.question('用户名:')
    password = readlineSync.question('密码', {hideEchoBack: true})

    return {username, password}