diff --git a/client/client/src/create/create.html b/client/client/src/create/create.html
index ca7b4d899..61103e638 100644
--- a/client/client/src/create/create.html
+++ b/client/client/src/create/create.html
@@ -1,4 +1,4 @@
-
+
{
+ Client.createUserProfile = (data, callback) => {
let user = {
name: data.userName,
email: data.email,
@@ -28,6 +28,7 @@ module.exports = function(Client){
app.models.Account.beginTransaction('READ COMMITTED', (err, transaction) => {
app.models.Account.create (user, {transaction}, (err, account) => {
if (err) {
+ transaction.rollback();
return callback(err);
}
@@ -38,7 +39,7 @@ module.exports = function(Client){
id: account.id
};
- Client.create (client, (err, client) => {
+ Client.create (client, {transaction}, (err, client) => {
if (err) {
transaction.rollback();
return callback(err);
diff --git a/services/client/common/models/account.js b/services/client/common/models/account.js
new file mode 100644
index 000000000..5b47bdaa9
--- /dev/null
+++ b/services/client/common/models/account.js
@@ -0,0 +1,8 @@
+module.exports = function(Account) {
+
+ // Validations
+
+ Account.validatesUniquenessOf('name', {
+ message: 'Ya existe un usuario con ese nombre'
+ });
+};
\ No newline at end of file