I have a mobile application:
Front end - Ionic framework
Back-end - Sails.js API
I need help to setup the Ionic application, and create a registration and login flow for:
Username / Password registration & login
Setup the Sails.js backend with the User controller
Tie them together so that users can create accounts and login.
Could anyone point me in the right direction. Any help is highly appreciated. Thanks
This is my sign-in template
<script id="templates/sign-in.html" type="text/ng-template">
< ion - view > < div class = "bar bar-header bar-positive" > < h1 class = "title" > Sign - In < /h1>
</div > < ion - content style = "margin-top:40px !important" > < div class = "list list-inset" > < label id = "acc"
class = "item item-input" > < input type = "text"
ng - model = "user.account"
placeholder = "Account" > < /label>
<label id="user" class="item item-input">
<input type="text" ng-model="user.user" placeholder="Username">
</label >
< label id = "pass"
class = "item item-input" > < input type = "password"
ng - model = "user.password"
placeholder = "Password" > < /label>
</div > < div class = "padding" > < button class = "button button-block button-positive"
ng - click = "signIn(user)" >
Sign - In < /button>
</div > < div id = "error"
style = "color:#a94442;"
class = "item item-divider" >
< /div>
</ion - content > < /ion-view>
</script>
On ng-click call i have the following function to call
$scope.signIn = function signIn(user) {
if (user) {
var ath = user.account + ',' + user.user + ',' + user.password;
var url = "http://youradress.com/you";
var config = {
headers: {
'Credentials': ath
}
};
$http.get(url, config).success(function (data, status, headers, config) {
if (data.indexOf("Permission") > -1) {
$state.go('devices-list')
} else {
error = document.getElementById("error");
error.innerHTML = "Unable to logged in! Check Credentials";
}
}).error(function (data, status, headers, config) {
error = document.getElementById("error");
error.innerHTML = "Unable to logged in! Check Internet"
});
}
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.