Added IValidatable; moved validation to FormData

I still struggle to find out how to deal with arguments like
$userNameOrEmail. Should I trim() them in controllers, or in service?
If I do it in service, shouldn't all of such validation belong in there?
This commit is contained in:
Marcin Kurczewski
2014-09-09 19:38:16 +02:00
parent e6c7ed7e11
commit c117367974
16 changed files with 170 additions and 81 deletions

View File

@ -26,9 +26,9 @@ App.Auth = function(_, jQuery, util, api, appState, promise) {
listTags: 'listTags',
};
function loginFromCredentials(userName, password, remember) {
function loginFromCredentials(userNameOrEmail, password, remember) {
return promise.make(function(resolve, reject) {
promise.wait(api.post('/login', {userName: userName, password: password}))
promise.wait(api.post('/login', {userNameOrEmail: userNameOrEmail, password: password}))
.then(function(response) {
updateAppState(response);
jQuery.cookie(