From 8837be36d9b48d701ae1e758dcf4fc3a41853063 Mon Sep 17 00:00:00 2001 From: abharana24 Date: Tue, 4 Feb 2020 01:43:28 +0530 Subject: [PATCH 01/14] webapi and UI for Users --- .../login_signup/assets/images/admin.jpg | Bin 0 -> 5647 bytes Abha_Rana/login_signup/assets/images/bg.jpg | Bin 0 -> 3188 bytes Abha_Rana/login_signup/assets/images/cg.png | Bin 0 -> 3926 bytes Abha_Rana/login_signup/html/admin.html | 53 +++++++ Abha_Rana/login_signup/html/index.html | 59 ++++++++ Abha_Rana/login_signup/html/signup.html | 133 +++++++++++++++++ Abha_Rana/login_signup/scripts/adminsc.js | 8 + Abha_Rana/login_signup/scripts/sc1.js | 124 +++++++++++++++ Abha_Rana/login_signup/scripts/script.js | 141 ++++++++++++++++++ Abha_Rana/login_signup/styles/adminstyle.css | 71 +++++++++ Abha_Rana/login_signup/styles/s1.css | 59 ++++++++ Abha_Rana/login_signup/styles/style.css | 4 + 12 files changed, 652 insertions(+) create mode 100644 Abha_Rana/login_signup/assets/images/admin.jpg create mode 100644 Abha_Rana/login_signup/assets/images/bg.jpg create mode 100644 Abha_Rana/login_signup/assets/images/cg.png create mode 100644 Abha_Rana/login_signup/html/admin.html create mode 100644 Abha_Rana/login_signup/html/index.html create mode 100644 Abha_Rana/login_signup/html/signup.html create mode 100644 Abha_Rana/login_signup/scripts/adminsc.js create mode 100644 Abha_Rana/login_signup/scripts/sc1.js create mode 100644 Abha_Rana/login_signup/scripts/script.js create mode 100644 Abha_Rana/login_signup/styles/adminstyle.css create mode 100644 Abha_Rana/login_signup/styles/s1.css create mode 100644 Abha_Rana/login_signup/styles/style.css diff --git a/Abha_Rana/login_signup/assets/images/admin.jpg b/Abha_Rana/login_signup/assets/images/admin.jpg new file mode 100644 index 0000000000000000000000000000000000000000..03a6c2e27c3e037097e599384c5b2a4141abcc43 GIT binary patch literal 5647 zcmbW4c|6qLzsEle#*&?^nTkY~7BWJ7Q%JIAU$e(xEZLbU+1HSns7xtaw(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sm6`A%4Rk_S*KHnrZpUXg0H;ms$E!%N=&~3l?6%V;c*pMPpM^zKGI~RSSxpx!>#{ z&JFv~&w>Ges5rx5v=f+O9D`l4^1*qB3GIO4)^vi?OW1T?WqZSS1z+qQRj_?WFsLF)iN_0=yneER`kL|36G(`A?d_3G z>AXKJtLadfe&Db^>O~1t_({#aV6Nr)TErnfRfe5aEIE632US(p z@xY18n|?JgolCNH>Yi2k>D5yB2W3Cqm@5>&aX&H1&n@jX@#|A(HnTzbfUVxkuAh)3 zpR`mQsUx}ls`o)fOR7dhXu`yVlW)ynfGT}8gGhoqZTy`%yUp@LoFaE#ikSx182+4@ zot^zLo4K)^J9gzg(xQB%RQY8V4yCSpVHWLJxj{?N{$WHuHvS6I|TJudOo!MljtEDx5$|aPV)co=}?#AqIdeK5trO5c^>z> zkDc`L*8#=`tAB0!i$cyHT$z@_pprE~a$~hjv0@LR!%go*Q}Qj&{ke%gpSQDggwn`gd~J zg9BUgM=n@Sud2hABWIw})uh@v-AHgJdfZpZFawVO literal 0 HcmV?d00001 diff --git a/Abha_Rana/login_signup/assets/images/bg.jpg b/Abha_Rana/login_signup/assets/images/bg.jpg new file mode 100644 index 0000000000000000000000000000000000000000..1dc18176c091abcbb932342a3ed2c74c94f8310c GIT binary patch literal 3188 zcmYjT2{>EZ7EYvwQnN&bR8gVQAjZ<_fVkC0>7|C6ikgQ$YHSUy8X7c3q^6=o6W1(g zi;K2t5OQk>HH5mximByNQ+o5_zW2WGt^IxbtbNwM_d5IEYp->CK6$IIOK^T5~+Xq4#89YWB#W{93r{z z0Fpw03g8(KP#M4{2?R+3xgP=Y0018dc=)OR6Fv|Cc!Xa-kZ07F0PqGNK9Il>0UqiQ z0ptT6k(5%p%#XSut*qk_`Y5aP{h+C5Si{VB-CtF*%LI7Spg_RklK;2nKhyXRZAy~= zSonBeK>zg!l;i_RDWNWVgdS1W;Z6XK@jUTKf+PVK0pC8|z-KO6cv+k$k2opnEYWaj z+O%hBIxB>$EIpL2p3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=KCOtuyMjFKdy;SzbBab3vxAnNPReVl-=f;7YU3efF*_+w+oLE5l*b6B zi3i}Jct!V&zRnIL|G|^`Pv{VV`AIYWmfNLo=R#-fu#@biCS1XieYyp^HnsA5rzp#3 zbg~82x3Ky3qkBqpLay2M%9&vLD_p$dt@t+JY`p4OhXz_>d;9(xg1OjlQuDdO8h$JI zhda%BP*!cRCGPG`=4kYXZc&azE3)HU{FBYS?dIaWY0IMBe!r6GMUUZtZ~B{c<-MDP zrLH{W8 z!fj#Q6nMtS{N$|vZi7KYld+&xxOxi3D0XW61m2AFg#G&4U_7ZNzHzKOB;vcZH;0j= zVVx_(`w{GLb8xMFaeAb~!MXX|!SK%n`d58uVV_IQ`hh0>zVZ{_`Q>$!i{euEI{8~}Hv(l0J*PuHm)sYX!g|wxfnC6grm4x-+3z;6=@qYts9P07_ literal 0 HcmV?d00001 diff --git a/Abha_Rana/login_signup/assets/images/cg.png b/Abha_Rana/login_signup/assets/images/cg.png new file mode 100644 index 0000000000000000000000000000000000000000..947fb7733ca3e411d0dc939f6836449a47091313 GIT binary patch literal 3926 zcma))x-0wZ-o^uoR^)wmiIOzZY0E5+uI=!2!TL2^yeeK5I;)bC8hAFs;ZK+ z4Fe}8If3X8=K4Gl#^MC_a2t*)+?l$2CZ zPAh6lZucP)x!^ zk}E6@gCCI^^G`Ywj?hjgI3H4`CaEfdR2uk?(0mwcb<$vc@GjtVB==um^ntq~F+t;e zXXYUI>1l&L`D^IOkF?`X?AcNmF-G&a*rE4*Y0{P9U0UiY#zDE;IsYtYdpUd3z%nY| zH|boMsUBV1kNO2e6c!ahJOZa0NuPHn1CAR$TwcBw>a%*Q^Cgj!Gp)VyfU?M$LWgJb1&xnGEqaCwR^>&h<>a*6#bAf@*(fF2ce=k$rpg^ zT6O_usEt+b)iMeS3QQ9{y)?yEK9q+n3bcZn#X&%{y6RU{!=MOHCBJFB37Z^Rn4!B% zJ?PG}*>AVhZ~hv4=AydG<0lBcrQ2WoCeH`p4Kx66O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2|6rxij0^;h4GR}0ZmR01b{`In~I^2C-%hPwdP-|Hgfui(wZ4|(;%?n1l8T;A@^ y_uh%@Oy|4!rY_}_8>6~@FSn)s4`Q;t1S-}jJjK`fCtiKW0If%Q>NTo}sQ&{bn}4$a literal 0 HcmV?d00001 diff --git a/Abha_Rana/login_signup/html/admin.html b/Abha_Rana/login_signup/html/admin.html new file mode 100644 index 0000000..d399a64 --- /dev/null +++ b/Abha_Rana/login_signup/html/admin.html @@ -0,0 +1,53 @@ + + + + + + Page Title + + + + + + + + + + + + + + + + + + + +
+ +
+ + \ No newline at end of file diff --git a/Abha_Rana/login_signup/html/index.html b/Abha_Rana/login_signup/html/index.html new file mode 100644 index 0000000..d3d1153 --- /dev/null +++ b/Abha_Rana/login_signup/html/index.html @@ -0,0 +1,59 @@ + + + + Login Page + + + + + + + + + + +
+
+
+
+

Member Log In

+
+
+
+
+
+ +
+ + +
+
+
+ +
+ +
+
+ +
+
+
+ +
+
+
+ + + + + + + + \ No newline at end of file diff --git a/Abha_Rana/login_signup/html/signup.html b/Abha_Rana/login_signup/html/signup.html new file mode 100644 index 0000000..1ab0b3a --- /dev/null +++ b/Abha_Rana/login_signup/html/signup.html @@ -0,0 +1,133 @@ + + + + + + Page Title + + + + + + + + + + + + + + + +
+ +
+
+ + +

Registration Form


+ + + +
+ +
+
+ + +
+
+
+ + + +
+ +
+
+ + +
+
+
+ + + +
+ +
+
+ + +
+
+
+ + + + +
+ +
+
+ + +
+
+
+ + + + +
+ +
+
+ + +
+
+
+ + + +
+ +
+
+ + +
+
+
+ + + + + + + +
+ +

+                                +
+
+ +
+
+
+ + + + \ No newline at end of file diff --git a/Abha_Rana/login_signup/scripts/adminsc.js b/Abha_Rana/login_signup/scripts/adminsc.js new file mode 100644 index 0000000..f24420a --- /dev/null +++ b/Abha_Rana/login_signup/scripts/adminsc.js @@ -0,0 +1,8 @@ +/*function openNav() { + document.getElementById("mySidenav").style.width = "100%"; + } + + /* Close/hide the sidenav + function closeNav() { + document.getElementById("mySidenav").style.width = "0"; + }*/ \ No newline at end of file diff --git a/Abha_Rana/login_signup/scripts/sc1.js b/Abha_Rana/login_signup/scripts/sc1.js new file mode 100644 index 0000000..2a7e2d5 --- /dev/null +++ b/Abha_Rana/login_signup/scripts/sc1.js @@ -0,0 +1,124 @@ +document.getElementById("btn").addEventListener("click",login); +function login() +{ + + var Username=document.getElementById("Username").value; + var Password=document.getElementById("Password").value; + var loginObj={ + "Username":Username, + "Password":Password + }; + console.log(loginObj); + + const http = new XMLHttpRequest(); + const url = "http://localhost:44352/api/login"; + http.open("POST", url,true); + http.setRequestHeader("Content-type", "application/json"); + console.log(JSON.stringify(loginObj)); + http.send(JSON.stringify(loginObj)); + http.onreadystatechange = (e) => { + console.log(http.responseText); + } + + event.preventDefault(); + //location.href="../html/admin.html"; + + } + + + +/*var loginObj = { + Username: "", + Password: "" +}; + +var btn=document.getElementById("#btn"); +if(btn) +{ +btn.addEventListener("click", () => { + for (let key in loginObj) { + loginObj[key] = document.getElementById(key).value.trim(); + } + console.log(loginObj); + + requestToApi(); + + event.preventDefault(); +}); + +requestToApi = () => { + var { Username, Password } = loginObj; + + if (Username.trim().length >= 5 && Password.trim().length >= 6) { + const http = new XMLHttpRequest(); + const url = "https://localhost:44352/api/login"; + + http.open("POST", url); + http.setRequestHeader("Content-type", "application/json"); + + console.log(JSON.stringify(loginObj)); + + http.send(JSON.stringify(loginObj)); + + http.onreadystatechange = e => { + console.log(http); + + window.location.href = "admin.html"; + } + console.log(http.responseText); + + }; + +}; +} + +/*function Validate() + + { + + var UName=document.getElementById('uname').value; + + var Password=document.getElementById('pass').value; + + if((UName.value=='') || (Password.value=='')) + + { alert('UserName or Password should not be blank'); + return false; + } + else + { + $( document ).ready(function() { + $("#btn").click(function(){ + var objectdata = { + "uname": UName, + "pass": pass + } + var xhttp = new XMLHttpRequest(); + xhttp.onreadystatechange = function() { + if (this.readyState == 4 && this.status == 200) { + xhttp.open("POST", "https://localhost:44352/api/login/validate", true); + xhttp.send(objectdata); + } + }; + }); +}); +function login() +{ + var Username=document.getElementById("uname").value; + var Password=document.getElementById("pass").value; + var userdata={ + "Username":Username, + "Password":Password + }; + console.log(userdata); + var xhr = new XMLHttpRequest(); + var url="https://localhost:44352/api/login"; + xhr.open("POST", url,true); + xhr.responseType='json'; + xhr.setRequestHeader('Content-type', 'application/json'); + console.log(JSON.stringify(userdata)); + xhr.send(JSON.stringify(userdata)); + + + location.href="../html/admin.html"; +}*/ \ No newline at end of file diff --git a/Abha_Rana/login_signup/scripts/script.js b/Abha_Rana/login_signup/scripts/script.js new file mode 100644 index 0000000..24e8966 --- /dev/null +++ b/Abha_Rana/login_signup/scripts/script.js @@ -0,0 +1,141 @@ +document.getElementById("btn").addEventListener("click",Postdata); +function Postdata() +{ + var Username=document.getElementById("uname").value; + var Password=document.getElementById("pass").value; + var Name=document.getElementById("name").value; + var Email=document.getElementById("email").value; + var Phone=document.getElementById("num").value; + var Address=document.getElementById("add").value; + var userdata={ + "Username":Username, + "Password":Password, + "Name":Name, + "Email":Email, + "Phone":Phone, + "Address":Address + }; + console.log(userdata); + var xhr = new XMLHttpRequest(); + var url="https://localhost:44352/api/signup"; + xhr.open("POST", url,true); + xhr.responseType='json'; + xhr.setRequestHeader('Content-type', 'application/json'); + console.log(JSON.stringify(userdata)); + xhr.send(JSON.stringify(userdata)); + + } + + + +//$(document).ready(function() { + /*$('#contact_form').bootstrapValidator({ + // To use feedback icons, ensure that you use Bootstrap v3.1.0 or later + feedbackIcons: { + valid: 'glyphicon glyphicon-ok', + invalid: 'glyphicon glyphicon-remove', + validating: 'glyphicon glyphicon-refresh' + }, + fields: { + first_name: { + validators: { + stringLength: { + min: 2, + }, + notEmpty: { + message: 'Please enter your First Name' + } + } + }, + last_name: { + validators: { + stringLength: { + min: 2, + }, + notEmpty: { + message: 'Please enter your Last Name' + } + } + }, + user_name: { + validators: { + stringLength: { + min: 8, + }, + notEmpty: { + message: 'Please enter your Username' + } + } + }, + user_password: { + validators: { + stringLength: { + min: 8, + }, + notEmpty: { + message: 'Please enter your Password' + } + } + }, + confirm_password: { + validators: { + stringLength: { + min: 8, + }, + notEmpty: { + message: 'Please confirm your Password' + } + } + }, + email: { + validators: { + notEmpty: { + message: 'Please enter your Email Address' + }, + emailAddress: { + message: 'Please enter a valid Email Address' + } + } + }, + contact_no: { + validators: { + stringLength: { + min: 12, + max: 12, + notEmpty: { + message: 'Please enter your Contact No.' + } + } + }, + department: { + validators: { + notEmpty: { + message: 'Please select your Department/Office' + } + } + }, + } + } + }) + .on('success.form.bv', function(e) { + $('#success_message').slideDown({ opacity: "show" }, "slow") // Do something ... + $('#contact_form').data('bootstrapValidator').resetForm(); + + // Prevent form submission + e.preventDefault(); + + // Get the form instance + var $form = $(e.target); + + // Get the BootstrapValidator instance + var bv = $form.data('bootstrapValidator'); + + // Use Ajax to submit form data + $.post($form.attr('action'), $form.serialize(), function(result) { + console.log(result); + }, 'json'); + }); +*/ + + + diff --git a/Abha_Rana/login_signup/styles/adminstyle.css b/Abha_Rana/login_signup/styles/adminstyle.css new file mode 100644 index 0000000..f148df7 --- /dev/null +++ b/Abha_Rana/login_signup/styles/adminstyle.css @@ -0,0 +1,71 @@ +.navbar{ + position:fixed; + top:0; + margin:0; + border-radius: 0; + width: 100vw; + height:5vh; +} + +.logo +{ + position: relative; + width:50%; + height:210%; + +} + +.rounded-circle +{ + position: relative; + float:right; + height: 4%; + width:4%; + border-radius:40%; + +} +.brand-logo-mini +{ + position: relative; + left: 60%; + +} + + /* The navigation menu links */ + .sidenav a { + text-decoration: none; + line-height:10rem; + padding: 10% 5% 5% 5%; + font-size: medium; + color: #818181; + display: block; + transition: 0.3s; + } + .navbar-brand { + float: left; + height: 8%; + width: 20vw; + margin: 0 3rem 0; + font-size: small; + +} + /* When you mouse over the navigation links, change their color */ + .sidenav a:hover { + color: #f1f1f1; + } + .sidenav + { + position: fixed; + height: 100vh; + width: 15vw; + z-index: 1; + left: 0; + background-color: #111; + overflow-x: hidden; + margin:0; + } + + /* Page content */ + .main { + margin-left: 150px; /* Same as the width of the sidenav */ + } \ No newline at end of file diff --git a/Abha_Rana/login_signup/styles/s1.css b/Abha_Rana/login_signup/styles/s1.css new file mode 100644 index 0000000..405d24e --- /dev/null +++ b/Abha_Rana/login_signup/styles/s1.css @@ -0,0 +1,59 @@ +@import url('https://fonts.googleapis.com/css?family=Numans'); + +html,body{ +background-image: url('../assets/images/bg.jpg'); +background-size: cover; +background-repeat: no-repeat; +height: 100%; +font-family: 'Numans', sans-serif; +} + +.container{ +height: 100%; +align-content: center; +} + +.card{ +height: 370px; +margin-top: auto; +margin-bottom: auto; +width: 400px; +background-color: rgba(0,0,0,0.5) !important; +} + +.card-header h3{ + color: white; + } + + .input-group-prepend span{ + width: 50px; + background-color: #FFC312; + color: black; + border:0 !important; + } + + input:focus{ + outline: 0 0 0 0 !important; + box-shadow: 0 0 0 0 !important; + + } + +.login_btn{ + color: black; + background-color: #FFC312; + width: 100px; + + } + + .login_btn:hover{ + color: black; + background-color: white; + } + + .links{ + color: white; + } + + .links a{ + margin-left: 4px; + } \ No newline at end of file diff --git a/Abha_Rana/login_signup/styles/style.css b/Abha_Rana/login_signup/styles/style.css new file mode 100644 index 0000000..e1fb2d2 --- /dev/null +++ b/Abha_Rana/login_signup/styles/style.css @@ -0,0 +1,4 @@ +#success_message{ display: none;} +#btn{ + +} \ No newline at end of file From 257e732656ad2a431db07a25994e9e60da62f128 Mon Sep 17 00:00:00 2001 From: abharana24 Date: Tue, 4 Feb 2020 01:45:29 +0530 Subject: [PATCH 02/14] Added backend functionalities --- Abha_Rana/login_signup/userjwt/userjwt.sln | 25 ++++++ .../userjwt/Controllers/ValuesController.cs | 45 ++++++++++ .../userjwt/Controllers/loginController.cs | 83 +++++++++++++++++++ .../userjwt/Controllers/signupController.cs | 42 ++++++++++ .../userjwt/CustomModels/UserRequest.cs | 20 +++++ .../userjwt/userjwt/CustomModels/loginReq.cs | 13 +++ .../userjwt/userjwt/DbModels/Users.cs | 19 +++++ .../userjwt/DbModels/usersdbContext.cs | 77 +++++++++++++++++ .../login_signup/userjwt/userjwt/Program.cs | 24 ++++++ .../userjwt/Properties/launchSettings.json | 30 +++++++ .../login_signup/userjwt/userjwt/Startup.cs | 65 +++++++++++++++ .../userjwt/appsettings.Development.json | 9 ++ .../userjwt/userjwt/appsettings.json | 14 ++++ .../userjwt/userjwt/userjwt.csproj | 19 +++++ 14 files changed, 485 insertions(+) create mode 100644 Abha_Rana/login_signup/userjwt/userjwt.sln create mode 100644 Abha_Rana/login_signup/userjwt/userjwt/Controllers/ValuesController.cs create mode 100644 Abha_Rana/login_signup/userjwt/userjwt/Controllers/loginController.cs create mode 100644 Abha_Rana/login_signup/userjwt/userjwt/Controllers/signupController.cs create mode 100644 Abha_Rana/login_signup/userjwt/userjwt/CustomModels/UserRequest.cs create mode 100644 Abha_Rana/login_signup/userjwt/userjwt/CustomModels/loginReq.cs create mode 100644 Abha_Rana/login_signup/userjwt/userjwt/DbModels/Users.cs create mode 100644 Abha_Rana/login_signup/userjwt/userjwt/DbModels/usersdbContext.cs create mode 100644 Abha_Rana/login_signup/userjwt/userjwt/Program.cs create mode 100644 Abha_Rana/login_signup/userjwt/userjwt/Properties/launchSettings.json create mode 100644 Abha_Rana/login_signup/userjwt/userjwt/Startup.cs create mode 100644 Abha_Rana/login_signup/userjwt/userjwt/appsettings.Development.json create mode 100644 Abha_Rana/login_signup/userjwt/userjwt/appsettings.json create mode 100644 Abha_Rana/login_signup/userjwt/userjwt/userjwt.csproj diff --git a/Abha_Rana/login_signup/userjwt/userjwt.sln b/Abha_Rana/login_signup/userjwt/userjwt.sln new file mode 100644 index 0000000..c7bad42 --- /dev/null +++ b/Abha_Rana/login_signup/userjwt/userjwt.sln @@ -0,0 +1,25 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio 15 +VisualStudioVersion = 15.0.28307.902 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "userjwt", "userjwt\userjwt.csproj", "{CE6929CD-757C-4F43-91F3-54F53F176932}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {CE6929CD-757C-4F43-91F3-54F53F176932}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {CE6929CD-757C-4F43-91F3-54F53F176932}.Debug|Any CPU.Build.0 = Debug|Any CPU + {CE6929CD-757C-4F43-91F3-54F53F176932}.Release|Any CPU.ActiveCfg = Release|Any CPU + {CE6929CD-757C-4F43-91F3-54F53F176932}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {3EE242D1-9071-481F-9D24-F6B181EBEB1F} + EndGlobalSection +EndGlobal diff --git a/Abha_Rana/login_signup/userjwt/userjwt/Controllers/ValuesController.cs b/Abha_Rana/login_signup/userjwt/userjwt/Controllers/ValuesController.cs new file mode 100644 index 0000000..7262e4b --- /dev/null +++ b/Abha_Rana/login_signup/userjwt/userjwt/Controllers/ValuesController.cs @@ -0,0 +1,45 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; + +namespace userjwt.Controllers +{ + [Route("api/[controller]")] + [ApiController] + public class ValuesController : ControllerBase + { + // GET api/values + [HttpGet] + public ActionResult> Get() + { + return new string[] { "value1", "value2" }; + } + + // GET api/values/5 + [HttpGet("{id}")] + public ActionResult Get(int id) + { + return "value"; + } + + // POST api/values + [HttpPost] + public void Post([FromBody] string value) + { + } + + // PUT api/values/5 + [HttpPut("{id}")] + public void Put(int id, [FromBody] string value) + { + } + + // DELETE api/values/5 + [HttpDelete("{id}")] + public void Delete(int id) + { + } + } +} diff --git a/Abha_Rana/login_signup/userjwt/userjwt/Controllers/loginController.cs b/Abha_Rana/login_signup/userjwt/userjwt/Controllers/loginController.cs new file mode 100644 index 0000000..cae29e8 --- /dev/null +++ b/Abha_Rana/login_signup/userjwt/userjwt/Controllers/loginController.cs @@ -0,0 +1,83 @@ +using System; +using System.Collections.Generic; +using System.IdentityModel.Tokens.Jwt; +using System.Linq; +using System.Security.Claims; +using System.Text; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Authorization; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Configuration; +using Microsoft.IdentityModel.Tokens; +using userjwt.CustomModels; +using userjwt.DbModels; + +namespace userjwt.Controllers +{ + [Route("api/[controller]")] + [ApiController] + public class loginController : ControllerBase + { + DbModels.usersdbContext _usersdbContext; + + private IConfiguration _config; + + public loginController(IConfiguration config, DbModels.usersdbContext usersdbContext) + { + _config = config; + _usersdbContext = usersdbContext; + } + + [AllowAnonymous] + [HttpPost] + public IActionResult CreateToken([FromBody]CustomModels.loginReq login) + { + IActionResult response = Unauthorized(); + var user = Authenticate(login); + + if (user != null) + { + var tokenString = BuildToken(user); + response = Ok(new { token = tokenString }); + } + + return response; + } + + private string BuildToken(Users user) + { + var claims = new[] { + + // new Claim(JwtRegisteredClaimNames.Email, user.Email), + new Claim(JwtRegisteredClaimNames.Sub, user.Username), + // new Claim("Role", user.Role), + // new Claim("Address", user.Address), + // new Claim("Project", user.Project), + // new Claim("ProjectManager", user.ProjectManager), + new Claim(JwtRegisteredClaimNames.Jti, Guid.NewGuid().ToString()) + }; + + var key = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(_config["Jwt:Key"])); + var creds = new SigningCredentials(key, SecurityAlgorithms.HmacSha256); + + var token = new JwtSecurityToken(_config["Jwt:Issuer"], + _config["Jwt:Issuer"], + claims, + expires: DateTime.Now.AddMinutes(30), + signingCredentials: creds); + + return new JwtSecurityTokenHandler().WriteToken(token); + } + + private Users Authenticate(loginReq Details) + { + Users user = _usersdbContext.Users.Where(x => x.Username == Details.Username && x.Password == Details.Password).FirstOrDefault(); + if (user != null) + { + user = new Users { Username = user.Username, Email = user.Email, Role = user.Role }; + } + return user; + } + } +} diff --git a/Abha_Rana/login_signup/userjwt/userjwt/Controllers/signupController.cs b/Abha_Rana/login_signup/userjwt/userjwt/Controllers/signupController.cs new file mode 100644 index 0000000..e5eeced --- /dev/null +++ b/Abha_Rana/login_signup/userjwt/userjwt/Controllers/signupController.cs @@ -0,0 +1,42 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore.Http; +using Microsoft.AspNetCore.Mvc; +using Microsoft.Extensions.Configuration; + +namespace userjwt.Controllers +{ + [Route("api/[controller]")] + [ApiController] + public class signupController : ControllerBase + { + DbModels.usersdbContext _usersdbContext; + + private IConfiguration _config; + + public signupController(IConfiguration config, DbModels.usersdbContext usersdbContext) + { + _config = config; + _usersdbContext = usersdbContext; + } + [HttpPost] + public IActionResult Createuser([FromBody]CustomModels.UserRequest userRequest) + { + DbModels.Users user = new DbModels.Users(); + user.Username = userRequest.Username; + user.Password = userRequest.Password; + user.Email = userRequest.Email; + user.Name = userRequest.Name; + // user.Project = userRequest.Project; + // user.ProjectManager = userRequest.ProjectManager; + user.Phone = userRequest.Phone; + user.Role = userRequest.Role; + user.Address = userRequest.Address; + _usersdbContext.Users.Add(user); + _usersdbContext.SaveChanges(); + return Ok("Record added"); + } + } +} \ No newline at end of file diff --git a/Abha_Rana/login_signup/userjwt/userjwt/CustomModels/UserRequest.cs b/Abha_Rana/login_signup/userjwt/userjwt/CustomModels/UserRequest.cs new file mode 100644 index 0000000..eec1536 --- /dev/null +++ b/Abha_Rana/login_signup/userjwt/userjwt/CustomModels/UserRequest.cs @@ -0,0 +1,20 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace userjwt.CustomModels +{ + public class UserRequest + { + public string Username { get; set; } + public string Password { get; set; } + public string Email { get; set; } + public string Name { get; set; } + // public string Project { get; set; } + // public string ProjectManager { get; set; } + public long? Phone { get; set; } + public string Role { get; set; } + public string Address { get; set; } + } +} diff --git a/Abha_Rana/login_signup/userjwt/userjwt/CustomModels/loginReq.cs b/Abha_Rana/login_signup/userjwt/userjwt/CustomModels/loginReq.cs new file mode 100644 index 0000000..5b9c71b --- /dev/null +++ b/Abha_Rana/login_signup/userjwt/userjwt/CustomModels/loginReq.cs @@ -0,0 +1,13 @@ +using System; +using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; + +namespace userjwt.CustomModels +{ + public class loginReq + { + public string Username { get; set; } + public string Password { get; set; } + } +} diff --git a/Abha_Rana/login_signup/userjwt/userjwt/DbModels/Users.cs b/Abha_Rana/login_signup/userjwt/userjwt/DbModels/Users.cs new file mode 100644 index 0000000..c0dff91 --- /dev/null +++ b/Abha_Rana/login_signup/userjwt/userjwt/DbModels/Users.cs @@ -0,0 +1,19 @@ +using System; +using System.Collections.Generic; + +namespace userjwt.DbModels +{ + public partial class Users + { + public int Empid { get; set; } + public string Username { get; set; } + public string Password { get; set; } + public string Email { get; set; } + public string Name { get; set; } + public string Project { get; set; } + public string ProjectManager { get; set; } + public long? Phone { get; set; } + public string Role { get; set; } + public string Address { get; set; } + } +} diff --git a/Abha_Rana/login_signup/userjwt/userjwt/DbModels/usersdbContext.cs b/Abha_Rana/login_signup/userjwt/userjwt/DbModels/usersdbContext.cs new file mode 100644 index 0000000..126e8f0 --- /dev/null +++ b/Abha_Rana/login_signup/userjwt/userjwt/DbModels/usersdbContext.cs @@ -0,0 +1,77 @@ +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata; + +namespace userjwt.DbModels +{ + public partial class usersdbContext : DbContext + { + public usersdbContext() + { + } + + public usersdbContext(DbContextOptions options) + : base(options) + { + } + + public virtual DbSet Users { get; set; } + + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) + { + if (!optionsBuilder.IsConfigured) + { +#warning To protect potentially sensitive information in your connection string, you should move it out of source code. See http://go.microsoft.com/fwlink/?LinkId=723263 for guidance on storing connection strings. + optionsBuilder.UseSqlServer("Server=CYG292;Database=usersdb;Trusted_Connection=True;"); + } + } + + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + modelBuilder.Entity(entity => + { + entity.HasKey(e => e.Email); + + entity.Property(e => e.Email) + .HasMaxLength(100) + .IsUnicode(false) + .ValueGeneratedNever(); + + entity.Property(e => e.Address) + .HasMaxLength(200) + .IsUnicode(false); + + entity.Property(e => e.Empid).ValueGeneratedOnAdd(); + + entity.Property(e => e.Name) + .IsRequired() + .HasMaxLength(50) + .IsUnicode(false); + + entity.Property(e => e.Password) + .IsRequired() + .HasMaxLength(100) + .IsUnicode(false); + + entity.Property(e => e.Project) + .HasMaxLength(50) + .IsUnicode(false); + + entity.Property(e => e.ProjectManager) + .HasMaxLength(50) + .IsUnicode(false); + + entity.Property(e => e.Role) + .IsRequired() + .HasMaxLength(50) + .IsUnicode(false) + .HasDefaultValueSql("('Employee')"); + + entity.Property(e => e.Username) + .IsRequired() + .HasMaxLength(200) + .IsUnicode(false); + }); + } + } +} diff --git a/Abha_Rana/login_signup/userjwt/userjwt/Program.cs b/Abha_Rana/login_signup/userjwt/userjwt/Program.cs new file mode 100644 index 0000000..3d2ff8b --- /dev/null +++ b/Abha_Rana/login_signup/userjwt/userjwt/Program.cs @@ -0,0 +1,24 @@ +using System; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Threading.Tasks; +using Microsoft.AspNetCore; +using Microsoft.AspNetCore.Hosting; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.Logging; + +namespace userjwt +{ + public class Program + { + public static void Main(string[] args) + { + CreateWebHostBuilder(args).Build().Run(); + } + + public static IWebHostBuilder CreateWebHostBuilder(string[] args) => + WebHost.CreateDefaultBuilder(args) + .UseStartup(); + } +} diff --git a/Abha_Rana/login_signup/userjwt/userjwt/Properties/launchSettings.json b/Abha_Rana/login_signup/userjwt/userjwt/Properties/launchSettings.json new file mode 100644 index 0000000..67f59dd --- /dev/null +++ b/Abha_Rana/login_signup/userjwt/userjwt/Properties/launchSettings.json @@ -0,0 +1,30 @@ +{ + "$schema": "http://json.schemastore.org/launchsettings.json", + "iisSettings": { + "windowsAuthentication": false, + "anonymousAuthentication": true, + "iisExpress": { + "applicationUrl": "http://localhost:62429", + "sslPort": 44352 + } + }, + "profiles": { + "IIS Express": { + "commandName": "IISExpress", + "launchBrowser": true, + "launchUrl": "api/values", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + }, + "userjwt": { + "commandName": "Project", + "launchBrowser": true, + "launchUrl": "api/values", + "applicationUrl": "https://localhost:5001;http://localhost:5000", + "environmentVariables": { + "ASPNETCORE_ENVIRONMENT": "Development" + } + } + } +} \ No newline at end of file diff --git a/Abha_Rana/login_signup/userjwt/userjwt/Startup.cs b/Abha_Rana/login_signup/userjwt/userjwt/Startup.cs new file mode 100644 index 0000000..badb073 --- /dev/null +++ b/Abha_Rana/login_signup/userjwt/userjwt/Startup.cs @@ -0,0 +1,65 @@ +using System.Text; +using Microsoft.AspNetCore.Authentication.JwtBearer; +using Microsoft.AspNetCore.Builder; +using Microsoft.AspNetCore.Hosting; +using Microsoft.AspNetCore.Mvc; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Configuration; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.IdentityModel.Tokens; + +namespace userjwt +{ + public class Startup + { + public Startup(IConfiguration configuration) + { + Configuration = configuration; + } + + public IConfiguration Configuration { get; } + + // This method gets called by the runtime. Use this method to add services to the container. + public void ConfigureServices(IServiceCollection services) + { + services.AddDbContext(o => o.UseSqlServer("server=CYG292; database=usersdb;Trusted_Connection=True;")); + services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); + services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) + .AddJwtBearer(options => + { + options.TokenValidationParameters = new TokenValidationParameters + { + ValidateIssuer = true, + ValidateAudience = true, + ValidateLifetime = true, + ValidateIssuerSigningKey = true, + ValidIssuer = Configuration["Jwt:Issuer"], + ValidAudience = Configuration["Jwt:Issuer"], + IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(Configuration["Jwt:Key"])) + }; + }); + services.AddMvc(); + + } + + // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. + public void Configure(IApplicationBuilder app, IHostingEnvironment env) + { + if (env.IsDevelopment()) + { + app.UseDeveloperExceptionPage(); + } + else + { + app.UseHsts(); + } + + app.UseHttpsRedirection(); + app.UseCors(builder => builder.AllowAnyHeader().AllowAnyMethod().AllowAnyOrigin()); + app.UseMvc(); + app.UseAuthentication(); + + } + } +} + diff --git a/Abha_Rana/login_signup/userjwt/userjwt/appsettings.Development.json b/Abha_Rana/login_signup/userjwt/userjwt/appsettings.Development.json new file mode 100644 index 0000000..e203e94 --- /dev/null +++ b/Abha_Rana/login_signup/userjwt/userjwt/appsettings.Development.json @@ -0,0 +1,9 @@ +{ + "Logging": { + "LogLevel": { + "Default": "Debug", + "System": "Information", + "Microsoft": "Information" + } + } +} diff --git a/Abha_Rana/login_signup/userjwt/userjwt/appsettings.json b/Abha_Rana/login_signup/userjwt/userjwt/appsettings.json new file mode 100644 index 0000000..ceea9a6 --- /dev/null +++ b/Abha_Rana/login_signup/userjwt/userjwt/appsettings.json @@ -0,0 +1,14 @@ +/*{ + "Logging": { + "LogLevel": { + "Default": "Warning" + } + }, + "AllowedHosts": "*" +}*/ +{ + "Jwt": { + "Key": "ThisismySecretKey", + "Issuer": "Test.com" + } +} diff --git a/Abha_Rana/login_signup/userjwt/userjwt/userjwt.csproj b/Abha_Rana/login_signup/userjwt/userjwt/userjwt.csproj new file mode 100644 index 0000000..9789ed6 --- /dev/null +++ b/Abha_Rana/login_signup/userjwt/userjwt/userjwt.csproj @@ -0,0 +1,19 @@ + + + + netcoreapp2.1 + + + + + + + + + + + + + + + From bacb911f01f746a9e378a1247e8c06a9890fbe58 Mon Sep 17 00:00:00 2001 From: abharana24 Date: Thu, 6 Feb 2020 14:49:12 +0530 Subject: [PATCH 03/14] rendering dynamic data on basis of user roles on loading of page after logging in --- Abha_Rana/login_signup/assets/images/adbg.jpg | Bin 0 -> 1526 bytes Abha_Rana/login_signup/html/admin.html | 127 ++++--- Abha_Rana/login_signup/html/profile.html | 27 ++ Abha_Rana/login_signup/scripts/adminsc.js | 332 +++++++++++++++++- Abha_Rana/login_signup/scripts/profile.js | 91 +++++ Abha_Rana/login_signup/scripts/sc1.js | 96 +++-- Abha_Rana/login_signup/styles/adminstyle.css | 87 ++--- Abha_Rana/login_signup/styles/profile.css | 30 ++ 8 files changed, 656 insertions(+), 134 deletions(-) create mode 100644 Abha_Rana/login_signup/assets/images/adbg.jpg create mode 100644 Abha_Rana/login_signup/html/profile.html create mode 100644 Abha_Rana/login_signup/scripts/profile.js create mode 100644 Abha_Rana/login_signup/styles/profile.css diff --git a/Abha_Rana/login_signup/assets/images/adbg.jpg b/Abha_Rana/login_signup/assets/images/adbg.jpg new file mode 100644 index 0000000000000000000000000000000000000000..7b2374182d6174446fe2318a29db920bb7d13039 GIT binary patch literal 1526 zcmZ8fZA?>F7(Tb9AG=uLT5h4GIuOg+Udlu$Uuq@=D!W#M(iZ4Q<|GUXE<$C?B>uoT zlyohAq?ZuZIw&o)rNy9^MB+$rQAg@%=w&i>OEz6lVfts(AO2#u=sw(gPtG}co}BwW z=XuWhz4hNfBCdX44Il^ri2lI(&)`e&7MsI+RU8g4Hnh-Ih>1Y!H-QiUCKOZpZ$S(un?+N}i8S#B10aM!6DcwL4Tb?R z0h?w7$eTF*QwUjq05&lpx+N09RdYopq%mkn*|Gnc}VUTAvyOa#quUgw3UJxL=xD9I~<*JsCi%%_&cG0|dmW zGTgl~7=My;r?OgPjvg~!yVh6Bp6=*C-0<&~9+Y8mxsD9klqyS!OFDeB`C!%Xjlhb7 zgE-;yVu7xdtt9rag-e~o-QlZ4*6QIBxJ2D8OY4@krW1-C`&jQ}4BCpC?o>q28L2$$ zqnGgG3mpyf^F(FO_7~i#tT!(XMn7GB5ikkM*HqVyw{BOv;pZk4 zK^ddunE@|TPj3@jAKD9*PM!9nUVV9{Ot^Ta>XuViIM5-i0lemYX{a+UUOnqNKUG|q zWHc%iVnjW5pc?gfOuG}KNSotH(Kzvq(mb=Z%h@(>!nPUl@O9%_EtcK73_rdyVbD%g zO^R@DSdZs#CJFOZqDoC#tji4}stK`1mpF#}(mK>l zD;;Cc1|@sd4xe>3`a+}>>Q_vrR+fSAct#qF6&OyD?Xm}7!$P5niQNLeTkKfz`D1?4~sopQ@y26&gOdV|z;a zL}|p0h%YP6S7;x$p3_kJP)Hx51K3b-^#2O-3GEd^+td3XmP06?*Ct=4BaCNEZQyik zNl|?$sDWqpHp^BUi)TbOk+!Ba zG~i#-j@Jn9uKclguPA(3J)-VuuJ!mLBlU|B-$ME!oZ=?6u)LWjt|j6Yp8@*|U+Sd^ zWl;;E9XL+NmjOmkY07y?!w?Ji)k-0?UmpSyo!>qi@!O+NvtAYg3u9wLtY)=sC+ZX# a57$$XA+C0T!2)rmAni0X2e?nx@BanZ4Mzq5 literal 0 HcmV?d00001 diff --git a/Abha_Rana/login_signup/html/admin.html b/Abha_Rana/login_signup/html/admin.html index d399a64..fb404f9 100644 --- a/Abha_Rana/login_signup/html/admin.html +++ b/Abha_Rana/login_signup/html/admin.html @@ -1,53 +1,96 @@ - - - Page Title - - - - - - - - - - - + + + Page Title + + + + + + + + + - - - - - - -
-
+ + + - - - - - -
-
-
-
- - - \ No newline at end of file diff --git a/Abha_Rana/login_signup/html/index.html b/Abha_Rana/login_signup/html/index.html deleted file mode 100644 index d3d1153..0000000 --- a/Abha_Rana/login_signup/html/index.html +++ /dev/null @@ -1,59 +0,0 @@ - - - - Login Page - - - - - - - - - - -
-
-
-
-

Member Log In

-
-
-
-
-
- -
- - -
-
-
- -
- -
-
- -
-
-
- -
-
-
- - - - - - - - \ No newline at end of file diff --git a/Abha_Rana/login_signup/html/profile.html b/Abha_Rana/login_signup/html/profile.html deleted file mode 100644 index 44b8b57..0000000 --- a/Abha_Rana/login_signup/html/profile.html +++ /dev/null @@ -1,27 +0,0 @@ - - - - - - Page Title - - - - - - - - - - - - - - -
UsernameNameEmailRole
- - - \ No newline at end of file diff --git a/Abha_Rana/login_signup/html/signup.html b/Abha_Rana/login_signup/html/signup.html deleted file mode 100644 index 1ab0b3a..0000000 --- a/Abha_Rana/login_signup/html/signup.html +++ /dev/null @@ -1,133 +0,0 @@ - - - - - - Page Title - - - - - - - - - - - - - - - -
- -
-
- - -

Registration Form


- - - -
- -
-
- - -
-
-
- - - -
- -
-
- - -
-
-
- - - -
- -
-
- - -
-
-
- - - - -
- -
-
- - -
-
-
- - - - -
- -
-
- - -
-
-
- - - -
- -
-
- - -
-
-
- - - - - - - -
- -

-                                -
-
- -
-
-
- - - - \ No newline at end of file diff --git a/Abha_Rana/login_signup/scripts/adminsc.js b/Abha_Rana/login_signup/scripts/adminsc.js deleted file mode 100644 index 0f1b22d..0000000 --- a/Abha_Rana/login_signup/scripts/adminsc.js +++ /dev/null @@ -1,172 +0,0 @@ -let accesstoken=localStorage.getItem("JWTtoken"); -//document.getElementById("add__new__list").addEventListener("click", addUser); -let data = DecodeToken(accesstoken); -let obj = { - Role: data.Role, - Username: data.Username -}; - - -function drawTable() -{ - var xhr = new XMLHttpRequest(); - var url="https://localhost:44352/api/data"; - xhr.open("GET", url,true); - xhr.setRequestHeader('Content-type', 'application/json'); - xhr.send(); - xhr.onload = function() { - if (xhr.readyState === XMLHttpRequest.DONE && xhr.status === 200) { - var userdata=JSON.parse(xhr.response); - console.log(userdata); - var table = document.getElementById("empTable"); - for(let i=0; i { - var base64Url = token.split('.')[1]; - var base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/'); - var jsonPayload = decodeURIComponent(atob(base64).split('').map(function(c) { - return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2); - }).join('')); - - return JSON.parse(jsonPayload); -}; - -window.onload = () => { - //document.getElementById("empRole").style.display = "none"; - if (typeof(Storage) !== "undefined") { - const token = localStorage.getItem("JWTtoken"); - if(token != null){ - var jsonPayload = jsonDecoder(token); - console.log(jsonPayload) - // document.getElementById("userName").innerHTML = jsonPayload.Username; - drawTable(); - } - else{ - console.log("There is no JwtToken present"); - window.location.href = "./index.html"; - } - } - else { - alert("Sorry ! Your browser is not cool."); - } -} - -const lgout = () => { - if (typeof(Storage) !== "undefined") { - localStorage.removeItem("JwtTOKEN"); - console.log("something is not working"); - window.location.href = "./index.html"; - } else { - // Sorry! No Web Storage support.. - alert("Sorry ! Your browser is not cool."); - } -} -const viewdetails = () => { - window.location.href="profile.html"; - -} -const deleteuser = () => { - var n=window.prompt("enter name of user you want ot delete:","Name"); - var ob={ "name":n}; - var xhr = new XMLHttpRequest(); - var url="https://localhost:44352/api/data"; - xhr.open("DELETE", url,true); - xhr.setRequestHeader('Content-type', 'application/json'); - xhr.send(JSON.stringify(ob)); - xhr.onload = function() { - if (xhr.readyState === XMLHttpRequest.DONE && xhr.status === 200) { - var userdata=xhr.response; - console.log(userdata); - window.alert(userdata); -} - } -} -const updateuser = () => { - var n=window.prompt("enter name :","Name"); - var e=window.prompt("enter email :","email"); - var a=window.prompt("enter address :","address"); - var ob={ "Name":n, -"Email": e, -"Address": a}; - var xhr = new XMLHttpRequest(); - var url="https://localhost:44352/api/data"; - xhr.open("PUT", url,true); - xhr.setRequestHeader('Content-type', 'application/json'); - xhr.send(JSON.stringify(ob)); - xhr.onload = function() { - if (xhr.readyState === XMLHttpRequest.DONE && xhr.status === 200) { - var userdata=xhr.response; - console.log(userdata); - window.alert(userdata); -} - } -} - - -document.getElementById("logOut").addEventListener('click', lgout); -document.getElementById("profile").addEventListener('click', viewdetails); -document.getElementById("delete").addEventListener('click', deleteuser); -document.getElementById("update").addEventListener('click', updateuser); diff --git a/Abha_Rana/login_signup/scripts/profile.js b/Abha_Rana/login_signup/scripts/profile.js deleted file mode 100644 index cffce48..0000000 --- a/Abha_Rana/login_signup/scripts/profile.js +++ /dev/null @@ -1,91 +0,0 @@ -let accesstoken=localStorage.getItem("JWTtoken"); -let data = DecodeToken(accesstoken); -let obj = { - Role: data.Role, - Username: data.Username -}; -$( document ).ready(function() { - var xhr = new XMLHttpRequest(); - var url="https://localhost:44352/api/data/1"; - xhr.open("GET", url,true); - xhr.setRequestHeader('Content-type', 'application/json'); - xhr.send(); - xhr.onload = function() { - if (xhr.readyState === XMLHttpRequest.DONE && xhr.status === 200) { - var userdata=JSON.parse(xhr.response); - console.log(userdata); - - } - } - var table = document.getElementById("userdata"); - for(let i=0; i { - var base64Url = token.split('.')[1]; - var base64 = base64Url.replace(/-/g, '+').replace(/_/g, '/'); - var jsonPayload = decodeURIComponent(atob(base64).split('').map(function(c) { - return '%' + ('00' + c.charCodeAt(0).toString(16)).slice(-2); - }).join('')); - - return JSON.parse(jsonPayload); - }; \ No newline at end of file diff --git a/Abha_Rana/login_signup/scripts/sc1.js b/Abha_Rana/login_signup/scripts/sc1.js deleted file mode 100644 index 755a4c6..0000000 --- a/Abha_Rana/login_signup/scripts/sc1.js +++ /dev/null @@ -1,176 +0,0 @@ -document.getElementById("btn").addEventListener("click", login); - -function login() { - var Username = document.getElementById("Username").value; - var Password = document.getElementById("Password").value; - var loginObj = { - Username: Username, - Password: Password - }; - console.log(loginObj); - const promise = new Promise((resolve, reject) => { - const http = new XMLHttpRequest(); - const url = "https://localhost:44352/api/login"; - http.open("POST", url, true); - http.responseType = "json"; - if (loginObj) { - http.setRequestHeader("Content-Type", "application/json"); - } - console.log(JSON.stringify(loginObj)); - http.send(JSON.stringify(loginObj)); - http.onload = function() { - resolve(http); - if (http.readyState === XMLHttpRequest.DONE && http.status === 200) { - console.log(http.response.token); - } - }; - http.onerror = () => { - reject("Error!"); - }; - }); - promise - .then(temp => { - console.log(temp.response.token); - SaveToken(temp.response.token); - var payload = DecodeToken(temp.response.token); - if(payload.Role === 'Admin'){ - window.location.href = "admin.html"; - } - }) - .catch(err => { - console.log("error occurred"); - }); -} - -function SaveToken(token) { - console.log(token); - if (typeof Storage !== "undefined") { - localStorage.setItem("JWTtoken", token); - } else { - console.log("Sorry, your browser does not support web storage..."); - } -} - -function DecodeToken(token) { - var base64Url = token.split(".")[1]; - var base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/"); - var jsonPayload = decodeURIComponent( - atob(base64) - .split("") - .map(function(c) { - return "%" + ("00" + c.charCodeAt(0).toString(16)).slice(-2); - }) - .join("") - ); - console.log(jsonPayload); - var obj = JSON.parse(jsonPayload); - console.log(obj.Username); - return JSON.parse(jsonPayload); -} - -//event.preventDefault(); -// location.href="../html/admin.html"; - -//function SaveToken() - -/*var loginObj = { - Username: "", - Password: "" -}; - -var btn=document.getElementById("#btn"); -if(btn) -{ -btn.addEventListener("click", () => { - for (let key in loginObj) { - loginObj[key] = document.getElementById(key).value.trim(); - } - console.log(loginObj); - - requestToApi(); - - event.preventDefault(); -}); - -requestToApi = () => { - var { Username, Password } = loginObj; - - if (Username.trim().length >= 5 && Password.trim().length >= 6) { - const http = new XMLHttpRequest(); - const url = "https://localhost:44352/api/login"; - - http.open("POST", url); - http.setRequestHeader("Content-type", "application/json"); - - console.log(JSON.stringify(loginObj)); - - http.send(JSON.stringify(loginObj)); - - http.onreadystatechange = e => { - console.log(http); - - window.location.href = "admin.html"; - } - console.log(http.responseText); - - }; - -}; -} - -/*function Validate() - - { - - var UName=document.getElementById('uname').value; - - var Password=document.getElementById('pass').value; - - if((UName.value=='') || (Password.value=='')) - - { alert('UserName or Password should not be blank'); - return false; - } - else - { - $( document ).ready(function() { - $("#btn").click(function(){ - var objectdata = { - "uname": UName, - "pass": pass - } - var xhttp = new XMLHttpRequest(); - xhttp.onreadystatechange = function() { - if (this.readyState == 4 && this.status == 200) { - xhttp.open("POST", "https://localhost:44352/api/login/validate", true); - xhttp.send(objectdata); - } - }; - }); -}); -function login() -{ - var Username=document.getElementById("uname").value; - var Password=document.getElementById("pass").value; - var userdata={ - "Username":Username, - "Password":Password - }; - console.log(userdata); - var xhr = new XMLHttpRequest(); - var url="https://localhost:44352/api/login"; - xhr.open("POST", url,true); - xhr.responseType='json'; - xhr.setRequestHeader('Content-type', 'application/json'); - console.log(JSON.stringify(userdata)); - xhr.send(JSON.stringify(userdata)); - - - location.href="../html/admin.html"; - Log.then(temp => { - console.log(temp.response.token); -}) -.reject(err => { - console.log("wdknjcndcjk"); -}); -}*/ diff --git a/Abha_Rana/login_signup/scripts/script.js b/Abha_Rana/login_signup/scripts/script.js deleted file mode 100644 index 265c015..0000000 --- a/Abha_Rana/login_signup/scripts/script.js +++ /dev/null @@ -1,27 +0,0 @@ -document.getElementById("btn").addEventListener("click",Postdata); -function Postdata() -{ - var Username=document.getElementById("uname").value; - var Password=document.getElementById("pass").value; - var Name=document.getElementById("name").value; - var Email=document.getElementById("email").value; - var Phone=document.getElementById("num").value; - var Address=document.getElementById("add").value; - var userdata={ - "Username":Username, - "Password":Password, - "Name":Name, - "Email":Email, - "Phone":Phone, - "Address":Address - }; - console.log(userdata); - var xhr = new XMLHttpRequest(); - var url="https://localhost:44352/api/signup"; - xhr.open("POST", url,true); - xhr.responseType='json'; - xhr.setRequestHeader('Content-type', 'application/json'); - console.log(JSON.stringify(userdata)); - xhr.send(JSON.stringify(userdata)); - - } \ No newline at end of file diff --git a/Abha_Rana/login_signup/styles/adminstyle.css b/Abha_Rana/login_signup/styles/adminstyle.css deleted file mode 100644 index 9979295..0000000 --- a/Abha_Rana/login_signup/styles/adminstyle.css +++ /dev/null @@ -1,30 +0,0 @@ -body{ - background-image:url('../assets/images/adbg.jpg'); - background-repeat:no-repeat; - background-size: 100%; -} - -footer{ - -margin-top: 20px; -padding-top: 20px; -} -.bg__card__navbar{ -background-color: #000000; -} -.bg__card__footer{ -background-color: #000000 !important; -} -#add__new__list{ - margin-top: 4%; - top: -38px; - right: 0; -} -#update -{ - top: -38px; -} -#delete -{ - top: -38px; -} \ No newline at end of file diff --git a/Abha_Rana/login_signup/styles/profile.css b/Abha_Rana/login_signup/styles/profile.css deleted file mode 100644 index 3485485..0000000 --- a/Abha_Rana/login_signup/styles/profile.css +++ /dev/null @@ -1,30 +0,0 @@ -.user-row { - margin-bottom: 14px; -} - -.user-row:last-child { - margin-bottom: 0; -} - -.dropdown-user { - margin: 13px 0; - padding: 5px; - height: 100%; -} - -.dropdown-user:hover { - cursor: pointer; -} - -.table-user-information > tbody > tr { - border-top: 1px solid rgb(221, 221, 221); -} - -.table-user-information > tbody > tr:first-child { - border-top: 0; -} - - -.table-user-information > tbody > tr > td { - border-top: 0; -} diff --git a/Abha_Rana/login_signup/styles/s1.css b/Abha_Rana/login_signup/styles/s1.css deleted file mode 100644 index 405d24e..0000000 --- a/Abha_Rana/login_signup/styles/s1.css +++ /dev/null @@ -1,59 +0,0 @@ -@import url('https://fonts.googleapis.com/css?family=Numans'); - -html,body{ -background-image: url('../assets/images/bg.jpg'); -background-size: cover; -background-repeat: no-repeat; -height: 100%; -font-family: 'Numans', sans-serif; -} - -.container{ -height: 100%; -align-content: center; -} - -.card{ -height: 370px; -margin-top: auto; -margin-bottom: auto; -width: 400px; -background-color: rgba(0,0,0,0.5) !important; -} - -.card-header h3{ - color: white; - } - - .input-group-prepend span{ - width: 50px; - background-color: #FFC312; - color: black; - border:0 !important; - } - - input:focus{ - outline: 0 0 0 0 !important; - box-shadow: 0 0 0 0 !important; - - } - -.login_btn{ - color: black; - background-color: #FFC312; - width: 100px; - - } - - .login_btn:hover{ - color: black; - background-color: white; - } - - .links{ - color: white; - } - - .links a{ - margin-left: 4px; - } \ No newline at end of file diff --git a/Abha_Rana/login_signup/styles/style.css b/Abha_Rana/login_signup/styles/style.css deleted file mode 100644 index e1fb2d2..0000000 --- a/Abha_Rana/login_signup/styles/style.css +++ /dev/null @@ -1,4 +0,0 @@ -#success_message{ display: none;} -#btn{ - -} \ No newline at end of file diff --git a/Abha_Rana/login_signup/userjwt/userjwt.sln b/Abha_Rana/login_signup/userjwt/userjwt.sln deleted file mode 100644 index c7bad42..0000000 --- a/Abha_Rana/login_signup/userjwt/userjwt.sln +++ /dev/null @@ -1,25 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio 15 -VisualStudioVersion = 15.0.28307.902 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "userjwt", "userjwt\userjwt.csproj", "{CE6929CD-757C-4F43-91F3-54F53F176932}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {CE6929CD-757C-4F43-91F3-54F53F176932}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {CE6929CD-757C-4F43-91F3-54F53F176932}.Debug|Any CPU.Build.0 = Debug|Any CPU - {CE6929CD-757C-4F43-91F3-54F53F176932}.Release|Any CPU.ActiveCfg = Release|Any CPU - {CE6929CD-757C-4F43-91F3-54F53F176932}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {3EE242D1-9071-481F-9D24-F6B181EBEB1F} - EndGlobalSection -EndGlobal diff --git a/Abha_Rana/login_signup/userjwt/userjwt/Controllers/ValuesController.cs b/Abha_Rana/login_signup/userjwt/userjwt/Controllers/ValuesController.cs deleted file mode 100644 index 7262e4b..0000000 --- a/Abha_Rana/login_signup/userjwt/userjwt/Controllers/ValuesController.cs +++ /dev/null @@ -1,45 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Mvc; - -namespace userjwt.Controllers -{ - [Route("api/[controller]")] - [ApiController] - public class ValuesController : ControllerBase - { - // GET api/values - [HttpGet] - public ActionResult> Get() - { - return new string[] { "value1", "value2" }; - } - - // GET api/values/5 - [HttpGet("{id}")] - public ActionResult Get(int id) - { - return "value"; - } - - // POST api/values - [HttpPost] - public void Post([FromBody] string value) - { - } - - // PUT api/values/5 - [HttpPut("{id}")] - public void Put(int id, [FromBody] string value) - { - } - - // DELETE api/values/5 - [HttpDelete("{id}")] - public void Delete(int id) - { - } - } -} diff --git a/Abha_Rana/login_signup/userjwt/userjwt/Controllers/loginController.cs b/Abha_Rana/login_signup/userjwt/userjwt/Controllers/loginController.cs deleted file mode 100644 index cae29e8..0000000 --- a/Abha_Rana/login_signup/userjwt/userjwt/Controllers/loginController.cs +++ /dev/null @@ -1,83 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IdentityModel.Tokens.Jwt; -using System.Linq; -using System.Security.Claims; -using System.Text; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Authorization; -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.Configuration; -using Microsoft.IdentityModel.Tokens; -using userjwt.CustomModels; -using userjwt.DbModels; - -namespace userjwt.Controllers -{ - [Route("api/[controller]")] - [ApiController] - public class loginController : ControllerBase - { - DbModels.usersdbContext _usersdbContext; - - private IConfiguration _config; - - public loginController(IConfiguration config, DbModels.usersdbContext usersdbContext) - { - _config = config; - _usersdbContext = usersdbContext; - } - - [AllowAnonymous] - [HttpPost] - public IActionResult CreateToken([FromBody]CustomModels.loginReq login) - { - IActionResult response = Unauthorized(); - var user = Authenticate(login); - - if (user != null) - { - var tokenString = BuildToken(user); - response = Ok(new { token = tokenString }); - } - - return response; - } - - private string BuildToken(Users user) - { - var claims = new[] { - - // new Claim(JwtRegisteredClaimNames.Email, user.Email), - new Claim(JwtRegisteredClaimNames.Sub, user.Username), - // new Claim("Role", user.Role), - // new Claim("Address", user.Address), - // new Claim("Project", user.Project), - // new Claim("ProjectManager", user.ProjectManager), - new Claim(JwtRegisteredClaimNames.Jti, Guid.NewGuid().ToString()) - }; - - var key = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(_config["Jwt:Key"])); - var creds = new SigningCredentials(key, SecurityAlgorithms.HmacSha256); - - var token = new JwtSecurityToken(_config["Jwt:Issuer"], - _config["Jwt:Issuer"], - claims, - expires: DateTime.Now.AddMinutes(30), - signingCredentials: creds); - - return new JwtSecurityTokenHandler().WriteToken(token); - } - - private Users Authenticate(loginReq Details) - { - Users user = _usersdbContext.Users.Where(x => x.Username == Details.Username && x.Password == Details.Password).FirstOrDefault(); - if (user != null) - { - user = new Users { Username = user.Username, Email = user.Email, Role = user.Role }; - } - return user; - } - } -} diff --git a/Abha_Rana/login_signup/userjwt/userjwt/Controllers/signupController.cs b/Abha_Rana/login_signup/userjwt/userjwt/Controllers/signupController.cs deleted file mode 100644 index e5eeced..0000000 --- a/Abha_Rana/login_signup/userjwt/userjwt/Controllers/signupController.cs +++ /dev/null @@ -1,42 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore.Http; -using Microsoft.AspNetCore.Mvc; -using Microsoft.Extensions.Configuration; - -namespace userjwt.Controllers -{ - [Route("api/[controller]")] - [ApiController] - public class signupController : ControllerBase - { - DbModels.usersdbContext _usersdbContext; - - private IConfiguration _config; - - public signupController(IConfiguration config, DbModels.usersdbContext usersdbContext) - { - _config = config; - _usersdbContext = usersdbContext; - } - [HttpPost] - public IActionResult Createuser([FromBody]CustomModels.UserRequest userRequest) - { - DbModels.Users user = new DbModels.Users(); - user.Username = userRequest.Username; - user.Password = userRequest.Password; - user.Email = userRequest.Email; - user.Name = userRequest.Name; - // user.Project = userRequest.Project; - // user.ProjectManager = userRequest.ProjectManager; - user.Phone = userRequest.Phone; - user.Role = userRequest.Role; - user.Address = userRequest.Address; - _usersdbContext.Users.Add(user); - _usersdbContext.SaveChanges(); - return Ok("Record added"); - } - } -} \ No newline at end of file diff --git a/Abha_Rana/login_signup/userjwt/userjwt/CustomModels/UserRequest.cs b/Abha_Rana/login_signup/userjwt/userjwt/CustomModels/UserRequest.cs deleted file mode 100644 index eec1536..0000000 --- a/Abha_Rana/login_signup/userjwt/userjwt/CustomModels/UserRequest.cs +++ /dev/null @@ -1,20 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace userjwt.CustomModels -{ - public class UserRequest - { - public string Username { get; set; } - public string Password { get; set; } - public string Email { get; set; } - public string Name { get; set; } - // public string Project { get; set; } - // public string ProjectManager { get; set; } - public long? Phone { get; set; } - public string Role { get; set; } - public string Address { get; set; } - } -} diff --git a/Abha_Rana/login_signup/userjwt/userjwt/CustomModels/loginReq.cs b/Abha_Rana/login_signup/userjwt/userjwt/CustomModels/loginReq.cs deleted file mode 100644 index 5b9c71b..0000000 --- a/Abha_Rana/login_signup/userjwt/userjwt/CustomModels/loginReq.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Threading.Tasks; - -namespace userjwt.CustomModels -{ - public class loginReq - { - public string Username { get; set; } - public string Password { get; set; } - } -} diff --git a/Abha_Rana/login_signup/userjwt/userjwt/DbModels/Users.cs b/Abha_Rana/login_signup/userjwt/userjwt/DbModels/Users.cs deleted file mode 100644 index c0dff91..0000000 --- a/Abha_Rana/login_signup/userjwt/userjwt/DbModels/Users.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Collections.Generic; - -namespace userjwt.DbModels -{ - public partial class Users - { - public int Empid { get; set; } - public string Username { get; set; } - public string Password { get; set; } - public string Email { get; set; } - public string Name { get; set; } - public string Project { get; set; } - public string ProjectManager { get; set; } - public long? Phone { get; set; } - public string Role { get; set; } - public string Address { get; set; } - } -} diff --git a/Abha_Rana/login_signup/userjwt/userjwt/DbModels/usersdbContext.cs b/Abha_Rana/login_signup/userjwt/userjwt/DbModels/usersdbContext.cs deleted file mode 100644 index 126e8f0..0000000 --- a/Abha_Rana/login_signup/userjwt/userjwt/DbModels/usersdbContext.cs +++ /dev/null @@ -1,77 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata; - -namespace userjwt.DbModels -{ - public partial class usersdbContext : DbContext - { - public usersdbContext() - { - } - - public usersdbContext(DbContextOptions options) - : base(options) - { - } - - public virtual DbSet Users { get; set; } - - protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) - { - if (!optionsBuilder.IsConfigured) - { -#warning To protect potentially sensitive information in your connection string, you should move it out of source code. See http://go.microsoft.com/fwlink/?LinkId=723263 for guidance on storing connection strings. - optionsBuilder.UseSqlServer("Server=CYG292;Database=usersdb;Trusted_Connection=True;"); - } - } - - protected override void OnModelCreating(ModelBuilder modelBuilder) - { - modelBuilder.Entity(entity => - { - entity.HasKey(e => e.Email); - - entity.Property(e => e.Email) - .HasMaxLength(100) - .IsUnicode(false) - .ValueGeneratedNever(); - - entity.Property(e => e.Address) - .HasMaxLength(200) - .IsUnicode(false); - - entity.Property(e => e.Empid).ValueGeneratedOnAdd(); - - entity.Property(e => e.Name) - .IsRequired() - .HasMaxLength(50) - .IsUnicode(false); - - entity.Property(e => e.Password) - .IsRequired() - .HasMaxLength(100) - .IsUnicode(false); - - entity.Property(e => e.Project) - .HasMaxLength(50) - .IsUnicode(false); - - entity.Property(e => e.ProjectManager) - .HasMaxLength(50) - .IsUnicode(false); - - entity.Property(e => e.Role) - .IsRequired() - .HasMaxLength(50) - .IsUnicode(false) - .HasDefaultValueSql("('Employee')"); - - entity.Property(e => e.Username) - .IsRequired() - .HasMaxLength(200) - .IsUnicode(false); - }); - } - } -} diff --git a/Abha_Rana/login_signup/userjwt/userjwt/Program.cs b/Abha_Rana/login_signup/userjwt/userjwt/Program.cs deleted file mode 100644 index 3d2ff8b..0000000 --- a/Abha_Rana/login_signup/userjwt/userjwt/Program.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Threading.Tasks; -using Microsoft.AspNetCore; -using Microsoft.AspNetCore.Hosting; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.Logging; - -namespace userjwt -{ - public class Program - { - public static void Main(string[] args) - { - CreateWebHostBuilder(args).Build().Run(); - } - - public static IWebHostBuilder CreateWebHostBuilder(string[] args) => - WebHost.CreateDefaultBuilder(args) - .UseStartup(); - } -} diff --git a/Abha_Rana/login_signup/userjwt/userjwt/Properties/launchSettings.json b/Abha_Rana/login_signup/userjwt/userjwt/Properties/launchSettings.json deleted file mode 100644 index 67f59dd..0000000 --- a/Abha_Rana/login_signup/userjwt/userjwt/Properties/launchSettings.json +++ /dev/null @@ -1,30 +0,0 @@ -{ - "$schema": "http://json.schemastore.org/launchsettings.json", - "iisSettings": { - "windowsAuthentication": false, - "anonymousAuthentication": true, - "iisExpress": { - "applicationUrl": "http://localhost:62429", - "sslPort": 44352 - } - }, - "profiles": { - "IIS Express": { - "commandName": "IISExpress", - "launchBrowser": true, - "launchUrl": "api/values", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - }, - "userjwt": { - "commandName": "Project", - "launchBrowser": true, - "launchUrl": "api/values", - "applicationUrl": "https://localhost:5001;http://localhost:5000", - "environmentVariables": { - "ASPNETCORE_ENVIRONMENT": "Development" - } - } - } -} \ No newline at end of file diff --git a/Abha_Rana/login_signup/userjwt/userjwt/Startup.cs b/Abha_Rana/login_signup/userjwt/userjwt/Startup.cs deleted file mode 100644 index badb073..0000000 --- a/Abha_Rana/login_signup/userjwt/userjwt/Startup.cs +++ /dev/null @@ -1,65 +0,0 @@ -using System.Text; -using Microsoft.AspNetCore.Authentication.JwtBearer; -using Microsoft.AspNetCore.Builder; -using Microsoft.AspNetCore.Hosting; -using Microsoft.AspNetCore.Mvc; -using Microsoft.EntityFrameworkCore; -using Microsoft.Extensions.Configuration; -using Microsoft.Extensions.DependencyInjection; -using Microsoft.IdentityModel.Tokens; - -namespace userjwt -{ - public class Startup - { - public Startup(IConfiguration configuration) - { - Configuration = configuration; - } - - public IConfiguration Configuration { get; } - - // This method gets called by the runtime. Use this method to add services to the container. - public void ConfigureServices(IServiceCollection services) - { - services.AddDbContext(o => o.UseSqlServer("server=CYG292; database=usersdb;Trusted_Connection=True;")); - services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1); - services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme) - .AddJwtBearer(options => - { - options.TokenValidationParameters = new TokenValidationParameters - { - ValidateIssuer = true, - ValidateAudience = true, - ValidateLifetime = true, - ValidateIssuerSigningKey = true, - ValidIssuer = Configuration["Jwt:Issuer"], - ValidAudience = Configuration["Jwt:Issuer"], - IssuerSigningKey = new SymmetricSecurityKey(Encoding.UTF8.GetBytes(Configuration["Jwt:Key"])) - }; - }); - services.AddMvc(); - - } - - // This method gets called by the runtime. Use this method to configure the HTTP request pipeline. - public void Configure(IApplicationBuilder app, IHostingEnvironment env) - { - if (env.IsDevelopment()) - { - app.UseDeveloperExceptionPage(); - } - else - { - app.UseHsts(); - } - - app.UseHttpsRedirection(); - app.UseCors(builder => builder.AllowAnyHeader().AllowAnyMethod().AllowAnyOrigin()); - app.UseMvc(); - app.UseAuthentication(); - - } - } -} - diff --git a/Abha_Rana/login_signup/userjwt/userjwt/appsettings.Development.json b/Abha_Rana/login_signup/userjwt/userjwt/appsettings.Development.json deleted file mode 100644 index e203e94..0000000 --- a/Abha_Rana/login_signup/userjwt/userjwt/appsettings.Development.json +++ /dev/null @@ -1,9 +0,0 @@ -{ - "Logging": { - "LogLevel": { - "Default": "Debug", - "System": "Information", - "Microsoft": "Information" - } - } -} diff --git a/Abha_Rana/login_signup/userjwt/userjwt/appsettings.json b/Abha_Rana/login_signup/userjwt/userjwt/appsettings.json deleted file mode 100644 index ceea9a6..0000000 --- a/Abha_Rana/login_signup/userjwt/userjwt/appsettings.json +++ /dev/null @@ -1,14 +0,0 @@ -/*{ - "Logging": { - "LogLevel": { - "Default": "Warning" - } - }, - "AllowedHosts": "*" -}*/ -{ - "Jwt": { - "Key": "ThisismySecretKey", - "Issuer": "Test.com" - } -} diff --git a/Abha_Rana/login_signup/userjwt/userjwt/userjwt.csproj b/Abha_Rana/login_signup/userjwt/userjwt/userjwt.csproj deleted file mode 100644 index 9789ed6..0000000 --- a/Abha_Rana/login_signup/userjwt/userjwt/userjwt.csproj +++ /dev/null @@ -1,19 +0,0 @@ - - - - netcoreapp2.1 - - - - - - - - - - - - - - - diff --git a/Abha_Rana/nodejwt/script.js b/Abha_Rana/nodejwt/script.js index 5dd1339..8561196 100644 --- a/Abha_Rana/nodejwt/script.js +++ b/Abha_Rana/nodejwt/script.js @@ -31,8 +31,8 @@ function login() { promise .then(temp => { console.log(temp.response.token); - SaveToken(temp.response.token); - var payload = DecodeToken(temp.response.token); + saveToken(temp.response.token); + var payload = decodeToken(temp.response.token); if(payload.Role === 'Admin'){ window.location.href = "admin.html"; } @@ -42,7 +42,7 @@ function login() { }); } -function SaveToken(token) { +function saveToken(token) { console.log(token); if (typeof Storage !== "undefined") { localStorage.setItem("JWTtoken", token); @@ -51,7 +51,7 @@ function SaveToken(token) { } } -function DecodeToken(token) { +function decodeToken(token) { var base64Url = token.split(".")[1]; var base64 = base64Url.replace(/-/g, "+").replace(/_/g, "/"); var jsonPayload = decodeURIComponent( From 8c24139b7185754050d5fcc2e8c144377656b2f5 Mon Sep 17 00:00:00 2001 From: abharana24 Date: Tue, 11 Feb 2020 01:07:50 +0530 Subject: [PATCH 14/14] updated README file --- Abha_Rana/nodejwt/README.md | 8 -------- 1 file changed, 8 deletions(-) diff --git a/Abha_Rana/nodejwt/README.md b/Abha_Rana/nodejwt/README.md index 2dd9a65..a9be267 100644 --- a/Abha_Rana/nodejwt/README.md +++ b/Abha_Rana/nodejwt/README.md @@ -1,10 +1,5 @@ # nodejs-restful-api -![RESTful API design with Node.js](https://cdn-images-1.medium.com/max/2000/1*jjYC9tuf4C3HkHCP5PcKTA.jpeg "RESTful API design with Node.js") -How to create a RESTful CRUD API using Nodejs? - -This tutorial will demo how to set up a bare bones -API using mongodb as the database. It consist of a User model and controller. The model defines the data, and the controller will contain all @@ -16,6 +11,3 @@ for bootstrapping the application itself. The server file is used to spin up the server and tells the app to listen on a specific port. - -Full tutorial can be found at: -https://hackernoon.com/restful-api-design-with-node-js-26ccf66eab09#.s5l66zyeu