mirror of
https://github.com/moparisthebest/mail
synced 2024-08-13 16:43:47 -04:00
41 lines
1017 B
JavaScript
41 lines
1017 B
JavaScript
|
'use strict';
|
||
|
|
||
|
app.view.LoginView = Backbone.View.extend({
|
||
|
|
||
|
initialize: function(args) {
|
||
|
this.template = _.template(app.util.tpl.get('login'));
|
||
|
this.dao = args.dao;
|
||
|
},
|
||
|
|
||
|
render: function(eventName) {
|
||
|
var self = this, page = $(this.el);
|
||
|
|
||
|
page.html(this.template());
|
||
|
page.attr('data-theme', 'a');
|
||
|
|
||
|
page.find('#loginBtn').on('vmousedown', function() {
|
||
|
self.login();
|
||
|
});
|
||
|
|
||
|
return this;
|
||
|
},
|
||
|
|
||
|
login: function() {
|
||
|
var page = $(this.el),
|
||
|
userId = page.find('#userId').val(),
|
||
|
password = page.find('#password').val();
|
||
|
|
||
|
var account = new app.model.Account({
|
||
|
emailAddress: userId,
|
||
|
symKeySize: app.config.symKeySize,
|
||
|
symIvSize: app.config.symIvSize
|
||
|
});
|
||
|
|
||
|
// show loading msg during init
|
||
|
$.mobile.loading('show', { text: 'Unlocking...', textVisible: true, theme: 'c' });
|
||
|
this.dao.init(account, password, function() {
|
||
|
$.mobile.loading('hide');
|
||
|
window.location = '#accounts/' + account.get('emailAddress') + '/folders';
|
||
|
});
|
||
|
}
|
||
|
});
|