Front end integrated with the backend for loginpage and successfully redirects to homepage

This commit is contained in:
Aqeeb Imtiaz Harun
2018-05-21 17:10:42 +08:00
parent e6855eb844
commit d8a439fa42
2 changed files with 30 additions and 3 deletions
+27 -3
View File
@@ -6,10 +6,9 @@
<meta name="viewport" content="width=device-width, initial-scale=1">
<link href="https://fonts.googleapis.com/css?family=Nunito:300,400,600,700,900" rel="stylesheet">
<link rel="stylesheet" type="text/css" href="css/font-awesome.min.css">
<link rel="stylesheet" type="text/css" href="css/global.style.css">
<link rel="stylesheet" type="text/css" href="css/global.style.css">
</head>
<body>
<div class="wrapper">
<div class="wrapper-inline">
@@ -21,12 +20,13 @@
<main>
<section class="container">
<form>
@csrf
<div class="form-row-group with-icons">
<div class="form-row no-padding">
<div style="position:absolute; top: 10px;">
<a class="fa fa-user" style="color: black"></a>
</div>
<input id="mobile" type="text" class="form-element" placeholder="Mobile.No" required />
<input id="phone" type="text" class="form-element" placeholder="Mobile.No" required />
</div>
<div class="form-row no-padding">
<div style="position:absolute; top: 10px;">
@@ -45,6 +45,7 @@
<div class="form-divider"></div>
<div class="form-row">
<a href="#" id="login" class="button block green" type="submit">Sign In</a>
<a href="home.html" class="button block green" id="signin">Sign In</a>
</div>
@@ -59,5 +60,28 @@
</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
$('#login').click(function() {
$.ajax({
type: "POST",
url: "api/login",
data: {
phone: $('#phone').val(),
password: $('#password').val()
},
success: function(data) {
localStorage.token = data.data.token;
document.location.href="home.html";
alert('Got a token from the server! Token: ' + data.data.token);
},
error: function() {
alert("Login Failed");}
});
})
})
</script>
</body>
</html>
+3
View File
@@ -15,5 +15,8 @@ Route::get('/', function () {
return view('welcome');
});
//Route::post('login', 'AuthController@login');
Route::get('password/reset/{token}', 'Auth\ResetPasswordController@showResetForm')->name('password.request');
Route::post('password/reset', 'Auth\ResetPasswordController@postReset')->name('password.reset');