Moved users

This commit is contained in:
thosakwe 2016-09-21 02:59:40 -04:00
parent 78ae1dfe92
commit f1f6ad2092
4 changed files with 6 additions and 5 deletions

View file

@ -30,7 +30,7 @@ class User extends Model {
"email": email, "email": email,
"username": username, "username": username,
"password": password, "password": password,
roles: roles "roles": roles
}; };
} }
} }

View file

@ -2,7 +2,7 @@ library angel.routes.controllers.auth;
import 'package:angel_auth/angel_auth.dart'; import 'package:angel_auth/angel_auth.dart';
import 'package:angel_framework/angel_framework.dart'; import 'package:angel_framework/angel_framework.dart';
import '../../services/user/user.dart'; import '../../services/user.dart';
@Expose("/auth") @Expose("/auth")
class AuthController extends Controller { class AuthController extends Controller {

View file

@ -4,7 +4,7 @@ library angel.services;
import 'package:angel_framework/angel_framework.dart'; import 'package:angel_framework/angel_framework.dart';
import 'package:mongo_dart/mongo_dart.dart'; import 'package:mongo_dart/mongo_dart.dart';
import 'user/user.dart' as User; import 'user.dart' as User;
configureServer(Angel app) async { configureServer(Angel app) async {
Db db = new Db(app.properties["mongo_db"]); Db db = new Db(app.properties["mongo_db"]);

View file

@ -3,8 +3,8 @@ import 'package:angel_mongo/angel_mongo.dart';
import 'package:crypto/crypto.dart' show sha256; import 'package:crypto/crypto.dart' show sha256;
import 'package:mongo_dart/mongo_dart.dart'; import 'package:mongo_dart/mongo_dart.dart';
import 'package:validate/validate.dart'; import 'package:validate/validate.dart';
import '../../models/user.dart'; import '../models/user.dart';
export '../../models/user.dart'; export '../models/user.dart';
configureServer(Db db) { configureServer(Db db) {
return (Angel app) async { return (Angel app) async {
@ -49,6 +49,7 @@ class UserService extends Service {
try { try {
Validate.isKeyInMap("username", data); Validate.isKeyInMap("username", data);
Validate.isKeyInMap("password", data);
Validate.isEmail(data["email"]); Validate.isEmail(data["email"]);
data["password"] = hashPassword(data["password"]); data["password"] = hashPassword(data["password"]);
} catch (e) { } catch (e) {