
@{
    Layout = null;
    Crypt cr = new Crypt();
    string student_id = cr.Encrypt(Convert.ToString(Session["student_id"]));


}
@using upes_admission.Gutils
<!doctype html>
<html lang="en">
<head>
    <!-- Required meta tags -->
    <meta charset="UTF-8">
    <meta name="viewport"
          content="width=device-width, user-scalable=no, initial-scale=1.0, maximum-scale=1.0, minimum-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <!--Style-->
    <link href="https://fonts.googleapis.com/css?family=Montserrat:300,400,500,700,800,900" rel="stylesheet">
    <link href="../css/component.css" rel="stylesheet" />
    <link href="../css/main.css" rel="stylesheet" />
    <link href="../css/ApplicationTemplate.css" rel="stylesheet" />
    <link href="../css/LoginTemplate.css" rel="stylesheet" />
    <!--Custom Css-->
    <title>UPES | Applicant Dashboard </title>

    <style>
        .se-pre-con {
            position: fixed;
            left: 0;
            top: 0;
            width: 100%;
            height: 100%;
            z-index: 9999;
            background: #fff url(../img/application/loader.gif) center no-repeat;
        }
    </style>
    <script>
        function myFunction() {
            //  alert("Page is loaded");

            $(".se-pre-con").fadeOut("slow");
        }
    </script>

</head>

<body onload="myFunction();">
    <!--Application Template-->
    <div class="se-pre-con"></div>
    <header class="position-relative">
        <section class="HeaderPanel HeaderBanner">
            <div class="plr70">
                <div class="headerInner">
                    <a href="/">
                        <img src="../img/application/upes logo.png" class="img-fluid" alt="Logo" />
                    </a>
                </div>
            </div>
            <!--Helpline Chat-->
            <div class="helplineChatPanel ">
                <div class="plr70">
                    <div class="helplineChatInner fontBold ">
                        <a href="javascript:void(0);">
                            <img src="../img/application/helpline.png" class="img-fluid" alt="helpline" />
                            <span>Helpline</span>
                        </a>
                        <a href="javascript:void(0);">
                            <img src="../img/application/chat.png" class="img-fluid" alt="helpline" />
                            <span>Chat</span>
                        </a>
                    </div>
                </div>
            </div>
        </section>

    </header>
    @using (Html.BeginForm("changepassword", "Application", FormMethod.Post, new { enctype = "multipart/form-data" }))
    {
        <main role="main" class="ApplicationTemplate">
            <section class="FormTemplate formBlkStyle">
                <div class="FormPosition">
                    <div class="text-center">
                        <h1 class="fontExBold ApplicationTitle">Change password</h1>
                    </div>
                    <!--Form Panel-->

                    @if (string.IsNullOrEmpty(ViewBag.changepasstrue) || ViewBag.changepasstrue != "true")
                    {

                        <div class="FormPanel">
                            <!--PanelOne-->

                            <div class="row m-0 pt-4 welcomediv">
                                <div class="col-3">
                                    <a target="_blank" class="" href="/Home/Apply?student_id=@student_id">
                                        <img src="~/img/application/application.png" class="img-fluid d-block mx-auto" />
                                        My Application
                                    </a>
                                </div>
                                <div class="col-3">

                                    <a target="_blank" href="/application/PrintForm?student_id=@student_id">
                                        <img src="~/img/application/printer.png" class="img-fluid d-block mx-auto" />
                                        Print My Application
                                    </a>
                                    @*@Html.ActionLink("Print Application", "PrintForm", "Application", new { student_id = student_id }, null)*@
                                </div>
                                <div class="col-3">
                                    <a target="_blank" class="active" href="@Url.Action("changepassword","Application")">
                                        <img src="~/img/application/password.png" class="img-fluid d-block mx-auto" />
                                        Change Password
                                    </a>
                                </div>
                                <div class="col-3">
                                    <a href="@Url.Action("logout","Application")">
                                        <img src="~/img/application/logout.png" class="img-fluid d-block mx-auto" />
                                        Logout
                                    </a>
                                </div>


                            </div>
                            <div class="FormPanelInner" id="FormPanelOne">

                                <div class="form-group">
                                    <input type="password" class="form-control FormStyle" id="oldpassword" maxlength="6" placeholder="Old Password" name="oldpassword" />
                                </div>


                                <div class="form-group">
                                    <input type="password" class="form-control FormStyle" id="newpassword" maxlength="6" placeholder="New Password" name="newpassword" />
                                </div>


                                <div class="form-group">
                                    <input type="password" class="form-control FormStyle" id="confirmpassword" maxlength="6" placeholder="Confirm Password" name="confirmpassword" />
                                </div>

                                <p style="color:red">@ViewBag.errchangepass</p>
                                <div class="clearfix"></div>
                                <div class="text-center">
                                    <button class="btn btn-primary BtnStyle" type="submit" onclick="return onchangepass();">SUBMIT</button>

                                </div>
                                <hr />

                                <p>&nbsp;</p>
                            </div>
                        </div>
                    }
                    else
                    {

                        <div class="FormPanel">
                            <div class="FormPanelInner" id="FormPanelOne">
                                <p>Your password has been reset successfully! Your new password has been sent to your registered email address.</p>
                                <br />
                                <a href="/">Click here to login</a>
                            </div>
                        </div>
                    }

                    @*else
                        {
                            <div class="FormPanel">
                                <div class="FormPanelInner" id="FormPanelOne">
                                    <p>Your Password is sent to your registered Email-Id and Mobile</p>
                                    <br />
                                    <a href="/login">Go to Login</a>
                                </div>
                            </div>
                        }*@


                </div>
            </section>
        </main>
    }
    <!--Footer-->
    <footer>
        <section class="FooterPanel">
            <div class="foot_Btm foot_Btm_Height">
                <div class="plr70">
                    <div class="footBtmRow foot_Btm_Height row align-items-center no-gutters">
                        <div class="col-sm-6 copyRights">
                            <h5 class="text-uppercase fontBold">
                                &copy; @DateTime.Now.Year The
                                University of Petroleum & Energy Studies
                            </h5>
                        </div>
                        <div class="col-sm-6 SocialIcon d-flex justify-content-end align-items-center">
                            <p class="text-uppercase fontBold">Follow Us On:</p>
                            <div class="social_icon_menus">
                                <a href="https://www.facebook.com/UniversityofPetroleumandEnergyStudies" target="_blank">
                                    <img src="../img/application/facebook-black.png" class="img-fluid" />
                                </a>
                                <a href="https://twitter.com/UPESDehradun" target="_blank">
                                    <img src="../img/application/twitter-black.png" class="img-fluid" />
                                </a>
                                <a href="https://www.instagram.com/upes_dehradun/" target="_blank">
                                    <img src="../img/application/insta-black.png" class="img-fluid" />
                                </a>
                                <a href="https://www.youtube.com/user/UPESUniversity/featured" target="_blank">
                                    <img src="../img/application/youtube-black.png" class="img-fluid" />
                                </a>
                                <a href="https://www.linkedin.com/school/university-of-petroleum-and-energy-studies/" target="_blank">
                                    <img src="../img/application/linkedin-black.png" class="img-fluid" />
                                </a>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </section>
    </footer>


    <script type="text/javascript" src="../scripts/component.js?qr=@DateTime.Now.Ticks"></script>
    <script type="text/javascript" src="../scripts/loader-min.js?qr=@DateTime.Now.Ticks"></script>
    <script type="text/javascript" src="../scripts/upes-appliaction.js?qr=@DateTime.Now.Ticks"></script>

    <script type="text/javascript">

        function isAlphaNumeric(str) {
            var code, i, len;

            for (i = 0, len = str.length; i < len; i++) {
                code = str.charCodeAt(i);
                if (!(code > 47 && code < 58) && // numeric (0-9)
                    !(code > 64 && code < 91) && // upper alpha (A-Z)
                    !(code > 96 && code < 123)) { // lower alpha (a-z)
                    return false;
                }
            }
            return true;
        }

        function onchangepass() {
            //console.log("ss");
            var oldpassword = $('#oldpassword').val().trim();
            var newpassword = $('#newpassword').val().trim();
            var confirmpassword = $('#confirmpassword').val().trim();
            //console.log(oldpassword);
            //console.log(newpassword);
            //console.log(confirmpassword);
            if (oldpassword == "") {
                $(".validation").remove();
                $("#oldpassword").focus();
                $("#oldpassword").after("<p class='validation' style='color:red;margin-bottom:0px;'>Please Enter the Old Password</p>");
                return false;
            }
            if (oldpassword.length != 6) {
                $(".validation").remove();
                $("#oldpassword").focus();
                $("#oldpassword").after("<p class='validation' style='color:red;margin-bottom:0px;'>Invalid Password</p>");
                return false;
            }
            if (newpassword == "") {
                $(".validation").remove();
                $("#newpassword").focus();
                $("#newpassword").after("<p class='validation' style='color:red;margin-bottom:0px;'>Please Enter the New Password</p>");
                return false;
            }
            // console.log(checkPasswordComplexity(newpassword));
            // if (!(checkPasswordComplexity(newpassword))) {

            //     $(".validation").remove();
            //     $("#newpassword").focus();
            //     $("#newpassword").after("<p class='validation' style='color:red;margin-bottom:0px;'>Password must be 6 digits</p>");
            //     return false;
            // }
            if (newpassword.length != 6) {
                $(".validation").remove();
                $("#newpassword").focus();
                $("#newpassword").after("<p class='validation' style='color:red;margin-bottom:0px;'>Password must be 6 digits</p>");
                return false;
            }
            if (confirmpassword == "") {
                $(".validation").remove();
                $("#confirmpassword").focus();
                $("#confirmpassword").after("<p class='validation' style='color:red;margin-bottom:0px;'>Please Confirm the Password</p>");
                return false;
            }

            // if (!(checkPasswordComplexity(confirmpassword))) {

            //     $(".validation").remove();
            //     $("#confirmpassword").focus();
            //     $("#confirmpassword").after("<p class='validation' style='color:red;margin-bottom:0px;'>Password must be 6 digits</p>");
            //     return false;
            // }

            if (confirmpassword.length != 6) {
                $(".validation").remove();
                $("#confirmpassword").focus();
                $("#confirmpassword").after("<p class='validation' style='color:red;margin-bottom:0px;'>Password must be 6 digits </p>");
                return false;
            }

            if (newpassword != confirmpassword) {

                $(".validation").remove();
                $("#confirmpassword").focus();
                $("#confirmpassword").after("<p class='validation' style='color:red;margin-bottom:0px;'>Confim Password not matched.</p>");
                return false;
            }

            // return false;


        }

        function loginRest() {
            $('#txtEmail').val('');

        }

        function checkPasswordComplexity(pwd) {
            // var AlphaNum = new RegExp(/^[a-z0-9]+$/i);
            //return AlphaNum.test(AlphaNum);
            return;
        }
    </script>
	<!--Start of SuperBot Chat Script-->

<script type="text/javascript">

window.$superbot||(function(d,s){var sb=$superbot=function(c){sb._.push(c)},$=sb.s=d.createElement(s),e=d.getElementsByTagName(s)[0];sb.set=function(o){sb.set._.push(o)};sb._=[];sb.set._=[];$.async=!0;$.setAttribute("charset","utf-8");$.src="https://app.superbot.works/agent.js?a=bZm18BXLDz&l=en";sb.t=+new Date;$.type="text/javascript";e.parentNode.insertBefore($,e)})(document,"script");

</script>

<!--End of SuperBot Chat Script-->
</body>

</html>