Commit 39ad0a8a authored by Evren Kutar's avatar Evren Kutar

check email validity function (not used yet)

parent befff664
......@@ -4,14 +4,14 @@
"use strict";
// TODO: login url cheange with correct one
// TODO: login url change with correct one
login.factory('LoginService', function ($http, Session) {
var loginService = {};
loginService.login = function (credentials) {
return $http
.get('http://127.0.0.1:8000/login', credentials)
.post('http://127.0.0.1:8000/login', credentials)
.then(function (res) {
Session.create(res.data.id, res.data.user.id,
res.data.user.role);
......@@ -31,6 +31,11 @@ login.factory('LoginService', function ($http, Session) {
loginService.indexOf(Session.userRole) !== -1);
};
loginService.isValidEmail = function(email){
var re = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
return re.test(email);
};
return loginService;
});
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment