diff --git a/app/pods/users/requestlockouthelp/controller.js b/app/pods/users/requestlockouthelp/controller.js index ccda273..2930b31 100644 --- a/app/pods/users/requestlockouthelp/controller.js +++ b/app/pods/users/requestlockouthelp/controller.js @@ -1,15 +1,18 @@ import Ember from 'ember'; import ajaxRequest from '../../../utils/ajax-request'; -export default Ember.Controller.extend({ - session: Ember.inject.service('session'), +const { Controller, inject: { service } } = Ember; + +export default Controller.extend({ + session: service(), + globals: service(), actions: { - save: function() { - let url = `${this.get('globals.apiURL')}/api/${this.get('globals.genus')}/users/lockout`; - let options = { + submit: function(email) { + const url = `${this.get('globals.apiURL')}/api/${this.get('globals.genus')}/users/lockout`; + const options = { method: 'POST', - data: { email: this.get('email') }, + data: { email: email }, }; ajaxRequest(url, options, this.get('session')); this.transitionToRoute('login'); diff --git a/app/pods/users/requestlockouthelp/lockout-form/component.js b/app/pods/users/requestlockouthelp/lockout-form/component.js new file mode 100644 index 0000000..2b7426f --- /dev/null +++ b/app/pods/users/requestlockouthelp/lockout-form/component.js @@ -0,0 +1,18 @@ +import Ember from 'ember'; + +const { Component } = Ember; + +export default Component.extend({ + email: null, + "on-submit": null, + + actions: { + save: function() { + return this.attrs["on-submit"](this.get('email')); + }, + + emailDidChange: function(value) { + this.set('email', value); + }, + } +}); diff --git a/app/pods/users/requestlockouthelp/lockout-form/template.hbs b/app/pods/users/requestlockouthelp/lockout-form/template.hbs new file mode 100644 index 0000000..5f18a09 --- /dev/null +++ b/app/pods/users/requestlockouthelp/lockout-form/template.hbs @@ -0,0 +1,18 @@ +
+
+
+ Account Lockout/Password Reset +
+
    +
  • + + {{one-way-input type="text" class="email" value=email update=(action "emailDidChange")}} +
  • +
  • + +
  • +
+
+
+
+
diff --git a/app/pods/users/requestlockouthelp/route.js b/app/pods/users/requestlockouthelp/route.js deleted file mode 100644 index 19831b4..0000000 --- a/app/pods/users/requestlockouthelp/route.js +++ /dev/null @@ -1,8 +0,0 @@ -import Ember from 'ember'; - -export default Ember.Route.extend({ - deactivate: function() { - this.controller.set('email', null); - }, - -}); diff --git a/app/pods/users/requestlockouthelp/template.hbs b/app/pods/users/requestlockouthelp/template.hbs index 7cdd25f..c482b70 100644 --- a/app/pods/users/requestlockouthelp/template.hbs +++ b/app/pods/users/requestlockouthelp/template.hbs @@ -1,18 +1,4 @@ -
-
-
- Account Lockout/Password Reset -
-
    -
  • - - {{input value=email}} -
  • -
  • - -
  • -
-
-
-
-
+{{ + users/requestlockouthelp/lockout-form + on-submit=(action "submit") +}}