diff --git a/app/initializers/global-variables.js b/app/initializers/global-variables.js
index 7090375..554e6d8 100644
--- a/app/initializers/global-variables.js
+++ b/app/initializers/global-variables.js
@@ -8,6 +8,7 @@ var globals = Ember.Object.extend({
export function initialize(container, application) {
application.register('service:globals', globals, {singleton: true});
+ application.inject('route', 'globals', 'service:globals');
application.inject('controller', 'globals', 'service:globals');
application.inject('component', 'globals', 'service:globals');
application.inject('adapter', 'globals', 'service:globals');
diff --git a/app/pods/application/route.js b/app/pods/application/route.js
index e3173ee..0754183 100644
--- a/app/pods/application/route.js
+++ b/app/pods/application/route.js
@@ -10,10 +10,6 @@ export default Ember.Route.extend(ApplicationRouteMixin, {
});
},
- didTransition: function() {
- this.get('flashMessages').clearMessages();
- return true;
- },
+ },
- }
});
diff --git a/app/pods/components/custom-flash-message/template.hbs b/app/pods/components/custom-flash-message/template.hbs
index 2197d70..3927cab 100644
--- a/app/pods/components/custom-flash-message/template.hbs
+++ b/app/pods/components/custom-flash-message/template.hbs
@@ -1 +1 @@
-{{flash.message}}
+✖ {{flash.message}}
diff --git a/app/pods/components/x-application/template.hbs b/app/pods/components/x-application/template.hbs
index 7fd81aa..04d7ca2 100644
--- a/app/pods/components/x-application/template.hbs
+++ b/app/pods/components/x-application/template.hbs
@@ -44,7 +44,9 @@
{{#each flashMessages.queue as |flash|}}
- {{custom-flash-message flash=flash}}
+ {{#flash-message flash=flash as |component flash|}}
+ {{custom-flash-message flash=flash}}
+ {{/flash-message}}
{{/each}}
{{yield}}
diff --git a/app/pods/users/new/fail/route.js b/app/pods/users/new/fail/route.js
deleted file mode 100644
index 26d9f31..0000000
--- a/app/pods/users/new/fail/route.js
+++ /dev/null
@@ -1,4 +0,0 @@
-import Ember from 'ember';
-
-export default Ember.Route.extend({
-});
diff --git a/app/pods/users/new/fail/template.hbs b/app/pods/users/new/fail/template.hbs
deleted file mode 100644
index 534f7e0..0000000
--- a/app/pods/users/new/fail/template.hbs
+++ /dev/null
@@ -1 +0,0 @@
-Failure
diff --git a/app/pods/users/new/success/route.js b/app/pods/users/new/success/route.js
deleted file mode 100644
index 26d9f31..0000000
--- a/app/pods/users/new/success/route.js
+++ /dev/null
@@ -1,4 +0,0 @@
-import Ember from 'ember';
-
-export default Ember.Route.extend({
-});
diff --git a/app/pods/users/new/success/template.hbs b/app/pods/users/new/success/template.hbs
deleted file mode 100644
index f5fbd3c..0000000
--- a/app/pods/users/new/success/template.hbs
+++ /dev/null
@@ -1 +0,0 @@
-Success
diff --git a/app/pods/users/new/verify/route.js b/app/pods/users/new/verify/route.js
index 26d9f31..3878445 100644
--- a/app/pods/users/new/verify/route.js
+++ b/app/pods/users/new/verify/route.js
@@ -1,4 +1,42 @@
import Ember from 'ember';
export default Ember.Route.extend({
+ apiURL: function() {
+ return this.get('globals.apiURL');
+ }.property(),
+
+ genus: function() {
+ return this.get('globals.genus');
+ }.property(),
+
+ model: function(params) {
+ let url = this.get('apiURL') + '/api/' + this.get('genus') + '/users/verify/' + params.nonce;
+ return new Ember.RSVP.Promise(function(resolve, reject) {
+ let options = {
+ success: function(data){
+ resolve(data);
+ },
+ error: function(jqXHR, status, error){
+ reject(jqXHR, status, error);
+ },
+ dataType: 'text json',
+ };
+ Ember.$.ajax(url, options);
+ });
+ },
+
+
+ afterModel: function(model/*, transition*/) {
+ this.get('flashMessages').success(model.msg);
+ this.transitionTo('login');
+ },
+
+ actions: {
+ error: function(error/*, transition*/) {
+ let err = Ember.$.parseJSON(error.responseText);
+ this.get('flashMessages').error(err.error);
+ this.transitionTo('login');
+ }
+ },
+
});
diff --git a/app/router.js b/app/router.js
index 5fb53e3..3dc92aa 100644
--- a/app/router.js
+++ b/app/router.js
@@ -10,9 +10,7 @@ Router.map(function() {
this.route('users', function() {
this.route('new', function() {
- this.route('fail');
- this.route('success');
- this.route('verify', { path: ':nonce' });
+ this.route('verify', { path: 'verify/:nonce' });
});
});