我在注册后为用户设置了自动身份验证:
应用程序/库/自动authenticate.js
export default Ember.SimpleAuth.Authenticators.OAuth2.extend({
authenticate: function(credentials) {
if(!Ember.isEmpty(credentials.access_token)) {
return Ember.RSVP.resolve(credentials);
} else {
return this._super(credentials);
}
}
});
Run Code Online (Sandbox Code Playgroud)
应用程序/ app.js
import AutoAuthenticate from 'appkit/libs/auto-authenticate';
App.initializer({
name: 'auto',
initialize: function(container, application) {
container.register('app:authenticators:custom', AutoAuthenticator);
Ember.SimpleAuth.setup(container, application);
}
});
Run Code Online (Sandbox Code Playgroud)
应用程序/控制器/ register.js
export default Ember.ObjectController.extend({
firstname: '',
lastname: '',
username: '',
password: '',
actions: {
registerUser: function(){
var self = this;
var user = this.store.createRecord('user', {
first_name: this.get('firstname'),
last_name: this.get('lastname'),
username: this.get('username')
});
user.set('typedPass', this.get('password'));
user.save().then(function(){
//How can I login this …Run Code Online (Sandbox Code Playgroud) 我有一个使用Ember-App-Kit(EAK)提供的入门套件的小型余烬应用程序.我在构建生产AWS EC2实例后上传了dist目录.
我现在面临的问题::
首先我认为这是由于权限错误,但它只是单个html文件,js和css正在加载正确.然后想到可能是htaccess问题所以试图插入一个,但之后也没有效果.应用程序源代码的条带化版本驻留在源代码中
用于重定向的.htaccess文件::
RewriteEngine On
RewriteBase /
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !index
RewriteRule ^(.*)$ /index.html [L]
Run Code Online (Sandbox Code Playgroud) 如何在一个Jetty应用程序中配置系统环境变量?
例如,对于数据库连接细节,将其放入文件并将其检入cvs是个坏主意.因此,使用系统环境是一种可行的方法.虽然系统环境变量是在/etc/environments文件或.bashrc/.zshrc文件中定义的,但在Jetty应用程序中,执行操作System.getenv("variable_name")不会提供任何内容.它将导致null.
我已经读过这个问题:使用env变量配置一个Jetty应用程序,它结束了告诉Jetty不支持System.getenv()甚至不支持start.ini文件的内容.
和ubuntu 12.10上的jetty和etc环境一样In the jetty.sh script you can source the /etc/environment file and they will be present.,我说我试过并没有得到预期的值,这意味着它只给了我null.
如果我不能使用默认System.getenv()或任何.ini文件,那么如何指定数据库连接等凭据?