-
Website with new functionality - Waiting for your vision!
Hello,
i belive you guys have nice ideas for website functionality.
I am here, waiting for your purposes - If I add something from your list gonna post progress below.
I am able to add almost everything you wish.
Just give a shoot, who knows maybe when i finish i'll release it here ^^
Functions which will be implemented today:
- News system
- Register
- Login
- Server time status
- TOP 3 Honor players
- Channel status + show ~how many players are online.
- Ranking system
- Saint holder
Everything wrote on smooth code (MVC PHP + Rain TPL)
http://my.jetscreenshot.com/27710/20...-jwau-54kb.jpg
http://my.jetscreenshot.com/27710/20...-b5s1-23kb.jpg
-
Re: Website with new functionality - Waiting for your vision!
Quote:
Just give a shoot, who knows maybe when i finish i'll release it here ^^
why people should share their unique ideas for ur webpage if you are not sure you will share it or not :))
-
Re: Website with new functionality - Waiting for your vision!
Why not use an API written in go,php or anything else and use angular js for interface with the API behind? Its way faster :).
-
Re: Website with new functionality - Waiting for your vision!
if you can add web shop or tpoint and vote for points it will be good
-
Re: Website with new functionality - Waiting for your vision!
Some must have functions idea:
Registration:
->Captcha's, Email Verification (EP8 Client have implemented AuthType for email confirmation checking... (AuthType=3 if i good remember))
->Multiple IP warn system for admins
Login:
->Login / Password Reset / Sub Password Reset
Admin Panel:
->News Manager
->GM Manager
->Online Player management
->Server Log viewer (may you can do a good filterable function with regexp's...)
For players
->Stat adder, Nation changer, EQ viewer, Vote system, Forum <-> Ingame Account merger
->News, NationWar, FC, Valkalitan Timer, Current Proc - Cap rates, Current Running Events
->Community Functions like facebook share, twitter post etc.
I will think about it and edit it if i get any more idea but this is a most important, at least for me.
-
Re: Website with new functionality - Waiting for your vision!
Sounds good to my, I'm a total pleb when it comes to that stuff tbh. :D
I really like what DextR suggested in the post above,
and I'm wishing you good luck implementing that & to finish the site the way you want it to.
Can't wait to see the final outcome! :)
€dit: Of course I'll drop some ideas if I get some that DextR did not post already.
-
Re: Website with new functionality - Waiting for your vision!
Quote:
Originally Posted by
allocen
Why not use an API written in go,php or anything else and use angular js for interface with the API behind? Its way faster :).
Or just angular altogether :)
@Dens666: Drop PHP already. If you are doing this for fun then do it in a cooler language and learn something from it. PHP? not cool.
-
Re: Website with new functionality - Waiting for your vision!
Quote:
Originally Posted by
emi
Or just angular altogether :)
@
Dens666: Drop PHP already. If you are doing this for fun then do it in a cooler language and learn something from it. PHP? not cool.
Off: I'm already doing that, building angularjs website for cabal with an api written in phalcon due its amazing speed. So far so good. I might get to an alpha stage pretty soon. I'm in luv' with the angular xD
-
Re: Website with new functionality - Waiting for your vision!
I have no idea what you have to PHP :O
It's very simple, fast and flexible language.
I can write what I want on it.
I'm not sure if worth for me to learn angular since I don't know JS.
Give me tip :)
-
Re: Website with new functionality - Waiting for your vision!
Phalcon its a PHP framework and if you search after benchmarks between frameworks you'll see that phalcon always comes to 1st place because of its amazing speed and because its written in C#, so that this framework always stays in the Ram. Either way, learning angularjs is not that complicated as you may think but once you do, you will never want to come back writting websites in PHP, maybe API, like i do. The purpose and benefit of writting an angularjs website for cabal is that it will load way faster also you can do a lot of stuff like getting real-time data or log in with no refresh and many other. For example, on my website that i am building, i wrote some directives that checks connection of the internet like when you remain with no internet a popup will appear with some specific message and it will not go away until you have internet or idle, like when you are logged in and you are not doing anything on website or not moving the cursor at all, after an x time a popup will appear with some message, after x count of idle you are getting logged out. Also i can show real-time players that are online, rates and many other data like this. Building a cabal website based on angularjs not only that will be fun but you'll really enjoy knowing that you can manipulate everything just the way you want.
And as i said above with my web being close to an alpha stage, i might make a thread about it soon.
Also my API contain most of decodes of binaries from cabal database :).
For authentication, i use basic auth, that generates me a token and after i'm saving it to local storage and with that token i can auth to which request i want to do to the API. Of course that token contains also an expire time.
And PHP ain't fast enough as other frameworks, like for instance, GOLANG, this framework is 10000x times way faster than PHP and can parse large amount of data in milliseconds, ain't kidding.
Plus, separating the website between a FRONTEND and API, is good for security purposes :).
-
Re: Website with new functionality - Waiting for your vision!
Can you share some example code? No matter what function. I'm going to read now about angular we will see.
-
Re: Website with new functionality - Waiting for your vision!
Thats the authentication service:
Code:
(function() {
'use strict';
angular
.module('hekate.auth.service', [
'restangular',
'LocalStorageModule',
'base64'
])
.service('HekateAuth', HekateAuthService);
HekateAuthService.$inject = [
'$rootScope', '$q', '$base64', 'Restangular', 'localStorageService', 'AUTH_EVENTS'
];
function HekateAuthService($rootScope, $q, $base64, Restangular, localStorageService, AUTH_EVENTS) {
return {
login: login,
isAuthenticated: isAuthenticated,
logout: logout
};
function login(params) {
return $q(function(resolve, reject) {
if(angular.isObject(params) && angular.isDefined(params.username) && angular.isDefined(params.password)) {
Restangular
.one('accounts')
.one('authenticate')
.post(null, {}, {}, {Authorization: 'Basic ' + $base64.encode(params.username + ':' + params.password)})
.then(function(response) {
localStorageService.set('user', {token: response.token, expires: response.expires});
if(localStorageService.get('idle')) {
localStorageService.set('idle', 0);
}
$rootScope.$broadcast(AUTH_EVENTS.loginSuccess);
resolve('You successfully logged in.');
}, function(error) {
reject(error);
});
} else {
reject('Username and/or password fields is empty.');
}
});
}
function isAuthenticated() {
var user = localStorageService.get('user');
return $q(function(resolve, reject) {
if (user && user.expires > Math.floor(Date.now() / 1000)) {
resolve('You are authenticated.');
} else {
reject('You are not authenticated.');
}
});
}
function logout() {
localStorageService.remove('user');
$rootScope.$broadcast(AUTH_EVENTS.logoutSuccess);
return $q.resolve('You successfully logged out.');
}
}
})();
-
Re: Website with new functionality - Waiting for your vision!
Oh Jesus, its looks horrible for me :D
Can you show me one more example? If you want you can send me it on private. I just want to try love this language but all examples looks so strange and hard xd
-
Re: Website with new functionality - Waiting for your vision!
Thats not horrible. If you write you the code in angularjs as they say on their docs, when you'll want to minify the code you'll get all sort of errors. What you saw right there, $inject, its structure, is best practices in angular.
Also, before you start learning angularjs, you must know some vanilla javascript too :).
-
Re: Website with new functionality - Waiting for your vision!
Phalcon is a very promising project. Easy, simple, and very flexible.. AngularJS is very good too. If you are really want to learn a web development than try to understand them and you will get a right way to use harder frameworks like Zend engine... If you can learn them well than you can get a very good job with it. I'm currently working and dont have time for learning...PHP 7 is now get closer to a higher programming languages. Example for me was hard to relearn an sql query with pdo and sadly adodb dont working on php7 yet...
-
Re: Website with new functionality - Waiting for your vision!
Quote:
Originally Posted by
allocen
Phalcon its a PHP framework and if you search after benchmarks between frameworks you'll see that phalcon always comes to 1st place because of its amazing speed and because its written in C#, so that this framework always stays in the Ram. Either way, learning angularjs is not that complicated as you may think but once you do, you will never want to come back writting websites in PHP, maybe API, like i do. The purpose and benefit of writting an angularjs website for cabal is that it will load way faster also you can do a lot of stuff like getting real-time data or log in with no refresh and many other. For example, on my website that i am building, i wrote some directives that checks connection of the internet like when you remain with no internet a popup will appear with some specific message and it will not go away until you have internet or idle, like when you are logged in and you are not doing anything on website or not moving the cursor at all, after an x time a popup will appear with some message, after x count of idle you are getting logged out. Also i can show real-time players that are online, rates and many other data like this. Building a cabal website based on angularjs not only that will be fun but you'll really enjoy knowing that you can manipulate everything just the way you want.
And as i said above with my web being close to an alpha stage, i might make a thread about it soon.
Also my API contain most of decodes of binaries from cabal database :).
For authentication, i use basic auth, that generates me a token and after i'm saving it to local storage and with that token i can auth to which request i want to do to the API. Of course that token contains also an expire time.
And PHP ain't fast enough as other frameworks, like for instance, GOLANG, this framework is 10000x times way faster than PHP and can parse large amount of data in milliseconds, ain't kidding.
Plus, separating the website between a FRONTEND and API, is good for security purposes :).
You mean separation between frontend and backend. For cabal I think a node.js backend would make much sense since it has lot of intensive I/O operations, mainly reading/writing to database.
Another point is...speed. While nodejs would be extremely fast, probably faster than any PHP framework, that's not all. The code should be easy to maintain, develop, test, manages the complexity well and the list goes on and on. Again node.js is a good candidate. Maybe this PHP framework also, I don't know.
Bottom line is that you need to know what to use for the task you have at hand.
Btw, what? No auth0?
Quote:
Originally Posted by
Dens666
Oh Jesus, its looks horrible for me :D
Can you show me one more example? If you want you can send me it on private. I just want to try love this language but all examples looks so strange and hard xd
Angular is not hard when you know javascript and had touched node.js and the likes, otherwise it can get hairy and it's rather easy to fall to the path of no return. Also there are a couple of angular specific concepts and problems, most notoriously being that the code runs in the browser so you don't ever want to store anything sensitive there and is highly recommended that it runs over https.
Quote:
Originally Posted by
DeXtR
Phalcon is a very promising project. Easy, simple, and very flexible.. AngularJS is very good too. If you are really want to learn a web development than try to understand them and you will get a right way to use harder frameworks like Zend engine... If you can learn them well than you can get a very good job with it. I'm currently working and dont have time for learning...PHP 7 is now get closer to a higher programming languages. Example for me was hard to relearn an sql query with pdo and sadly adodb dont working on php7 yet...
PHP is a no go.
More angular code (authentication -> auth0):
Code:
angular.module('authenticationModule')
.factory('authenticationService', [
'$q', '$location', '$cookies', 'auth', 'store', 'jwtHelper', 'environmentService',
function($q, $location, $cookies, auth, store, jwtHelper, environmentService) {
var authChangedCallbacks = [];
return {
logOut: logOut,
logIn: logIn,
authenticateAndRedirect: authenticateAndRedirect,
getIsLoggedIn: getIsLoggedIn,
addAuthChangeCallback: addAuthChangeCallback,
processLogin: processLogin,
processLoginFailure: processLoginFailure,
getClientId: getClientId,
};
function getIsLoggedIn() {
var token = store.get('smc_auth_token');
var profile = store.get('smc_auth_profile');
if (token && !jwtHelper.isTokenExpired(token)) {
if (!auth.isAuthenticated) {
return auth.authenticate(profile, token)
.then(function(result) {
return result;
});
}
return $q.when({
profile: profile,
token: token,
});
}
return $q.when(false);
}
function logIn() {
auth.signin(
{
disableSignupAction: true,
}
);
}
function authenticateAndRedirect(redirectPath) {
var deferred = $q.defer();
return getIsLoggedIn()
.then(function(authData) {
if (authData) {
deferred.resolve(authData);
} else {
$cookies.put('returnTo', redirectPath);
logIn();
}
})
.then(function() {
return deferred.promise ? $q.when(deferred.promise) : $q.reject({authenticated: false});
});
}
function processLogin(profile, idToken) {
store.set('smc_auth_profile', profile);
store.set('smc_auth_token', idToken);
var redirect = $cookies.get('returnTo') || '/';
$location.url(redirect);
$cookies.remove('returnTo');
notifyAll({
profile: profile,
token: idToken,
});
}
function processLoginFailure() {
$location.path('/error');
}
function logOut() {
auth.signout();
store.remove('smc_auth_profile');
store.remove('smc_auth_token');
$location.path('/');
notifyAll();
}
function addAuthChangeCallback(callback) {
authChangedCallbacks.push(callback);
}
function getClientId() {
if (environmentService.getEnvironment() === 'PRD') {
return '0lqvllBTphFILz1Awjlxo5stP8C6pMLn';
}
return 'fuMX6JViIhikzymPiXEjsHh8dhplEirc';
}
function notifyAll(authData) {
authChangedCallbacks.forEach(function(cb) {
cb(authData);
});
}
},
]);
Code:
angular.module('authenticationModule', ['ngCookies', 'environmentModule']);
Testing is easy. Below are the unit tests for the service above. Integration and acceptance are also easy. you can mime humans clicking on buttons etc.
Code:
describe('Authentication service', function() {
var authenticationService;
var $q;
var auth;
var store;
var location;
var jwtHelper;
var cookies;
beforeEach(module('authenticationModule'));
beforeEach(module(function($provide) {
auth = {
isAuthenticated: '',
authenticate: jasmine.createSpy(),
signin: jasmine.createSpy(),
signout: jasmine.createSpy(),
};
$provide.value('auth', auth);
store = {
get: jasmine.createSpy(),
set: jasmine.createSpy(),
remove: jasmine.createSpy(),
};
$provide.value('store', store);
location = {
path: jasmine.createSpy(),
url: jasmine.createSpy(),
};
$provide.value('$location', location);
jwtHelper = {
isTokenExpired: jasmine.createSpy(),
};
$provide.value('jwtHelper', jwtHelper);
cookies = {
get: jasmine.createSpy(),
set: jasmine.createSpy(),
remove: jasmine.createSpy(),
};
$provide.value('$cookies', cookies);
environmentService = {
getEnvironment: jasmine.createSpy(),
};
$provide.value('environmentService', environmentService);
}));
beforeEach(inject(function(_authenticationService_, _$q_) {
authenticationService = _authenticationService_;
$q = _$q_;
}));
it('should determine that the user is unauthenticated if no token is present', function() {
store.get.and.callFake(
function() {
return null;
});
authenticationService.getIsLoggedIn().then(function(result) {
expect(result).toBeFalsey;
expect(store.get).toHaveBeenCalledWith('smc_auth_token');
});
});
it('should determine that the user is unauthenticated if the token is expired', function() {
store.get.and.callFake(
function() {
return 'myToken';
});
jwtHelper.isTokenExpired.and.callFake(
function() {
return true;
});
authenticationService.getIsLoggedIn().then(function(result) {
expect(result).toBeFalsey;
expect(jwtHelper.isTokenExpired).toHaveBeenCalledWith('myToken');
});
});
it('should determine that the user is authenticated if request is authenticated', function() {
store.get.and.callFake(
function() {
return 'myToken';
});
jwtHelper.isTokenExpired.and.callFake(
function() {
return false;
});
auth.isAuthenticated = true;
authenticationService.getIsLoggedIn().then(function(result) {
expect(result).toBeTruthy;
});
});
it('should determine that the user is authenticated if token auth succeeds', function() {
store.get.and.callFake(
function() {
return 'myToken';
});
jwtHelper.isTokenExpired.and.callFake(
function() {
return false;
});
auth.isAuthenticated = false;
auth.authenticate.and.callFake(function() {return $q.when(true);});
authenticationService.getIsLoggedIn().then(function(result) {
expect(result).toBeTruthy;
expect(auth.authenticate).toHaveBeenCalledWith('myToken', 'myToken');
});
});
it('should return the authentication information if the user is logged in', function() {
store.get.and.callFake(
function(key) {
return key + '_value';
});
jwtHelper.isTokenExpired.and.callFake(
function() {
return false;
});
auth.isAuthenticated = true;
authenticationService.getIsLoggedIn().then(function(result) {
expect(result).toBeTruthy;
expect(result.profile).toEqual('profile_value');
expect(result.token).toEqual('token_value');
});
});
it('should determine that the user is unauthenticated if token authentication fails', function() {
store.get.and.callFake(
function() {
return 'myToken';
});
jwtHelper.isTokenExpired.and.callFake(
function() {
return false;
});
auth.isAuthenticated = false;
auth.authenticate.and.callFake(function() {return $q.when(false);});
authenticationService.getIsLoggedIn().then(function(result) {
expect(result).toBeFalsey;
expect(auth.authenticate).toHaveBeenCalledWith('myToken', 'myToken');
});
});
it('should sign out and clear the tokens when logging out', function() {
authenticationService.logOut();
expect(auth.signout).toHaveBeenCalled();
expect(store.remove).toHaveBeenCalledWith('smc_auth_token');
expect(store.remove).toHaveBeenCalledWith('smc_auth_profile');
});
it('should redirect to the home page when logging out', function() {
authenticationService.logOut();
expect(location.path).toHaveBeenCalledWith('/');
});
it('should call any callbacks when logging out', function() {
var foo = 0;
authenticationService.addAuthChangeCallback(function() {
foo = 1;
});
authenticationService.logOut();
expect(foo).toEqual(1);
});
it('should continue instead of re-logging in if the user is already authenticated', function() {
store.get.and.callFake(
function() {
return 'myToken';
});
jwtHelper.isTokenExpired.and.callFake(
function() {
return false;
});
auth.isAuthenticated = true;
authenticationService.authenticateAndRedirect().then(function(status) {
expect(status).toBeTruthy();
});
});
it('should stop and redirect to the login page if the user is not authenticated', function() {
store.get.and.callFake(
function() {
return null;
});
authenticationService.authenticateAndRedirect().then(function(status) {
expect(status).toBeUndefined();
expect(auth.signin).toHaveBeenCalled();
});
});
it('should call the authentication provider when logging in', function() {
authenticationService.logIn();
expect(auth.signin).toHaveBeenCalledWith({disableSignupAction: true,});
});
it('should redirect to an error page if login fails', function() {
authenticationService.processLoginFailure();
expect(location.path).toHaveBeenCalledWith('/error');
});
it('should save the auth tokens when login is successful', function() {
authenticationService.processLogin('profile1', 'token2');
expect(store.set).toHaveBeenCalledWith('smc_auth_profile', 'profile1');
expect(store.set).toHaveBeenCalledWith('smc_auth_token', 'token2');
});
it('should redirect, if specified, and then clear the cookie', function() {
cookies.get.and.callFake(function() {
return '/foo';
});
authenticationService.processLogin();
expect(location.url).toHaveBeenCalledWith('/foo');
expect(cookies.remove).toHaveBeenCalledWith('returnTo');
});
it('should use the prod authentication app in production', function() {
environmentService.getEnvironment.and.callFake(function() {
return 'PRD';
});
expect(authenticationService.getClientId()).toEqual('0lqvllBTphFILz1Awjlxo5stP8C6pMLn');
});
it('should use the non-prod authentication app outside production', function() {
environmentService.getEnvironment.and.callFake(function() {
return 'TST';
});
expect(authenticationService.getClientId()).toEqual('fuMX6JViIhikzymPiXEjsHh8dhplEirc');
});
});
-
Re: Website with new functionality - Waiting for your vision!
Quote:
Originally Posted by
emi
You mean separation between frontend and backend. For cabal I think a node.js backend would make much sense since it has lot of intensive I/O operations, mainly reading/writing to database.
Another point is...speed. While nodejs would be extremely fast, probably faster than any PHP framework, that's not all. The code should be easy to maintain, develop, test, manages the complexity well and the list goes on and on. Again node.js is a good candidate. Maybe this PHP framework also, I don't know.
Bottom line is that you need to know what to use for the task you have at hand.
Btw, what? No auth0?
Angular is not hard when you know javascript and had touched node.js and the likes, otherwise it can get hairy and it's rather easy to fall to the path of no return. Also there are a couple of angular specific concepts and problems, most notoriously being that the code runs in the browser so you don't ever want to store anything sensitive there and is highly recommended that it runs over https.
PHP is a no go.
More angular code (authentication -> auth0):
Code:
angular.module('authenticationModule')
.factory('authenticationService', [
'$q', '$location', '$cookies', 'auth', 'store', 'jwtHelper', 'environmentService',
function($q, $location, $cookies, auth, store, jwtHelper, environmentService) {
var authChangedCallbacks = [];
return {
logOut: logOut,
logIn: logIn,
authenticateAndRedirect: authenticateAndRedirect,
getIsLoggedIn: getIsLoggedIn,
addAuthChangeCallback: addAuthChangeCallback,
processLogin: processLogin,
processLoginFailure: processLoginFailure,
getClientId: getClientId,
};
function getIsLoggedIn() {
var token = store.get('smc_auth_token');
var profile = store.get('smc_auth_profile');
if (token && !jwtHelper.isTokenExpired(token)) {
if (!auth.isAuthenticated) {
return auth.authenticate(profile, token)
.then(function(result) {
return result;
});
}
return $q.when({
profile: profile,
token: token,
});
}
return $q.when(false);
}
function logIn() {
auth.signin(
{
disableSignupAction: true,
}
);
}
function authenticateAndRedirect(redirectPath) {
var deferred = $q.defer();
return getIsLoggedIn()
.then(function(authData) {
if (authData) {
deferred.resolve(authData);
} else {
$cookies.put('returnTo', redirectPath);
logIn();
}
})
.then(function() {
return deferred.promise ? $q.when(deferred.promise) : $q.reject({authenticated: false});
});
}
function processLogin(profile, idToken) {
store.set('smc_auth_profile', profile);
store.set('smc_auth_token', idToken);
var redirect = $cookies.get('returnTo') || '/';
$location.url(redirect);
$cookies.remove('returnTo');
notifyAll({
profile: profile,
token: idToken,
});
}
function processLoginFailure() {
$location.path('/error');
}
function logOut() {
auth.signout();
store.remove('smc_auth_profile');
store.remove('smc_auth_token');
$location.path('/');
notifyAll();
}
function addAuthChangeCallback(callback) {
authChangedCallbacks.push(callback);
}
function getClientId() {
if (environmentService.getEnvironment() === 'PRD') {
return '0lqvllBTphFILz1Awjlxo5stP8C6pMLn';
}
return 'fuMX6JViIhikzymPiXEjsHh8dhplEirc';
}
function notifyAll(authData) {
authChangedCallbacks.forEach(function(cb) {
cb(authData);
});
}
},
]);
Code:
angular.module('authenticationModule', ['ngCookies', 'environmentModule']);
Testing is easy. Below are the unit tests for the service above. Integration and acceptance are also easy. you can mime humans clicking on buttons etc.
Code:
describe('Authentication service', function() {
var authenticationService;
var $q;
var auth;
var store;
var location;
var jwtHelper;
var cookies;
beforeEach(module('authenticationModule'));
beforeEach(module(function($provide) {
auth = {
isAuthenticated: '',
authenticate: jasmine.createSpy(),
signin: jasmine.createSpy(),
signout: jasmine.createSpy(),
};
$provide.value('auth', auth);
store = {
get: jasmine.createSpy(),
set: jasmine.createSpy(),
remove: jasmine.createSpy(),
};
$provide.value('store', store);
location = {
path: jasmine.createSpy(),
url: jasmine.createSpy(),
};
$provide.value('$location', location);
jwtHelper = {
isTokenExpired: jasmine.createSpy(),
};
$provide.value('jwtHelper', jwtHelper);
cookies = {
get: jasmine.createSpy(),
set: jasmine.createSpy(),
remove: jasmine.createSpy(),
};
$provide.value('$cookies', cookies);
environmentService = {
getEnvironment: jasmine.createSpy(),
};
$provide.value('environmentService', environmentService);
}));
beforeEach(inject(function(_authenticationService_, _$q_) {
authenticationService = _authenticationService_;
$q = _$q_;
}));
it('should determine that the user is unauthenticated if no token is present', function() {
store.get.and.callFake(
function() {
return null;
});
authenticationService.getIsLoggedIn().then(function(result) {
expect(result).toBeFalsey;
expect(store.get).toHaveBeenCalledWith('smc_auth_token');
});
});
it('should determine that the user is unauthenticated if the token is expired', function() {
store.get.and.callFake(
function() {
return 'myToken';
});
jwtHelper.isTokenExpired.and.callFake(
function() {
return true;
});
authenticationService.getIsLoggedIn().then(function(result) {
expect(result).toBeFalsey;
expect(jwtHelper.isTokenExpired).toHaveBeenCalledWith('myToken');
});
});
it('should determine that the user is authenticated if request is authenticated', function() {
store.get.and.callFake(
function() {
return 'myToken';
});
jwtHelper.isTokenExpired.and.callFake(
function() {
return false;
});
auth.isAuthenticated = true;
authenticationService.getIsLoggedIn().then(function(result) {
expect(result).toBeTruthy;
});
});
it('should determine that the user is authenticated if token auth succeeds', function() {
store.get.and.callFake(
function() {
return 'myToken';
});
jwtHelper.isTokenExpired.and.callFake(
function() {
return false;
});
auth.isAuthenticated = false;
auth.authenticate.and.callFake(function() {return $q.when(true);});
authenticationService.getIsLoggedIn().then(function(result) {
expect(result).toBeTruthy;
expect(auth.authenticate).toHaveBeenCalledWith('myToken', 'myToken');
});
});
it('should return the authentication information if the user is logged in', function() {
store.get.and.callFake(
function(key) {
return key + '_value';
});
jwtHelper.isTokenExpired.and.callFake(
function() {
return false;
});
auth.isAuthenticated = true;
authenticationService.getIsLoggedIn().then(function(result) {
expect(result).toBeTruthy;
expect(result.profile).toEqual('profile_value');
expect(result.token).toEqual('token_value');
});
});
it('should determine that the user is unauthenticated if token authentication fails', function() {
store.get.and.callFake(
function() {
return 'myToken';
});
jwtHelper.isTokenExpired.and.callFake(
function() {
return false;
});
auth.isAuthenticated = false;
auth.authenticate.and.callFake(function() {return $q.when(false);});
authenticationService.getIsLoggedIn().then(function(result) {
expect(result).toBeFalsey;
expect(auth.authenticate).toHaveBeenCalledWith('myToken', 'myToken');
});
});
it('should sign out and clear the tokens when logging out', function() {
authenticationService.logOut();
expect(auth.signout).toHaveBeenCalled();
expect(store.remove).toHaveBeenCalledWith('smc_auth_token');
expect(store.remove).toHaveBeenCalledWith('smc_auth_profile');
});
it('should redirect to the home page when logging out', function() {
authenticationService.logOut();
expect(location.path).toHaveBeenCalledWith('/');
});
it('should call any callbacks when logging out', function() {
var foo = 0;
authenticationService.addAuthChangeCallback(function() {
foo = 1;
});
authenticationService.logOut();
expect(foo).toEqual(1);
});
it('should continue instead of re-logging in if the user is already authenticated', function() {
store.get.and.callFake(
function() {
return 'myToken';
});
jwtHelper.isTokenExpired.and.callFake(
function() {
return false;
});
auth.isAuthenticated = true;
authenticationService.authenticateAndRedirect().then(function(status) {
expect(status).toBeTruthy();
});
});
it('should stop and redirect to the login page if the user is not authenticated', function() {
store.get.and.callFake(
function() {
return null;
});
authenticationService.authenticateAndRedirect().then(function(status) {
expect(status).toBeUndefined();
expect(auth.signin).toHaveBeenCalled();
});
});
it('should call the authentication provider when logging in', function() {
authenticationService.logIn();
expect(auth.signin).toHaveBeenCalledWith({disableSignupAction: true,});
});
it('should redirect to an error page if login fails', function() {
authenticationService.processLoginFailure();
expect(location.path).toHaveBeenCalledWith('/error');
});
it('should save the auth tokens when login is successful', function() {
authenticationService.processLogin('profile1', 'token2');
expect(store.set).toHaveBeenCalledWith('smc_auth_profile', 'profile1');
expect(store.set).toHaveBeenCalledWith('smc_auth_token', 'token2');
});
it('should redirect, if specified, and then clear the cookie', function() {
cookies.get.and.callFake(function() {
return '/foo';
});
authenticationService.processLogin();
expect(location.url).toHaveBeenCalledWith('/foo');
expect(cookies.remove).toHaveBeenCalledWith('returnTo');
});
it('should use the prod authentication app in production', function() {
environmentService.getEnvironment.and.callFake(function() {
return 'PRD';
});
expect(authenticationService.getClientId()).toEqual('0lqvllBTphFILz1Awjlxo5stP8C6pMLn');
});
it('should use the non-prod authentication app outside production', function() {
environmentService.getEnvironment.and.callFake(function() {
return 'TST';
});
expect(authenticationService.getClientId()).toEqual('fuMX6JViIhikzymPiXEjsHh8dhplEirc');
});
});
@emi, well, thanks for your feedback also there is a really nice piece of auth code :). I might give it a try to node.js too. But i want to head to GOLANG as it seems is way faster than node.js :).
-
Re: Website with new functionality - Waiting for your vision!
Wooow, I read some articles about AngularJS and its veeeery nice. I going to try learn it. I am just afraid of taking objects from database and connection with msswl but we will see. Thanks guys so much I going to start over again using angular. You think use pure angular is good idea?
-
Re: Website with new functionality - Waiting for your vision!
Well you have to write some API firstly before you start writing the website in angularjs. In what language you'll write the API, well thats up to you.
-
Re: Website with new functionality - Waiting for your vision!
So can be angularjs as frontend and api writed in php as back-end?
-
Re: Website with new functionality - Waiting for your vision!
Quote:
Originally Posted by
Dens666
So can be angularjs as frontend and api writed in php as back-end?
Sure thing. Also carefull when you code that restful api in php, you must know a lot about php, what to use and what not so that you can get the less time possible to parse. You must know about optimizations before you start because you'll work with large amount of data.
-
Re: Website with new functionality - Waiting for your vision!
Quote:
Originally Posted by
Dens666
So can be angularjs as frontend and api writed in php as back-end?
Why are you so bent on php ? Look up MEAN stack. If you actually want to learn that's a great thing to know when looking for a job.
-
Re: Website with new functionality - Waiting for your vision!
Quote:
Originally Posted by
PunkS7yle
Why are you so bent on php ? Look up MEAN stack. If you actually want to learn that's a great thing to know when looking for a job.
Maybe he wants to use php because its an easy language for him? But you're right :).
-
Re: Website with new functionality - Waiting for your vision!
Yea, I really like PHP I have spend much time on it and will be easier for me to implement it with angular.
@Punk, yes I saw MEAN today and it looks really nice but I think it's not designed for small projects like cabal website :p btw. Have you worked with MEAN maybe? It's looks reaaaly nice.
-
Re: Website with new functionality - Waiting for your vision!
Quote:
Originally Posted by
Dens666
Yea, I really like PHP I have spend much time on it and will be easier for me to implement it with angular.
@
Punk, yes I saw MEAN today and it looks really nice but I think it's not designed for small projects like cabal website :p btw. Have you worked with MEAN maybe? It's looks reaaaly nice.
A bit, mostly for back-end side of things, I try to stay away from web stuff, not my passion.
-
Re: Website with new functionality - Waiting for your vision!
-
Re: Website with new functionality - Waiting for your vision!
@allocen really nice website
-
Re: Website with new functionality - Waiting for your vision!
Quote:
Originally Posted by
RGaming
I'm developing it in angularjs with custom angular material theme + php REST API written in Phalcon.
Also for rankings and my characters i'm gonna export ingame characters into .obj and import them into my website so i can have 3D at 360deg each character and manipulate it just like i want. :). The same applies to a world map :).
-
Re: Website with new functionality - Waiting for your vision!
Quote:
Originally Posted by
allocen
Awesome design my friend lol.
You project template in Photoshop? Or you use some raw objects and css?
-
Re: Website with new functionality - Waiting for your vision!
Quote:
Originally Posted by
Dens666
Awesome design my friend lol.
You project template in Photoshop? Or you use some raw objects and css?
No photoshop, not at all. CSS3 only and few images like light pattern and so on. And is not just the design, its also functional. :)
-
Re: Website with new functionality - Waiting for your vision!
Aluuucen are you willing to show your project on teamviver? I would want just to take a look on your code, functionality etc.
No copy & pasta :junglejane:
-
Re: Website with new functionality - Waiting for your vision!
Quote:
Originally Posted by
Dens666
Aluuucen are you willing to show your project on teamviver? I would want just to take a look on your code, functionality etc.
No copy & pasta :junglejane:
I'm afraid not. Thanks for understanding. :)
-
Re: Website with new functionality - Waiting for your vision!
Quote:
Originally Posted by
allocen
I'm afraid not. Thanks for understanding. :)
haha no problem :)
"custom angular material theme" can you tell me more about it? Show some examples?
About phalcon, you think it's good? Worth to use it?
-
Re: Website with new functionality - Waiting for your vision!
Quote:
Originally Posted by
Dens666
haha no problem :)
"custom angular material theme" can you tell me more about it? Show some examples?
About phalcon, you think it's good? Worth to use it?
Just check the angular material docs about custom theming. About phalcon, its really fast and helps me alot in parsing large data when requesting for example GET /accounts which include transformer too in a short time :).
-
Re: Website with new functionality - Waiting for your vision!
why wld ya learn basic when c is already out -.- ? i'm using laravel + vue.js :P simply hate angular, react is kinda ok, but still doesn't feel right :D tho i love how this community is all about showoffs :) keep being ragezone u guys :D
le: btw nice design u got there, sux u didn't make it urself :) i guess our website really was that nice :P
-
Re: Website with new functionality - Waiting for your vision!
Quote:
Originally Posted by
x30unlimited
why wld ya learn basic when c is already out -.- ? i'm using laravel + vue.js :P simply hate angular, react is kinda ok, but still doesn't feel right :D tho i love how this community is all about showoffs :) keep being ragezone u guys :D
le: btw nice design u got there, sux u didn't make it urself :) i guess our website really was that nice :P
Yea since .ws is closed I allowed myself to take some parts of it :D But don't worry, i starting over again using angular and trying to made smth on my own. Kinda hard while i am not so skilled on photoshop. I saw magicians which can make nice website using pure css but i am not the one @_@
btw. Why vue would be better then angular? it's seems to be the same.
-
Re: Website with new functionality - Waiting for your vision!
Quote:
Originally Posted by
Dens666
I allowed myself to take some parts of it :D But don't worry, i starting over again
i didn't mind :P actually quite proud u liked our design :)
Quote:
Originally Posted by
Dens666
Why vue would be better then angular? it's seems to be the same.
i never said better (tho arguably in a larger scale app with a ton of reactive data angular will rebuild the dom every iteration, vue won't :P giving it a big advantage, tho not far from react :D), i said it feels right coding in it, compared to angular or react :D but that's just me, some ppl like coding in vb, i prefer c++ since it makes you think differently about stuff :P and look up laravel, php still has a lot of power, don't listen to the node fanboys :) proof of it being php based websockets that work as fast as node ones :D but hey, some ppl just don't read :P
-
Re: Website with new functionality - Waiting for your vision!
-
Re: Website with new functionality - Waiting for your vision!
@allocen Since your start in cabal section, you never stopped developing your skills. Keep going boyy :)
I like the simply style and colors.. Waiting for a demo access :)
-
Re: Website with new functionality - Waiting for your vision!
It's awesome allocen, my thread become yours XD
You did really nice job.
-
Re: Website with new functionality - Waiting for your vision!
More to come, when it gets stable enough i'm gonna try buy a host and setup a demo and put the frontend and the API will be hosted in my PC only.
Also i forgot to add a screenshot where the website detect automatic when you are out of an internet connection just like facebook and the website gets unusable till you have back an internet connection, all realtime.
-
Re: Website with new functionality - Waiting for your vision!
Preview of HEKATE API Documentation:
http://s33.postimg.org/qub80jwff/hekate_api.jpg
http://s33.postimg.org/lb0x1ibxn/image.jpg
The API is still incomplete, as there is a lot of work left to do.
Also supports exporting the documentation and postman as JSON, that easily could be imported to Chrome Postman for various tests.
-
Re: Website with new functionality - Waiting for your vision!
@allocen your website is really nice
-
Re: Website with new functionality - Waiting for your vision!
@allocen I think that's a start but there's lots of room for improvement starting from changing your base url to something like api/v1/accounts to defining what are the field type and what is required and what not. At this point looks by far the most professional website for cabal that I've seen in Rz, congrats and weiter so!
-
Re: Website with new functionality - Waiting for your vision!
@emi, thanks, i know that there is still room for improvement, but as i said, this API is still incomplete. Still the WEB and API its on an early alpha stage. Hope by the end of the summer to bring both to the beta stage or even better to a ready to use stage. So much work to be done.
API query parameters:
- fields
- offset
- limit
- having
- where
- or
- in
- sort
-
Re: Website with new functionality - Waiting for your vision!
I guess you'll also add some authentication to those APIs :):
-
Re: Website with new functionality - Waiting for your vision!
-
Re: Website with new functionality - Waiting for your vision!
Quote:
Originally Posted by
emi
@
allocen I think that's a start but there's lots of room for improvement starting from changing your base url to something like api/v1/accounts to defining what are the field type and what is required and what not. At this point looks by far the most professional website for cabal that I've seen in Rz, congrats and weiter so!
There has never been a professional website for cabal on RZ :laugh::laugh::laugh: