Created
April 10, 2017 01:07
-
-
Save shoxter/bd18220ba8038250ffcdd78062246ed5 to your computer and use it in GitHub Desktop.
Basic Ember Login Form
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Ember from 'ember'; | |
export default Ember.Controller.extend({ | |
init() { | |
this._super(...arguments); | |
let passwordValidation = [{ | |
message: "Must be at least 8 characters", | |
validate: (inputValue) => { | |
let inputLength = inputValue.length; | |
return inputLength >= 8; | |
} | |
}]; | |
let confirmPasswordValidation = [{ | |
message: "Must be at least 8 characters", | |
validate: (inputValue) => { | |
let inputLength = inputValue.length; | |
return inputLength >= 8; | |
} | |
}, | |
{ | |
message: "Passwords must match", | |
validate: (inputValue) => { | |
let firstPassword = this.get('password'); | |
return firstPassword === inputValue; | |
} | |
}]; | |
this.set('passwordValidation', passwordValidation); | |
this.set('confirmPasswordValidation', confirmPasswordValidation); | |
}, | |
appName: 'Basic Login Form', | |
actions: { | |
submitForm() { | |
this.set('userRegistered', true); | |
Ember.run.later(this, function() { | |
this.set('userRegistered', false); | |
this.set('username', ''); | |
this.set('password', ''); | |
this.set('confirmPassword', ''); | |
}, 1500); | |
} | |
} | |
}); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"version": "0.12.1", | |
"EmberENV": { | |
"FEATURES": {} | |
}, | |
"options": { | |
"use_pods": false, | |
"enable-testing": false | |
}, | |
"dependencies": { | |
"jquery": "https://cdnjs.cloudflare.com/ajax/libs/jquery/1.11.3/jquery.js", | |
"ember": "2.12.0", | |
"ember-template-compiler": "2.12.0", | |
"ember-testing": "2.12.0" | |
}, | |
"addons": { | |
"ember-data": "2.12.1", | |
"ember-paper": "v1.0.0-alpha.19", | |
"liquid-fire": "0.27.1" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment