﻿$(document).ready(function() {
    validateReset();
});
function validateReset() {
    $('#form_rspwd').validate({
        hightlight: function(e) {
            $(e).addClass("error");
        },
        unhighlight: function(e) {
            $(e).removeClass("error");
        },
        onkeyup: false,
        submitHandler: function() {
            forgotPassword();
        }
    });
}
function forgotPassword() {
    $.ajax({
        type: "POST",
        url: ws_auth + "/resetPassword",
        data: '{"emailid":"' + $('#rspwd_userName').val() + '"}',
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function (msg) {
            $('#msg').html(msg.d.message);
            if (msg.d.message.indexOf('has been reset') > 0) {
                $('#msg').css("color", "#829B28");
                $('#form_rspwd').hide();
            }
            $('#msg').show();
        }
    });
}