Skip to content

Backend Validation for Unique Email for Sql Buggy #2159

Open
@atodicebear

Description

@atodicebear
  • I understand that GitHub issues are not for tech support, but for questions specific to this generator, bug reports, and feature requests.
Item Version
generator-angular-fullstack 3.7.5
Node 4.4.5
npm 3.9.6
Operating System Windows7
yo 1.8.4
Item Answer
Transpiler Babel
Markup HTML
CSS SCSS
Router ui-router
Build Tool Gulp
Client Tests Mocha
DB MsSQL
Auth Y
etc etc

Hey,
I have Installed this Generator anew using:
yo angular-fullstack
For the Validation with MsSql for unique Email there is a Bug?

 // Update validity of form fields that match the sequelize errors
          if (err.name) {
            angular.forEach(err.fields, field => {
              form[field].$setValidity('mongoose', false);
              this.errors[field] = err.message;
            });
          }
        });

This is the Generated code for SQL user.
It throws normally a 422 Error but as well
TypeError: Cannot read property '$setValidity' of undefined
So as well there is no
"This Email is alrleady used..." Error Message output.
Changing the code to the same as for MongoDb

 // Update validity of form fields that match the sequelize errors
          if (err.name) {
            angular.forEach(err.fields, (error,field) => {
              form[field].$setValidity('mongoose', false);
              this.errors[field] = err.message;
            });
          }
        });

Solves the Problem.
Tried it with the Generated Admin and TestUser after a Clean Install.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions