mirror of
https://github.com/arnaucube/commonroutesWebApp.git
synced 2026-02-07 11:26:43 +01:00
starting, login and signup runs ok, implementing main dashboard layout
This commit is contained in:
41
views/signup/signup.html
Executable file
41
views/signup/signup.html
Executable file
@@ -0,0 +1,41 @@
|
||||
<div class="container">
|
||||
<div class="row">
|
||||
<div class="col-sm-4">
|
||||
|
||||
</div>
|
||||
<div class="col-sm-4">
|
||||
<div class="panel">
|
||||
<div class="panel-heading c_deepPurpleG500to300">
|
||||
<h3 class="panel-title">Signup</h3>
|
||||
</div>
|
||||
<div class="panel-body">
|
||||
<div class="form-group label-floating">
|
||||
<input ng-model="user.username" abmFormControl class="form-control" id="inputUsername" placeholder="Username" type="text">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<input ng-model="user.password" abmFormControl class="form-control" id="inputPassword" placeholder="Password" type="password">
|
||||
</div>
|
||||
<div class="form-group label-floating">
|
||||
<input ng-model="user.email" abmFormControl class="form-control" id="inputEmail" placeholder="Email" type="text">
|
||||
</div>
|
||||
<div class="form-group label-floating">
|
||||
<input ng-model="user.phone" abmFormControl class="form-control" id="inputPhone" placeholder="Phone" type="text">
|
||||
</div>
|
||||
<div class="form-group row">
|
||||
<label for="staticEmail" class="col-sm-1 col-form-label">@</label>
|
||||
<div class="col-sm-10">
|
||||
<input ng-model="user.telegram" abmFormControl class="form-control" id="inputTelegram" placeholder="Telegram" type="text">
|
||||
</div>
|
||||
</div>
|
||||
<a ng-href="#!/login" class="btn btn-raised c_grey500">Back</a>
|
||||
<div ng-click="doLogin()" class="btn btn-raised c_deepPurple300 pull-right">Login</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="col-sm-4">
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
43
views/signup/signup.js
Executable file
43
views/signup/signup.js
Executable file
@@ -0,0 +1,43 @@
|
||||
'use strict';
|
||||
|
||||
angular.module('app.signup', ['ngRoute'])
|
||||
|
||||
.config(['$routeProvider', function($routeProvider) {
|
||||
$routeProvider.when('/signup', {
|
||||
templateUrl: 'views/signup/signup.html',
|
||||
controller: 'SignupCtrl'
|
||||
});
|
||||
}])
|
||||
|
||||
.controller('SignupCtrl', function($scope, $http, $routeParams) {
|
||||
$scope.user = {};
|
||||
$scope.doLogin = function() {
|
||||
console.log('Doing login', $scope.user);
|
||||
|
||||
$http({
|
||||
url: urlapi + 'signup',
|
||||
method: "POST",
|
||||
data: $scope.user
|
||||
})
|
||||
.then(function(response) {
|
||||
console.log("response: ");
|
||||
console.log(response.data);
|
||||
if (response.data.success == true)
|
||||
{
|
||||
localStorage.setItem("cr_webapp_token", response.data.token);
|
||||
localStorage.setItem("cr_webapp_userdata", JSON.stringify(response.data.user));
|
||||
window.location.reload();
|
||||
}else{
|
||||
console.log("signup failed");
|
||||
toastr.error('Signup failed');
|
||||
}
|
||||
|
||||
|
||||
},
|
||||
function(response) { // optional
|
||||
// failed
|
||||
console.log(response);
|
||||
});
|
||||
|
||||
};
|
||||
});
|
||||
Reference in New Issue
Block a user